Wednesday, November 4, 2026

Convert 1.25x speed spent hours convert into normal (1x) speed spent hours

If I run a video with 1.25x or 125% speed till 1 hour 26 minuts, then normal hours will be ?

 

1 hours 26 minuts convert into hours

Total 60 + 26 minuts = 86 minuts

Into hours 86/60 = 1.433 hours

Speed up with 1.25x or 125%

               1.43 * 1.25 = 1.78 hours

Convert into normal minuts

               1.78 * 60 = 107.25 minuts or 1 hour 47.25 minuts

Monday, October 12, 2026

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'. 

ClientConnectionId:c48bf98e-e0ca-40f5-8ee9-8cd15b238d8a

Error Number:229,State:5,Class:14



"ConnectionStrings": { 

  "DefaultConnection": "Server=xyzServer;Database=testDb1;User Id=sa;Password=abcd..;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;"  

}


Solution:

if sql server connection is Windows authentication then use Trusted_Connection=True

if sql server connection is SQL Server authentication then use Trusted_Connection=False

Monday, June 29, 2026

Raw Insert query in EF8 or Entity Framwork 8

 


        public async Task<object> InsertRack(Rack RackInsert)

        {

            try

            {


                sql = " insert into Rack_Mas(Rac_Code, Rac_Name, Sort, com_code,Edate,Eu_Id) output inserted.* values(";

                sql += " (select 'RAC'+convert(nvarchar(50),(isnull(max(convert(numeric(18),substring(Rac_Code,4,15))),0)+1)) from Rack_Mas)";

                sql += " ,@p0 ";

                sql += " ,@p1 ";

                sql += " ,@p2";

                sql += " ,@p3";

                sql += " ,@p4";

                sql += " )";


                var data = _context.Database.SqlQueryRaw<Rack>(sql,

                    RackInsert.Rac_Name,

                    RackInsert.Sort,

                    "COM1",

                    DateTime.UtcNow.ToString("dd-MMM-yyyy HH:mm:ss.fff"),

                    "user1"

                    ).AsEnumerable().FirstOrDefault();


                return data;

            }

            catch (Exception)

            {

                throw;

            }

        }

Monday, August 8, 2022

get and post api in node js

 //http://localhost:3009/test1?id=100

app.get("/test1", (req, res) => {

  try {

    var request = new sqlClient.Request();

    const id = req.query.id;

    if (id) {

      //request.query("select uid,edate,email from login with(nolock) where uid="+id,

      request.query(`exec temp_login @uid=`+id+`,`,

        function (err, recordset) {

          if (err) {

            console.log(err);

            res.status(400).send({ success: false, data: err });

          } else {

            res.status(200).send({

              success: true,

              data: recordset

            }); 

          }

        }

      );

    } else {

      res

        .status(400)

        .send({ success: false, data: "please send id in params" });

    }

  } catch (e) {

    res.status(400).send({ success: false, data: e });

  }

});




//Post

app.post("/test2", async (req, res) => {

  try {

    let pool = await sql.connect(config);

    var request = new sql.Request(pool);

    request.input("uid", req.body.id);

    request.output("nor", "");

    request.output("result", "");

    let e = await request.execute(`temp_login`);

    res.status(200).send({

      success: true,

      data: e,

    });

  } catch (e) {

    console.log(e);

    res.status(400).send({ success: false, data: e });

  }

});

Tuesday, May 31, 2022

Check display status in javascript

        

<script>

var sbtn = document.getElementById("closebtn");

            

            if (sbtn.style.display == "none") {

                setTimeout(closeSuccess, 3000);

            } else {

                setTimeout(closeError, 3000);

            }


</script>

Friday, May 6, 2022

Modifiers Differences in c#

 







Private Modifier :- Private member can access its own/self class.

Protected Modifier :- 1. Protected member can access its own/self class, 2.  can access with inheritance in self project/assembly, 3. can access with inheritance in another project/assembly  

Internal Modifier :- 1. Internal member can access its own/self class, 2. can access with inheritance in self project/assembly, 3. can access with an instance/object in self project, 4.


Saturday, February 12, 2022

SQL Paging Procedures

 1. Create

create proc [dbo].[SP_UpgradenHistory_referId]  
@PageIndex   INT = 1,
@PageSize    INT = 100,
@refrebyId nvarchar(500)='',
@type nvarchar(max)='All',
@RecordCount INT=0 output
as
begin
   
        select
        row_number() over(order by t.edate desc) as RowNumber,
        t.*,cast(t.edate as date)as activationDate,p.plan_amount
        ,ju.f_name uid_name,isnull(jr.f_name,t.referby) ref_name
        into #result1
        from topupdetails t with(nolock)
        inner join plans p with(nolock) on p.id=t.package
        join joinnow ju with(nolock) on t.uid=ju.uid
        left join joinnow jr with(nolock) on convert(nvarchar(50),jr.uid)=t.referby
        where (t.uid=@refrebyId or t.referby=@refrebyId) and t.remark not in('Activate')
        order by t.edate desc

        select @RecordCount=count(1) from #result1

        SELECT * FROM   #result1 WHERE  rownumber BETWEEN( @PageIndex - 1 ) * @PageSize + 1 AND( (( @PageIndex - 1 ) * @PageSize + 1 ) +  @PageSize ) - 1 ORDER  BY rownumber ASC
       
        drop table #result1
   
end

2. Execute


declare @RecordCount INT=0
exec [SP_UpgradenHistory_referId] @RecordCount=@RecordCount output
print @RecordCount

3. Execute in C#

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

            _dt = _sf.returnDtBy_proc("GetCustomers_Pager", _param);
            //Int64 h =Convert.ToInt64( _param[6].Value.ToString());
            m1.totalCount = _param[8].Value.ToString();
            if (_dt.Rows.Count > 0)
            {
            }

Monday, February 7, 2022

Date Formate In Sql server


Change custom date format in  sql query in ms sql server 

 format(top_update,'dd/MMM/yyyy') as top_updates



Examples 

select row_number() over(order by joinnow.top_update desc ) as row, user_id,sponser_id,f_name,mobile,email,telephone,format(top_update,'dd/MMM/yyyy') as top_updates,

(select address+' , '+(select districtname from districts where districtid=joinnow.districtid)+', '+(select statename from state_master where stateid=joinnow.stateid)+', Pincode- '+pincode) as address,

(select plan_name from plans where id=joinnow.package) as package,convert(varchar,edate,103) as edate,remark,

(select products from products where id=joinnow.product_id) as products,format(product_status_date,'dd/MM/yyyy') pp,

(case product_status when 0 then 'Pending' when 1 then 'Delivered' when 2 then 'Cancel' end) as status,product_status

from joinnow where product_id is not null and product_status=0 and top_up=1 and product_id != 0 order by top_update desc

Saturday, February 5, 2022

MS Sql server

1. Execute output param in procedure in sql server 


declare @RecordCount int=1

exec [Getcustomers_pager] @topup='0',@RecordCount=@RecordCount output

print @RecordCount


2. Define out parametered in procedure in sql server


CREATE PROCEDURE [dbo].[Getcustomers_pager] @SearchTerm  VARCHAR(100) = '', 

@PageIndex   nvarchar(max) = 1, 

@PageSize    nvarchar(max) = 100,

@mobile      NVARCHAR(max)='', 

@search      INT=0,

@fromdate   nvarchar(max)='',

@todate      nvarchar(max)='',

@topup varchar(10)= '',

@RecordCount INT output 

AS 

BEGIN 

SET nocount ON; 


declare @query nvarchar(max)='',@query1 nvarchar(max)=''

set @query = 'select row_number() over(order by m.id desc) as RowNumber,

case m.status when 1 then ''Active'' else ''Block'' end as blockstatus,

case m.status when 1 then ''success'' else ''danger'' end as blockclass,

case m.status when 1 then ''Block'' else ''Active'' end as blockbtn,

case m.status when 1 then ''danger'' else ''success'' end as blockbtnclass,

format(m.edate,''dd/MM/yyyy'') as date,format(m.top_update,''dd/MM/yyyy'') as top_update1,

(select  max(remark) from cto_achievers where status=1 and uid=m.uid) rank_name,

m.*,l.password,l.trans_password

from Joinnow m with(nolock) inner join login l on m.uid=l.uid 

where l.block=0'


set @query1='select @count= count(m.id) from Joinnow m with(nolock) inner join login l on m.uid=l.uid where l.block=0'


IF(@topup != '')

BEGIN

set @query=@query+' and m.top_up='''+@topup+''''

set @query1=@query1+' and m.top_up='''+@topup+''''

END

ELSE IF(@SearchTerm !='')

BEGIN

set @query=@query+' and m.user_id='+@SearchTerm+' OR l.password ='''+@SearchTerm+''''

set @query1=@query1+' and m.user_id ='+@SearchTerm+' OR l.password='''+@SearchTerm+''''

END

 

ELSE IF(@fromdate !='' or @todate != '')

BEGIN

if(@fromdate != '')

begin

set @query=@query+' and cast(m.edate as date) >= cast('''+@fromdate+''' as date)'

set @query1=@query1+' and cast(m.edate as date) >= cast('''+@fromdate+''' as date)'

end

if(@todate != '')

begin

set @query=@query+' and cast(m.edate as date)<= cast('''+@todate+''' as date)'

set @query1=@query1+' and cast(m.edate as date)<= cast('''+@todate+''' as date)'

end 

END


set @query=@query+' order by m.id desc offset ('+@PageIndex+'-1)*'+@PageSize+' rows fetch next '+@PageSize+' rows only'

exec(@query)

exec sp_executesql @query1,N'@count int output',@count=@RecordCount output


END 





Angular Js Utility

1.  ng-init in Angular Js

@if (Request.QueryString["a"] != null)

{

           <input type="hidden" ng-init="p.user_type='@Request.QueryString["a"]'" />

}

                                        

2. ng-model

<input type="text" id="txtname" ng-model="p.name" class="form-control" placeholder="Enter User Address" maxlength="100" />


3.  ng-click

<input type="button" id="btnsearch" ng-click="getEmployeeList()" class="btn btn-sm btn-success" value="Search" />


4.  ng-change

<select class="form-control" ng-change="getEmployeeList()" ng-model="p.user_type" ng-init="p.user_type=''">

         <option value="">All</option>

         <option value="1">Paid</option>

         <option value="0">UnPaid</option>

</select>


5. Pass value in angular function 


 $scope.p = {};

        var status = null;


        $scope.getIncomeList = function () {

            $('.loader').show();

            if (status == null) {

                status = "2";

            }

            $http.get('/Admin/getReward_Income', $scope.p).then(function (res) {

                $('.loader').hide();

                $scope.getIncome = res.data.IncomeList;

            });

        };




Monday, January 10, 2022

All Capital

1.  All capital in jquery

<script>

$(function () {

        $("input[type='text']").keyup(function () {

            this.value = this.value.toUpperCase();

        });

    });

</script>

Thursday, January 6, 2022

Dependency Injection in .net core 5

There are three of dependency injection executer, we will she their life time cycle

1. Scoped  > It does not go to life time

2. Transient >  It does not go to life time

3. Singleton > It goes to life time




https://www.youtube.com/watch?v=0x2KW-dJDQU


https://www.youtube.com/watch?v=3nnESO6I3iE

 


Monday, January 3, 2022

Angular Get Post in MVC

Angular Js or 1 : Get Post Request

1. Model


public class admin_support_model
{
    public int? id { get; set; }
    public string name { get; set; }
    public string ed_code { get; set; }
    public string email { get; set; }
    public string phone { get; set; }
    public string remark { get; set; }

}
public class education
{
    public string ed_code { get; set; }
    public string ed_name { get; set; }
}
public class admin_news_letter_model
{
    public int? id { get; set; }
    public string email { get; set; }
    public Nullable<DateTime> edate { get; set; }
}

2. Views


@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>

    <script src="/Scripts2/jquery-3.3.1.min.js"></script>
    <script src="/Scripts2/angular.js"></script>
    <script src="/AngularCtrls/CommonFiles/myApp.js"></script>
</head>
<body  ng-app="MyApp">
    <script src="~/AngularCtrls/Admin/supportToAdminCtrl.js"></script>
    <div  ng-controller="supportToAdminCtrl">
        <form id="contact" ng-submit="af_SupportPost();" autocomplete="off">
            <div class="heading-title left">
                <small class="iq-font-green">Support With Us</small>
                <h2 class="title iq-tw-6">Support</h2>

            </div>
            <div class="contact-form">
                <div class="section-field">
                    <br />
                    <input class="require" id="cname" type="text" ng-model="p.name" placeholder="Name*" name="cname" required>
                </div>
                <div class="section-field">
                    Education
                    <select  id="ed_code" name="ed_code" ng-model="p.ed_code" required>
                        <option>
                        </option>
                        <option ng-repeat="m in educationList" value="{{m.ed_code}}" style="width:100px;">
                            {{m.ed_name}}
                        </option>
                        <input type="search" id="ed_name" ng-model="p.ed_name" ng-change="af_Education_List()" style="width:40px;"  />
                    </select>
                </div>
                <div class="section-field">
                    <input class="require" id="cemail" type="email" ng-model="p.email" placeholder="Email*" name="cemail" required>
                </div>
                <div class="section-field">
                    <input class="require" id="cphone" type="number" ng-model="p.phone" placeholder="Phone*" name="cphone" required>
                </div>
                <div class="section-field textarea">
                    <textarea id="cmessage" class="input-message require" ng-model="p.remark" placeholder="Comment*" rows="5" name="cmessage" required></textarea>
                </div>
                <div class="d-block text-center">
                    <button id="btnsupport" type="submit" value="Send" class="button iq-mt-15">Send Message</button>
                </div>
            </div>
        </form>


        <form id="contact" ng-submit="af_WeeklyNews()" autocomplete="off">
            <div class="heading-title text-center">
                <h2 class="title iq-tw-6" style="margin-bottom: 15px;">
                    Weekly newsletter
                </h2>
            </div>

            <div class="contact-form">
                <div class="row">
                    <div class="col-md-12">
                        <div class="section-field">
                            <input class="require" id="contact_email" type="email" ng-model="p.email" placeholder="Email*" name="contact_email" required>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-4">
                        <div class="d-block text-center">
                            <input id="Subscribesubmit" name="submit" type="submit" value="Subscribe" class="button" />
                        </div>
                    </div>
                </div>
            </div>            
        </form>
        <br />
        <table>
            <tr>
                <th>Srno</th>
                <th>Name</th>
                <th>Mobile</th>
                <th>Email</th>                
            </tr>
            <tr ng-repeat="m in supportList">                
                <td>{{m.id}}</td>
                <td>{{m.name}}</td>
                <td>{{m.phone}}</td>
                <td>{{m.email}}</td>                
            </tr>
        </table>

    </div>
</body>
</html>


    JsDownload Link

    https://drive.google.com/file/d/1cRFTMjag3x_fFTRPdPKoArRwDnzHo89z/view?usp=sharing

3. MVC Controller

public class HomeController : Controller
{
    // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        string sql = "";    
        public ActionResult WeeklyNews(admin_news_letter_model d)
        {
            msg msg = new msg() { message = "News Letter Success submitted.", priority = "success", title = "Message" };            
            return Json(new { msg = msg }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult SupportPost(admin_support_model d)
        {
            msg msg = new msg() { message = "Your Query Successfully submitted.", priority = "success", title = "Message" };            
            return Json(new { msg = msg }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult SupportList(admin_support_model d)
        {
            admin_support_model_mvv mvv = new admin_support_model_mvv();

            msg msg = new msg() { message = "Your Query Successfully submitted.", priority = "success", title = "Message" };
            mvv.msgs = msg;

            List<admin_support_model> list = new List<admin_support_model>();
            list.Add(new admin_support_model { id = 1, name = "Rinkesh Gola", phone = "789475897", email = "abc@gmail.com", remark = "aass" });
            list.Add(new admin_support_model { id = 2, name = "Ramesh Sing", phone = "7894712345", email = "abc2@gmail.com", remark = "aass" });
            list.Add(new admin_support_model { id = 3, name = "Ajay Saagar", phone = "789476789", email = "abc3@gmail.com", remark = "aass" });
            list.Add(new admin_support_model { id = 4, name = "Manoj AAAA", phone = "7894711111", email = "abc32@gmail.com", remark = "aass" });
            list.Add(new admin_support_model { id = 5, name = "Sanjay Sharma", phone = "7894744444", email = "abca@gmail.com", remark = "aass" });

            mvv.admin_support_models_list = list;

            return Json(new { modelData = mvv }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult ed_code_list(education d)
        {
            List<education> list = new List<education>();
            list.Add(new education { ed_code = "ED01", ed_name = "Illiterate " });
            list.Add(new education { ed_code = "ED02", ed_name = "Hight School" });
            list.Add(new education { ed_code = "ED03", ed_name = "Intermedeate" });
            list.Add(new education { ed_code = "ED03", ed_name = "Bachelor Degree" });
            list.Add(new education { ed_code = "ED05", ed_name = "Post Graduate" });

            var list2 = (from x in list
                         where (d.ed_name == null || x.ed_name.Contains(d.ed_name))
                         select x).ToList();

            return Json(new { list_data = list2 }, JsonRequestBehavior.AllowGet);
        }       

}


Sunday, January 2, 2022

Remote Validation in MVC

Remote Attributes is used in Remote Validation

1. Model : Remote Validating is used on emp_name, Rirst fill the appropriate Action Method and Error message in the Remote Attribute

public class Employee
{      
    [Key]
    public string emp_code { get; set; }
    [Remote("checkEmpName", "Home", ErrorMessage = "User name already exists")]
    public string emp_name { get; set; }
    public string emp_mobile { get; set; }
}

2. Controller : Pass  same property varibale name (emp_name) into Method checkEmpName


public class HomeController : Controller
{
    public ActionResult Create()
    {
        return View();
    }
    public JsonResult checkEmpName(string emp_name)
    {
        List<Employee> list = new List<Employee>();
        list.Add(new Employee { emp_code = "E001", emp_name = "Rinkesh", emp_mobile = "9027581975" });
        list.Add(new Employee { emp_code = "E002", emp_name = "Rakesh", emp_mobile = "9027581975" });
        list.Add(new Employee { emp_code = "E003", emp_name = "Ajay", emp_mobile = "9027581976" });

        bool st = (!list.Any(x => x.emp_name == emp_name));

        return Json(st, JsonRequestBehavior.AllowGet);
    }
}

3. View :  Required jquery is 

jquery-3.3.1.min.js, 

jquery.validate.min.js, 

jquery.validate.unobtrusive.min.js


@model Angular1Test.Models.Employee
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Create</title>
</head>
<body>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="row">
            <div class="col-md-3">
                @Html.LabelFor(model => model.emp_code, htmlAttributes: new { @class = "control-label" })
                @Html.EditorFor(model => model.emp_code, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.emp_code, "", new { @class = "text-danger" })
            </div>

            <div class="col-md-3">
                @Html.LabelFor(model => model.emp_name, htmlAttributes: new { @class = "control-label" })
                @Html.EditorFor(model => model.emp_name, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.emp_name, "", new { @class = "text-danger" })
            </div>
            <div class="col-md-3">
                @Html.LabelFor(model => model.emp_mobile, htmlAttributes: new { @class = "control-label" })
                @Html.EditorFor(model => model.emp_mobile, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.emp_mobile, "", new { @class = "text-danger" })
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <br>
                <input type="submit" value="Create" class="btn btn-default" />
                @Html.ActionLink("Back to List", "Index", new { }, new { @class = "btn btn-default" })
            </div>
        </div>
    }

    <div>
    </div>
</body>
</html>


A link to video

https://www.youtube.com/watch?v=DUej0Z8gDnA

Saturday, January 1, 2022

Edit Scaffold Templates for mvc

Edit Scaffold Templates for MVC  in Visual Studio 2019, for Create, Edit, Delete, List etc.

1. If you installer Visual Studio 2019 Enterprise Edition

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView


2. If you installer Visual Studio 2019 Professional Edition 

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView

Tuesday, December 28, 2021

How show console write line in asp.net in visual studio

1. We use Debug.WriteLine("sss") instead of Console.WtriteLite("aaa") 

    and it will show in Immediate Window

2. For active Immediate Window 

   Tools > Options > Debugging > General > Tick (Check) in  

    [] Redirect  All Output Window text to the Immediate Window

3. Debug uses 

using System.Diagnostics;

Friday, December 24, 2021

Stored Procedure with Sql Parameter in c#

using (SqlCommand cmd = new SqlCommand("sp_getrewardincome", con))
{
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter ad = new SqlDataAdapter(cmd);
    cmd.Parameters.AddWithValue("@id", id);
    cmd.Parameters.AddWithValue("@type", "update");
    dt = new DataTable();
    ad.Fill(dt);
   
}


using (SqlCommand cmd = new SqlCommand("sp_getrewardincome", con))
{
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter ad = new SqlDataAdapter(cmd);
    cmd.Parameters.AddWithValue("@id", id);                    
    cmd.Parameters.AddWithValue("@type", "update");
    //cmd.Parameters.Add("@result", SqlDbType.NVarChar, 3000);
    //SqlParameter ptr = cmd.Parameters["@result"];
    //ptr.Direction = ParameterDirection.Output;
    con.Open();
    cmd.ExecuteNonQuery();    
}

 

Convert 1.25x speed spent hours convert into normal (1x) speed spent hours

If I run a video with 1.25x or 125% speed till 1 hour 26 minuts, then normal hours will be ?   1 hours 26 minuts convert into hours Total 60...