Friday, February 23, 2024

Stored procedure for Search or Filter in sql

 ALTER PROCEDURE [dbo].[SSP_GetAllTest]

@UserOfficeId bigint,

@RoleId bigint,

@ApplicationNo nvarchar(50) = '',

@RCNo nvarchar(50) = '',

@ApplicationTypeId int = 0,

@Status int = -1,  -- -1 for selct All, 0 for Active/Pending, 1 for Disposed

@BranchOfficeId bigint = 0,

@ZoneId bigint = 0

How to Fix Error Code: Out of Memory in Chrome, Edge, Firefox - Computer speed is slow - to fast the computer speed

 chrome://restart

storage system in start search

    Thursday, February 22, 2024

    Accordion bootstrap, Updatepanel ASP.NET

    <asp:UpdatePanel runat="server" ID="updatePanelAppeals" UpdateMode="Conditional">

    <Triggers>

                    <asp:AsyncPostBackTrigger ControlID="btnSearch" />

                </Triggers>

    </asp:UpdatePanel >

    or


    updatePanelAppeals.Update();


    we can use one from this. or in every update panel we have to add triggers.

     https://getbootstrap.com/docs/5.0/components/accordion/


    https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.asyncpostbacktrigger?view=netframework-4.8.1

    Wednesday, February 21, 2024

    how to pass parameter of stored procedure or parameter of function as datetime

     select dbo.Age (convert(varchar, '01/02/2000',105) )  -- date as mm/dd/yyyy



    ref:- https://stackoverflow.com/questions/8694503/how-to-pass-the-datetime-value-as-parameter-to-a-stored-procedure

    How to create Temporary table in SQL - Temp table - with drop temp table

     WITH OfficeHierarchy AS 

        (

            -- Anchor member (initial data)

            SELECT TableID, OffName, OffType, ParentID

            FROM M_OfficeMaster

            WHERE TableID = @OfficeID  

    )

    SELECT * FROM OfficeHierarchy


    Not :- This above will not work in if and else conditions


    Use below code

    SELECT 

    ChargeSheetId

    ,CourtCaseNumber

    ,[Date] AS ChSheetDate

    ,DisposalDate

    ,CnrNumber

    INTO #ChargeSheets

    FROM ChargeSheet 

    WHERE OfficeId= @OfficeId AND FIRNumber = @RCNumber 

    AND IsActive=1;


    DROP TABLE IF EXISTS #ChargeSheets

    SQL Error 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.

     To resolve this error just remove below line

    USE DBNAME

    Tuesday, February 20, 2024

    Disable cursor in ASP.NET controls and set cursor to pointer in anchor tag

    style "cursor", "not-allowed"



    style="cursor: pointer"

    How to set a property in user control

       public bool IsAddnewButtonEnable

            {

                set

                {

                    if (value == true)

                    {

                        lnkAddNew.Visible = true;

                    }

                    else

                    {

                        lnkAddNew.Visible = false;

                    }

                }

            }



    <uc1:UCUploadDocumentUsingSession runat="server" ID="ucUploadDocumentUsingSession" IsAddnewButtonEnable="false" />

    Temporary File of Visual studio SQL stores in window

     User/AppData/Local/Temp

    How to make Label of 1000 varchar to show correctly

    style="word-wrap:break-word"

    Two dropdowns with changing value from one - asp.net

     at page load

    {
    LoadCourtsByCourtTypeId(0);
    }
    protected void ddlTypeOfCourt_SelectedIndexChanged(object sender, EventArgs e)
            {
                LoadCourtsByCourtTypeId(long.Parse(ddlTypeOfCourt.SelectedValue));
            }
                
                if (courtApplicationDatesDTO != null && courtApplicationDatesDTO.DatesId > 0)
                {
                LoadCourtsByCourtTypeId(long.Parse(ddlTypeOfCourt.SelectedItem.Value));
                    ddlNameOfCourt.SelectedValue = courtApplicationDatesDTO.CourtId.ToString();
                }

    Tuesday, February 13, 2024

    RegularExpressionValidator with no special characters max and min length

    ref:- https://www.aspsnippets.com/Articles/198/ASP.Net-Regular-Expression-Validator-to-validate-Minimum-and-Maximum-Text-Length/ 

    Regex regular expression with 100 to 9999 and at last comma

     \b[1-9][0-9]{2,3}\b,




    Rad combobox with compare validator

      <telerik:RadComboBox ID="ddlCourtName" runat="server"  ClientIDMode="Static" InitialValue="0" CssClass="uk-width-1-2" Filter="Contains" CheckBoxes="false" EnableCheckAllItemsCheckBox="false" Style="width: 50% !important;">

                                            <Localization CheckAllString="Select All" />

                                        </telerik:RadComboBox>

                                        <asp:CompareValidator runat="server" ValueToCompare="Select" Operator="NotEqual" ControlToValidate="ddlCourtName" ErrorMessage="required" CssClass="uk-width-1-4" ValidationGroup="StayDetailsValidationGroup" Display="Dynamic" SetFocusOnError="true" ForeColor="Red" />



    ddlJudgementOrderIssuedBy.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0"));

    How to add multiple values in insert query in SQL

    INSERT INTO Court (Name, IsActive, CreatedDate, CreatedBy, CourtTypeId)  (select Name, IsActive, getdate() AS CreatedDate, CreatedBy, 3 AS CourtTypeId  from Lookup where lookupcategory =36 and parentlookupid = 87)


    or



     INSERT INTO graduates (id, name, age)

    SELECT id, name, age
    FROM students
    WHERE age >= 18;

    Monday, February 12, 2024

    How to register or add user control programmatically in aspx page

     <%@ Register Src="~/UserControls/UCUploadDocumentUsingSession.ascx" TagPrefix="uc1" TagName="UCUploadDocumentUsingSession" %>

    How to register or add ajax control toolkit programmatically on aspx page

     <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

    Monday, February 5, 2024

    Friday, February 2, 2024

    Error occurs Type Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable

     Add attribute serializable to class


    [Serializable]

        public class CourtApplicationDTO

    Telerik GridBoundColumn, GridTemplateColumn Null or empty text

    For GridBoundColumn   EmptyDataText ="Not Available"


    For GridTemplateColumn      Text='<%# DataBinder.Eval(Container.DataItem, "ApplicationCNRNumber")== null? "Not Available":DataBinder.Eval(Container.DataItem, "ApplicationCNRNumber")%>'

    SQL finding the max date record per user - - Foreign key and Primary key join with max date per user in foreign key - remove duplicate rows from table

     SELECT * from courtapplicationdetails ua left join ( SELECT 

        u1.*

    FROM

        courtapplicationproceedings AS u1

            LEFT JOIN

        courtapplicationproceedings AS u2 ON u1.ApplicationId = u2.ApplicationId

            AND u1.NextHearingDate < u2.NextHearingDate

    WHERE

        u2.NextHearingDate IS NULL

            AND u1.NextHearingDate IS NOT NULL) e on e.ApplicationId = ua.ApplicationId;


    or


    SELECT 

        u1.*

    FROM

        user_details u1

    WHERE

        u1.login_time = (SELECT 

                MAX(u2.login_time)

            FROM

                user_details u2

            WHERE

                u2.user_name = u1.user_name);



    or


    SELECT cad.ApplicationNo,output.DtOfInstitution,output.NextHearingDate

    FROM CourtApplicationDetails cad

    LEFT JOIN (

        SELECT cap.ApplicationId, cap.DtOfInstitution, cap.NextHearingDate

        FROM CourtApplicationProceedings cap,

    (SELECT Applicationid, MAX(NextHearingDate) as NextHearingDate   FROM CourtApplicationProceedings  GROUP BY ApplicationId) temp

    WHERE cap.ApplicationId = temp.ApplicationId and cap.NextHearingDate = temp.NextHearingDate

    ) output ON output.ApplicationId = cad.ApplicationId



    reference:- https://thispointer.com/mysql-select-row-with-max-date-per-user/

    Thursday, February 1, 2024

    CAS - Core Application Software - Core Application System - CMS - Case Management System

    Microsoft.Office.Core

    Microsoft.Office.12.0 Object Library

    VBIDE



    Microsoft.VBE.Interip

    VBIDE

    Microsoft Visual Basic For Application Extension