Friday, December 24, 2021

Start timer in javascript

Start timer in javascript

<script>
    $(document).ready(function () {
        CountDown();
    })

    function CountDown() {
        var tt ="23-Mar-22 10:26:34 AM";
        if (tt == null || tt == "") {
            $('#demo').show();
            document.getElementById("demo").innerHTML = "YOUR ID IS NOT ACTIVATED";
            return;
        }
        var countDownDate = new Date('23-Mar-22 10:26:34 AM').getTime();
        var x = setInterval(function () {
            //debugger;
            var now = new Date().getTime();
            var distance = countDownDate - now;
            var days = Math.floor(distance / (1000 * 60 * 60 * 24));
            var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
            var seconds = Math.floor((distance % (1000 * 60)) / 1000);

                $('#demo').show();
                document.getElementById("demo").innerHTML = "YOUR ID WILL BE EXPIRE IN " + days + " Day " + hours + "h "
                + minutes + "m " + seconds + "s ";

            if (distance < 0) {
                clearInterval(x);
                document.getElementById("demo").innerHTML = "YOUR ID IS EXPIRED";
            }
        }, 1000);
    }
</script>

 

Delete duplicate row in sql server

1. Delete duplicate row in sql server with CTC

With CTE as  
(  
Select Id,names,row_number() over (partition by id order by id) as rno from ##abc
)  
Select * from CTE order by id,names

With CTE as  
(  
Select Id,names,row_number() over (partition by id order by id) as rno from ##abc
)  
delete from CTE where rno>1

 



Thursday, December 23, 2021

Fill data with stored procedure in data table

1. Fill data into data table with stored procedure

_param = new SqlParameter[]
{  new SqlParameter("@SearchTerm",search),
    new SqlParameter("@search",""),
    new SqlParameter("@mobile",""),
   new SqlParameter("@topup",objmodel.user_type),
   new SqlParameter("@fromdate",objmodel.date),
   new SqlParameter("@todate",objmodel.todate),
   new SqlParameter("@PageIndex",1),
   //new SqlParameter("@PageSize",objmodel.pageSize),
   new SqlParameter("@RecordCount", SqlDbType.Int, 4) { Direction=ParameterDirection.Output}
};

_dt = _sf.returnDtBy_proc("GetCustomers_Pager", _param);
m1.totalCount = _param[7].Value.ToString();
if (_dt.Rows.Count > 0){
   
}

Friday, December 3, 2021

OPTION(MAXRECURSION 0)

 


--DECLARE @Min int;  

--DECLARE @Max int;  

--SET @Max = 10;  

--SET @Min = 1;  

--WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)  

--SELECT num FROM Sequence_  



--DECLARE @Min int;  

--DECLARE @Max int;  

--SET @Max = 110;  

--SET @Min = 1;  

--WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)  

--SELECT num FROM Sequence_  



DECLARE @Min int;  

DECLARE @Max int;  

SET @Max = 150;  

SET @Min = 1;  

WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)  

SELECT num FROM Sequence_  

OPTION(MAXRECURSION 32767)

--OPTION(MAXRECURSION 32768)

--OPTION(MAXRECURSION 0)

Wednesday, December 1, 2021

Store Procedure with Output Parameter

 Store Procedure  with Output Parameter


Stored procedure with Encryption


Table Valued Function
--Create
create function funTableValued()
returns table
as
return(
select * from test1.dbo.Employee
)
--Execute
select * from dbo.funTableValued()



Scaler Valued Functions
--Create
create function funScalerValued()
returns numeric(18,2)
as
begin
declare @num numeric(18,2)
select @num=count(*) from test1.dbo.Employee
return @num
end

--Execute
select dbo.funScalerValued()




Tuesday, November 23, 2021

Api Post Product with Product Detail List

 1. C# Post Code

        [HttpPost]
        [Route("data")]
        //public async Task<(int st, string msg, Receipt data)> PostReceipt([FromBody] Receipt receipt, [FromBody] List<Receipt_Det_bill> rec_det_list)
        public async Task<(int st, string msg, Receipt data)> PostReceipt([FromBody] ReceiptWithDet receiptWithDet)
        {
            Receipt receipt = receiptWithDet.receipt;
            List<Receipt_Det_bill> rec_det_list = receiptWithDet.receiptDet;           

            return (200, db.msg_success, receipt);
        }

2. C# Class Code

public partial class ReceiptWithDet
    {
        public Receipt receipt;
        public List<Receipt_Det_bill> receiptDet;
    }
public partial class Receipt
    {
        [Key]
        public int Srno { get; set; }
        public string Rec_Code { get; set; }
        public string U_id { get; set; }
    }
public partial class Receipt_Det_bill
    {  
        public string Rec_Code { get; set; }
        public string Sale_No { get; set; }
        public Nullable<DateTime> Odr_Date { get; set; }
        public Nullable<decimal> Net_Amount { get; set; }  
        public Nullable<bool> ok { get; set; }
    }


3. JSON Post

http://localhost:52776/api/receipt/data POST

{
receipt:{
Acc_No: null,
Amt: 50,
Pay_Mode: "CASH",
Pcode: "CU7",
Rec_Date: "2021-11-23",
Rec_No: null,
Remark: "ss",
},
receiptDet:[{
    Rec_Code:"22",
    Sale_Code:"11"
}]
}




Friday, November 12, 2021

HTML Tabs

 1.Details

<details>

  <summary>Heading<summary>

  <p> I just knew the detail tag and that also was told by Harry Sir in his HTML, CSS and JavaScript Course. </p>

</details>


2.bdo

<p>This is paragraph</p>

<p><bdo>This is paragraph</bdo></p>


3.abbr

<abbr title="OMGRK Software Solution">OSS</abbr>


4. samp

<p>This is paragraph</p>

<samp>This is paragraph</samp>


5. kbd

<kbd>CTRL 5</kbd>

When web application with sql server connection using sql client, working in visual studio but not working in localhost as in iis

Error:  The EXECUTE permission was denied on the object 'StoredProcedureTest1', database 'testDb1', schema 'dbo'.  C...