Saturday, February 28, 2015


 How to Detect Caps Lock key is ON or OFF using jQuery  
 <html xmlns="http://www.w3.org/1999/xhtml">  
 <head>  
   <title></title>  
   <style type="text/css">  
     body  
     {  
       font-family: Arial;  
       font-size: 10pt;  
     }  
     #error  
     {  
       border: 1px solid #FFFF66;  
       background-color: #FFFFCC;  
       display: inline-block;  
       margin-left: 10px;  
       padding: 3px;  
       display: none;  
     }  
   </style>  
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
   <script type="text/javascript">  
     $(function () {  
       var isShiftPressed = false;  
       var isCapsOn = null;  
       $("#txtName").bind("keydown", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode == 16) {  
           isShiftPressed = true;  
         }  
       });  
       $("#txtName").bind("keyup", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode == 16) {  
           isShiftPressed = false;  
         }  
         if (keyCode == 20) {  
           if (isCapsOn == true) {  
             isCapsOn = false;  
             $("#error").hide();  
           } else if (isCapsOn == false) {  
             isCapsOn = true;  
             $("#error").show();  
           }  
         }  
       });  
       $("#txtName").bind("keypress", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode >= 65 && keyCode <= 90 && !isShiftPressed) {  
           isCapsOn = true;  
           $("#error").show();  
         } else {  
           $("#error").hide();  
         }  
       });  
     });  
   </script>  
 </head>  
 <body>  
   <form action="">  
   <input id="txtName" type="text" /><span id="error">Caps Lock is ON.</span>  
   </form>  
 </body>  
 </html>  
jquery

How to Detect Caps Lock key is ON or OFF using jQuery

Posted by Gnani Palepu  |  No comments


 How to Detect Caps Lock key is ON or OFF using jQuery  
 <html xmlns="http://www.w3.org/1999/xhtml">  
 <head>  
   <title></title>  
   <style type="text/css">  
     body  
     {  
       font-family: Arial;  
       font-size: 10pt;  
     }  
     #error  
     {  
       border: 1px solid #FFFF66;  
       background-color: #FFFFCC;  
       display: inline-block;  
       margin-left: 10px;  
       padding: 3px;  
       display: none;  
     }  
   </style>  
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
   <script type="text/javascript">  
     $(function () {  
       var isShiftPressed = false;  
       var isCapsOn = null;  
       $("#txtName").bind("keydown", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode == 16) {  
           isShiftPressed = true;  
         }  
       });  
       $("#txtName").bind("keyup", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode == 16) {  
           isShiftPressed = false;  
         }  
         if (keyCode == 20) {  
           if (isCapsOn == true) {  
             isCapsOn = false;  
             $("#error").hide();  
           } else if (isCapsOn == false) {  
             isCapsOn = true;  
             $("#error").show();  
           }  
         }  
       });  
       $("#txtName").bind("keypress", function (e) {  
         var keyCode = e.keyCode ? e.keyCode : e.which;  
         if (keyCode >= 65 && keyCode <= 90 && !isShiftPressed) {  
           isCapsOn = true;  
           $("#error").show();  
         } else {  
           $("#error").hide();  
         }  
       });  
     });  
   </script>  
 </head>  
 <body>  
   <form action="">  
   <input id="txtName" type="text" /><span id="error">Caps Lock is ON.</span>  
   </form>  
 </body>  
 </html>  

3:30 AM Share:

 How to Detect Caps Lock with JavaScript  
 <script language="Javascript">  
     function capLock(e) {  
       kc = e.keyCode ? e.keyCode : e.which;  
       sk = e.shiftKey ? e.shiftKey : ((kc == 16) ? true : false);  
       if (((kc >= 65 && kc <= 90) && !sk) || ((kc >= 97 && kc <= 122) && sk))  
         document.getElementById('divMayus').style.visibility = 'visible';  
       else  
         document.getElementById('divMayus').style.visibility = 'hidden';  
     }  
   </script>  
                 <div class="span12">  
                   <input type="password" placeholder="Password" name="Password" id="txtPassword" onkeypress="capLock(event)" title="Please enter password" required/>  
                   <div id="divMayus" style="visibility:hidden; float:left; margin-top: 0px; background-color:#3B5998; color:White;"><b>Caps Lock is on.</b></div>  
                 </div>  
jquery

How to Detect Caps Lock with JavaScript

Posted by Gnani Palepu  |  No comments


 How to Detect Caps Lock with JavaScript  
 <script language="Javascript">  
     function capLock(e) {  
       kc = e.keyCode ? e.keyCode : e.which;  
       sk = e.shiftKey ? e.shiftKey : ((kc == 16) ? true : false);  
       if (((kc >= 65 && kc <= 90) && !sk) || ((kc >= 97 && kc <= 122) && sk))  
         document.getElementById('divMayus').style.visibility = 'visible';  
       else  
         document.getElementById('divMayus').style.visibility = 'hidden';  
     }  
   </script>  
                 <div class="span12">  
                   <input type="password" placeholder="Password" name="Password" id="txtPassword" onkeypress="capLock(event)" title="Please enter password" required/>  
                   <div id="divMayus" style="visibility:hidden; float:left; margin-top: 0px; background-color:#3B5998; color:White;"><b>Caps Lock is on.</b></div>  
                 </div>  

3:27 AM Share:

Wednesday, February 18, 2015


 simple change password code in vb.net  
 -----------------------------------------  
 step 1  
 -------  
 html:  
     <div class="forgotb">  
       <a href="javascript:void(0)" onclick="checkusernameandpwd()">Change Password</a>  
     </div>  
     <div id="light" class="white_content" runat="server">  
       <div style="float: left; width: 100%;">  
         <a style="float: right;" href="javascript:void(0)" onclick="closepopup();">Close</a>  
         <table width="100%;">  
           <tr>  
             <td style="height: 45px; width: 30%;">  
               User Name  
             </td>  
             <td style="height: 45px; width: 30%;">  
               <asp:TextBox ID="txtUserCode" runat="server" placeholder="User Code" Style="width: 270px;" />  
             </td>  
             <td style="height: 45px; width: 40%;">  
               <asp:RequiredFieldValidator ID="UserNameRequired" ErrorMessage="User Name is Required" ForeColor="Red"  
                 ControlToValidate="txtUserCode" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               Current Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="txtCurrentPassword" runat="server" placeholder="Current Password"  
                 Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="CurrentPasswordRequired" ErrorMessage="Current Password is Required"  
                 ForeColor="Red" ControlToValidate="txtCurrentPassword" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               New Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="passwordTextBox" runat="server" placeholder="New Password" TextMode="Password"  
                 Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="passwordReq" ErrorMessage="New Password is required!"  
                 ForeColor="Red" ControlToValidate="passwordTextBox" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               Confirm Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="confirmPasswordTextBox" runat="server" placeholder="Confirm Password"  
                 TextMode="Password" Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="confirmPasswordReq" ErrorMessage="confirmation Password is required!"  
                 ForeColor="Red" ControlToValidate="confirmPasswordTextBox" runat="server" ValidationGroup="popupbtnval" />  
               <asp:CompareValidator ID="comparePasswords" ErrorMessage="Your passwords do not match up!"  
                 ForeColor="Red" ControlToCompare="passwordTextBox" ControlToValidate="confirmPasswordTextBox"  
                 runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 60px;" colspan="2" align="right">  
               <span style="float: left">  
                 <asp:Label runat="server" ID="lblSucessmsg"></asp:Label>  
               </span>  
               <asp:Button runat="server" ID="btnSubmit" Text="Submit" ValidationGroup="popupbtnval"  
                 Style="width: 100px;" />  
             </td>  
             <td>  
             </td>  
           </tr>  
         </table>  
       </div>  
     </div>  
     <div id="fade" class="black_overlay">  
     </div>  
 step 2:  
 --------------------  
  body  
    .black_overlay{  
      display: none;  
      position: absolute;  
      top: 0%;  
      left: 0%;  
      width: 75%;  
      height: 75%;  
      background-color: black;  
      z-index:1001;  
      -moz-opacity: 0.8;  
      opacity:.80;  
      filter: alpha(opacity=80);  
 }  
 .white_content {  
      display: none;  
      position: absolute;  
      top: 25%;  
      left: 25%;  
      width: 50%;  
      height: 50%;  
      padding: 16px;  
      border: 16px solid orange;  
      background-color: white;  
      z-index:1002;  
      overflow: auto;  
 }  
 step 3:  
 --------  
 <sccript type="text/javascript">  
     function closepopup() {  
       document.getElementById('light').style.display = 'none';  
       document.getElementById('fade').style.display = 'none';  
       document.getElementById("<%=txtUserCode.ClientID %>").value = '';  
       document.getElementById("<%=txtCurrentPassword.ClientID %>").value = '';  
       document.getElementById("<%=passwordTextBox.ClientID %>").value = '';  
       document.getElementById("<%=confirmPasswordTextBox.ClientID %>").value = '';  
       document.getElementById("<%=confirmPasswordReq.ClientID %>").innerHTML = '';  
       document.getElementById("<%=comparePasswords.ClientID %>").innerHTML = '';  
       document.getElementById("<%=lblSucessmsg.ClientID %>").innerHTML = '';  
       document.getElementById("<%=txtUserName.ClientID %>").value = '';  
       document.getElementById("<%=txtPassword.ClientID %>").value = '';  
     }  
     function checkusernameandpwd() {  
       if (document.getElementById("<%=txtUserName.ClientID %>").value == '') {  
         document.getElementById("<%=btnlogin.ClientID %>").click();  
       } else if (document.getElementById("<%=txtPassword.ClientID %>").value == '') {  
         document.getElementById("<%=btnlogin.ClientID %>").click();  
       } else {  
         document.getElementById("<%=txtUserCode.ClientID %>").value = document.getElementById("<%=txtUserName.ClientID %>").value;  
         document.getElementById("<%=txtCurrentPassword.ClientID %>").value = document.getElementById("<%=txtCurrentPassword.ClientID %>").value;  
         document.getElementById('light').style.display = 'block';  
         document.getElementById('fade').style.display = 'block';  
       }  
     }  
   </script>  
 stored procedure  
 ----------------  
 USE [SMIC]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_GET_USER_LOGIN_CHANGE_PWD]  Script Date: 02/16/2015 09:21:52 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author:     Gnani  
 -- Create date: 14/02/2015  
 -- Description:     Change password  
 -- =============================================  
 --EXEC USP_GET_USER_LOGIN_CHANGE_PWD 'gnani','gopal','gopal1',0  
 ALTER PROCEDURE [dbo].[USP_GET_USER_LOGIN_CHANGE_PWD]  
      @UserCode NVARCHAR(100),  
      @Password NVARCHAR(100),  
      @NewPassword NVARCHAR(100),  
      @ResponseCode INT OUTPUT  
 AS  
 BEGIN  
      DECLARE @UserID INT =0  
      SELECT @UserID =USERID FROM MSTUSER WHERE UserCode =@UserCode and PWD = REVERSE(@Password)  
      IF (@UserID >0 )   
            BEGIN  
                Update MSTUSER SET Pwd =REVERSE(@NewPassword) WHERE UserCode =@UserCode and PWD = REVERSE(@Password)  
                SET @ResponseCode = @UserID  
            END  
      ELSE  
           BEGIN  
                SET @ResponseCode =-999  
           END            
 END  
 code  
 ---------------  
 aspx.vb file  
 Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click  
     ClearMemory()  
     Dim connection = UserBO.GetConnectionFinalString("SMICL")  
     Dim loginRequest = New LoginRequest()  
     loginRequest.ChangeUserName = txtUserCode.Text.ToString()  
     loginRequest.Changepassword = txtCurrentPassword.Text.ToString()  
     loginRequest.ChangeNewpassword = passwordTextBox.Text.ToString()  
     loginRequest.Connection = connection  
     Dim resp = UserBO.UserLoginChangePwd(loginRequest)  
     If resp.Valid Then  
       Lblerr.Text = resp.Message  
       Lblerr.ForeColor = Drawing.Color.White  
       txtUserCode.Text = Nothing  
       txtCurrentPassword.Text = Nothing  
     Else  
       Lblerr.Text = resp.Message  
       Lblerr.ForeColor = Drawing.Color.Red  
       txtUserCode.Text = Nothing  
       txtCurrentPassword.Text = Nothing  
     End If  
   End Sub  
 Bo  
 ------  
 #Region "User Login UserLoginChangePwd"  
   Public Shared Function UserLoginChangePwd(ByVal request As LoginRequest) As LoginResponse  
     Dim response = New LoginResponse()  
     response = UserDAO.UserLoginChangePwd(request)  
     If response.ResponseCode > 0 Then  
       response.Valid = True  
       response.Message = "Password has been changed successfully."  
     Else  
       response.Valid = False  
       response.Message = "Login details not valid. please re-enter."  
     End If  
     Return response  
   End Function  
 #End Region  
 DAO  
 -------  
 #Region "User Login Change Pwd"  
   Public Shared Function UserLoginChangePwd(ByVal request As LoginRequest) As LoginResponse  
     Dim conString = Utility.Decrypt(request.Connection)  
     Dim response = New LoginResponse()  
     If conString IsNot Nothing Then  
       Dim connection As OleDbConnection = New OleDbConnection()  
       Dim paramOut As OleDbParameter = New OleDbParameter()  
       Dim da As New OleDbDataAdapter()  
       Dim dt As New DataTable()  
       connection.ConnectionString = conString  
       connection.Open()  
       Dim command = New OleDbCommand()  
       command.Connection = connection  
       command.CommandType = CommandType.StoredProcedure  
       command.CommandText = StoredProcedures.USP_GET_USER_LOGIN_CHANGE_PWD  
       command.Parameters.AddWithValue(DBParameters.UserCode, request.ChangeUserName)  
       command.Parameters.AddWithValue(DBParameters.Password, request.Changepassword)  
       command.Parameters.AddWithValue(DBParameters.NewPassword, request.ChangeNewpassword)  
       paramOut = command.Parameters.Add(DBParameters.ResponseCode, OleDbType.BigInt, 10)  
       paramOut.Direction = ParameterDirection.Output  
       command.ExecuteNonQuery()  
       response.ResponseCode = paramOut.Value  
       command.Dispose()  
       connection.Close()  
     End If  
     Return response  
   End Function  
 #End Region  
jquery

simple change password code in vb.net

Posted by Gnani Palepu  |  No comments


 simple change password code in vb.net  
 -----------------------------------------  
 step 1  
 -------  
 html:  
     <div class="forgotb">  
       <a href="javascript:void(0)" onclick="checkusernameandpwd()">Change Password</a>  
     </div>  
     <div id="light" class="white_content" runat="server">  
       <div style="float: left; width: 100%;">  
         <a style="float: right;" href="javascript:void(0)" onclick="closepopup();">Close</a>  
         <table width="100%;">  
           <tr>  
             <td style="height: 45px; width: 30%;">  
               User Name  
             </td>  
             <td style="height: 45px; width: 30%;">  
               <asp:TextBox ID="txtUserCode" runat="server" placeholder="User Code" Style="width: 270px;" />  
             </td>  
             <td style="height: 45px; width: 40%;">  
               <asp:RequiredFieldValidator ID="UserNameRequired" ErrorMessage="User Name is Required" ForeColor="Red"  
                 ControlToValidate="txtUserCode" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               Current Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="txtCurrentPassword" runat="server" placeholder="Current Password"  
                 Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="CurrentPasswordRequired" ErrorMessage="Current Password is Required"  
                 ForeColor="Red" ControlToValidate="txtCurrentPassword" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               New Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="passwordTextBox" runat="server" placeholder="New Password" TextMode="Password"  
                 Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="passwordReq" ErrorMessage="New Password is required!"  
                 ForeColor="Red" ControlToValidate="passwordTextBox" runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 45px;">  
               Confirm Password  
             </td>  
             <td style="height: 45px;">  
               <asp:TextBox ID="confirmPasswordTextBox" runat="server" placeholder="Confirm Password"  
                 TextMode="Password" Style="width: 270px;" />  
             </td>  
             <td>  
               <asp:RequiredFieldValidator ID="confirmPasswordReq" ErrorMessage="confirmation Password is required!"  
                 ForeColor="Red" ControlToValidate="confirmPasswordTextBox" runat="server" ValidationGroup="popupbtnval" />  
               <asp:CompareValidator ID="comparePasswords" ErrorMessage="Your passwords do not match up!"  
                 ForeColor="Red" ControlToCompare="passwordTextBox" ControlToValidate="confirmPasswordTextBox"  
                 runat="server" ValidationGroup="popupbtnval" />  
             </td>  
           </tr>  
           <tr>  
             <td style="height: 60px;" colspan="2" align="right">  
               <span style="float: left">  
                 <asp:Label runat="server" ID="lblSucessmsg"></asp:Label>  
               </span>  
               <asp:Button runat="server" ID="btnSubmit" Text="Submit" ValidationGroup="popupbtnval"  
                 Style="width: 100px;" />  
             </td>  
             <td>  
             </td>  
           </tr>  
         </table>  
       </div>  
     </div>  
     <div id="fade" class="black_overlay">  
     </div>  
 step 2:  
 --------------------  
  body  
    .black_overlay{  
      display: none;  
      position: absolute;  
      top: 0%;  
      left: 0%;  
      width: 75%;  
      height: 75%;  
      background-color: black;  
      z-index:1001;  
      -moz-opacity: 0.8;  
      opacity:.80;  
      filter: alpha(opacity=80);  
 }  
 .white_content {  
      display: none;  
      position: absolute;  
      top: 25%;  
      left: 25%;  
      width: 50%;  
      height: 50%;  
      padding: 16px;  
      border: 16px solid orange;  
      background-color: white;  
      z-index:1002;  
      overflow: auto;  
 }  
 step 3:  
 --------  
 <sccript type="text/javascript">  
     function closepopup() {  
       document.getElementById('light').style.display = 'none';  
       document.getElementById('fade').style.display = 'none';  
       document.getElementById("<%=txtUserCode.ClientID %>").value = '';  
       document.getElementById("<%=txtCurrentPassword.ClientID %>").value = '';  
       document.getElementById("<%=passwordTextBox.ClientID %>").value = '';  
       document.getElementById("<%=confirmPasswordTextBox.ClientID %>").value = '';  
       document.getElementById("<%=confirmPasswordReq.ClientID %>").innerHTML = '';  
       document.getElementById("<%=comparePasswords.ClientID %>").innerHTML = '';  
       document.getElementById("<%=lblSucessmsg.ClientID %>").innerHTML = '';  
       document.getElementById("<%=txtUserName.ClientID %>").value = '';  
       document.getElementById("<%=txtPassword.ClientID %>").value = '';  
     }  
     function checkusernameandpwd() {  
       if (document.getElementById("<%=txtUserName.ClientID %>").value == '') {  
         document.getElementById("<%=btnlogin.ClientID %>").click();  
       } else if (document.getElementById("<%=txtPassword.ClientID %>").value == '') {  
         document.getElementById("<%=btnlogin.ClientID %>").click();  
       } else {  
         document.getElementById("<%=txtUserCode.ClientID %>").value = document.getElementById("<%=txtUserName.ClientID %>").value;  
         document.getElementById("<%=txtCurrentPassword.ClientID %>").value = document.getElementById("<%=txtCurrentPassword.ClientID %>").value;  
         document.getElementById('light').style.display = 'block';  
         document.getElementById('fade').style.display = 'block';  
       }  
     }  
   </script>  
 stored procedure  
 ----------------  
 USE [SMIC]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_GET_USER_LOGIN_CHANGE_PWD]  Script Date: 02/16/2015 09:21:52 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author:     Gnani  
 -- Create date: 14/02/2015  
 -- Description:     Change password  
 -- =============================================  
 --EXEC USP_GET_USER_LOGIN_CHANGE_PWD 'gnani','gopal','gopal1',0  
 ALTER PROCEDURE [dbo].[USP_GET_USER_LOGIN_CHANGE_PWD]  
      @UserCode NVARCHAR(100),  
      @Password NVARCHAR(100),  
      @NewPassword NVARCHAR(100),  
      @ResponseCode INT OUTPUT  
 AS  
 BEGIN  
      DECLARE @UserID INT =0  
      SELECT @UserID =USERID FROM MSTUSER WHERE UserCode =@UserCode and PWD = REVERSE(@Password)  
      IF (@UserID >0 )   
            BEGIN  
                Update MSTUSER SET Pwd =REVERSE(@NewPassword) WHERE UserCode =@UserCode and PWD = REVERSE(@Password)  
                SET @ResponseCode = @UserID  
            END  
      ELSE  
           BEGIN  
                SET @ResponseCode =-999  
           END            
 END  
 code  
 ---------------  
 aspx.vb file  
 Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click  
     ClearMemory()  
     Dim connection = UserBO.GetConnectionFinalString("SMICL")  
     Dim loginRequest = New LoginRequest()  
     loginRequest.ChangeUserName = txtUserCode.Text.ToString()  
     loginRequest.Changepassword = txtCurrentPassword.Text.ToString()  
     loginRequest.ChangeNewpassword = passwordTextBox.Text.ToString()  
     loginRequest.Connection = connection  
     Dim resp = UserBO.UserLoginChangePwd(loginRequest)  
     If resp.Valid Then  
       Lblerr.Text = resp.Message  
       Lblerr.ForeColor = Drawing.Color.White  
       txtUserCode.Text = Nothing  
       txtCurrentPassword.Text = Nothing  
     Else  
       Lblerr.Text = resp.Message  
       Lblerr.ForeColor = Drawing.Color.Red  
       txtUserCode.Text = Nothing  
       txtCurrentPassword.Text = Nothing  
     End If  
   End Sub  
 Bo  
 ------  
 #Region "User Login UserLoginChangePwd"  
   Public Shared Function UserLoginChangePwd(ByVal request As LoginRequest) As LoginResponse  
     Dim response = New LoginResponse()  
     response = UserDAO.UserLoginChangePwd(request)  
     If response.ResponseCode > 0 Then  
       response.Valid = True  
       response.Message = "Password has been changed successfully."  
     Else  
       response.Valid = False  
       response.Message = "Login details not valid. please re-enter."  
     End If  
     Return response  
   End Function  
 #End Region  
 DAO  
 -------  
 #Region "User Login Change Pwd"  
   Public Shared Function UserLoginChangePwd(ByVal request As LoginRequest) As LoginResponse  
     Dim conString = Utility.Decrypt(request.Connection)  
     Dim response = New LoginResponse()  
     If conString IsNot Nothing Then  
       Dim connection As OleDbConnection = New OleDbConnection()  
       Dim paramOut As OleDbParameter = New OleDbParameter()  
       Dim da As New OleDbDataAdapter()  
       Dim dt As New DataTable()  
       connection.ConnectionString = conString  
       connection.Open()  
       Dim command = New OleDbCommand()  
       command.Connection = connection  
       command.CommandType = CommandType.StoredProcedure  
       command.CommandText = StoredProcedures.USP_GET_USER_LOGIN_CHANGE_PWD  
       command.Parameters.AddWithValue(DBParameters.UserCode, request.ChangeUserName)  
       command.Parameters.AddWithValue(DBParameters.Password, request.Changepassword)  
       command.Parameters.AddWithValue(DBParameters.NewPassword, request.ChangeNewpassword)  
       paramOut = command.Parameters.Add(DBParameters.ResponseCode, OleDbType.BigInt, 10)  
       paramOut.Direction = ParameterDirection.Output  
       command.ExecuteNonQuery()  
       response.ResponseCode = paramOut.Value  
       command.Dispose()  
       connection.Close()  
     End If  
     Return response  
   End Function  
 #End Region  

2:26 AM Share:

 How To Add A CheckBox Column to GridView in ASP.Net  
 ------------------------------------------------------  
 ready each and every line   
 for example we have a existing data gridview like ashow below  
 Let’s get started. We assume that we have a GridView with existing set of columns getting populated with some data. So, we have the below definition of GridView in our ASPX page.  
 existing data grid  
 ----------------------  
 <asp:gridview ID="grdData" runat="server" AutoGenerateColumns="False" CellPadding="4" CssClass="grdData"  
       ForeColor="#333333" GridLines="None" Width="200">  
       <alternatingrowstyle BackColor="White" ForeColor="#284775"></alternatingrowstyle>  
       <columns>  
         <asp:boundfield DataField="ID" HeaderText="ID"></asp:boundfield>  
         <asp:boundfield DataField="Name" HeaderText="Name"></asp:boundfield>  
       </columns>  
       <editrowstyle BackColor="#999999"></editrowstyle>  
       <footerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></footerstyle>  
       <headerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></headerstyle>  
       <pagerstyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"></pagerstyle>  
       <rowstyle BackColor="#F7F6F3" ForeColor="#333333"></rowstyle>  
       <selectedrowstyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></selectedrowstyle>  
       <sortedascendingcellstyle BackColor="#E9E7E2"></sortedascendingcellstyle>  
       <sortedascendingheaderstyle BackColor="#506C8C"></sortedascendingheaderstyle>  
       <sorteddescendingcellstyle BackColor="#FFFDF8"></sorteddescendingcellstyle>  
       <sorteddescendingheaderstyle BackColor="#6F8DAE"></sorteddescendingheaderstyle>  
 </asp:gridview>  
 And we have the below code to populate the GridView with some dummy data.  
     private void LoadGridData()  
     {  
       DataTable dt = new DataTable();  
       dt.Columns.Add("Id");  
       dt.Columns.Add("Name");  
       for (int i = 0; i < 10; i++)  
       {  
         DataRow dr = dt.NewRow();  
         dr["Id"] = i + 1;  
         dr["Name"] = "Student " + (i + 1);  
         dt.Rows.Add(dr);  
       }  
       grdData.DataSource = dt;  
       grdData.DataBind();  
     }  
 now  
 ------------------------------------------------  
 simple just add this  
 Now, we will be adding a CheckBox column to this Grid. For doing this, we will make use of TemplateField and define a new TemplateField column in the existing set of columns as below –  
   <asp:templatefield HeaderText="Select">  
     <itemtemplate>  
       <asp:checkbox ID="cbSelect" CssClass="gridCB" runat="server"></asp:checkbox>  
     </itemtemplate>  
   </asp:templatefield>  
 Your final GridView definition will appear like below –  
 --------------------------------------------------------  
 <asp:gridview ID="grdData" runat="server" AutoGenerateColumns="False" CellPadding="4" CssClass="grdData" ForeColor="#333333" GridLines="None" Width="200">  
       <alternatingrowstyle BackColor="White" ForeColor="#284775"></alternatingrowstyle>  
       <columns>  
         <asp:templatefield HeaderText="Select">  
           <itemtemplate>  
             <asp:checkbox ID="cbSelect" CssClass="gridCB" runat="server"></asp:checkbox>  
           </itemtemplate>  
         </asp:templatefield>  
         <asp:boundfield DataField="ID" HeaderText="ID"></asp:boundfield>  
         <asp:boundfield DataField="Name" HeaderText="Name"></asp:boundfield>  
       </columns>  
       <editrowstyle BackColor="#999999"></editrowstyle>  
       <footerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></footerstyle>  
       <headerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></headerstyle>  
       <pagerstyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"></pagerstyle>  
       <rowstyle BackColor="#F7F6F3" ForeColor="#333333"></rowstyle>  
       <selectedrowstyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></selectedrowstyle>  
       <sortedascendingcellstyle BackColor="#E9E7E2"></sortedascendingcellstyle>  
       <sortedascendingheaderstyle BackColor="#506C8C"></sortedascendingheaderstyle>  
       <sorteddescendingcellstyle BackColor="#FFFDF8"></sorteddescendingcellstyle>  
       <sorteddescendingheaderstyle BackColor="#6F8DAE"></sorteddescendingheaderstyle>  
 </asp:gridview>  
jquery

How To Add A CheckBox Column to GridView in ASP.Net

Posted by Gnani Palepu  |  No comments


 How To Add A CheckBox Column to GridView in ASP.Net  
 ------------------------------------------------------  
 ready each and every line   
 for example we have a existing data gridview like ashow below  
 Let’s get started. We assume that we have a GridView with existing set of columns getting populated with some data. So, we have the below definition of GridView in our ASPX page.  
 existing data grid  
 ----------------------  
 <asp:gridview ID="grdData" runat="server" AutoGenerateColumns="False" CellPadding="4" CssClass="grdData"  
       ForeColor="#333333" GridLines="None" Width="200">  
       <alternatingrowstyle BackColor="White" ForeColor="#284775"></alternatingrowstyle>  
       <columns>  
         <asp:boundfield DataField="ID" HeaderText="ID"></asp:boundfield>  
         <asp:boundfield DataField="Name" HeaderText="Name"></asp:boundfield>  
       </columns>  
       <editrowstyle BackColor="#999999"></editrowstyle>  
       <footerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></footerstyle>  
       <headerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></headerstyle>  
       <pagerstyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"></pagerstyle>  
       <rowstyle BackColor="#F7F6F3" ForeColor="#333333"></rowstyle>  
       <selectedrowstyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></selectedrowstyle>  
       <sortedascendingcellstyle BackColor="#E9E7E2"></sortedascendingcellstyle>  
       <sortedascendingheaderstyle BackColor="#506C8C"></sortedascendingheaderstyle>  
       <sorteddescendingcellstyle BackColor="#FFFDF8"></sorteddescendingcellstyle>  
       <sorteddescendingheaderstyle BackColor="#6F8DAE"></sorteddescendingheaderstyle>  
 </asp:gridview>  
 And we have the below code to populate the GridView with some dummy data.  
     private void LoadGridData()  
     {  
       DataTable dt = new DataTable();  
       dt.Columns.Add("Id");  
       dt.Columns.Add("Name");  
       for (int i = 0; i < 10; i++)  
       {  
         DataRow dr = dt.NewRow();  
         dr["Id"] = i + 1;  
         dr["Name"] = "Student " + (i + 1);  
         dt.Rows.Add(dr);  
       }  
       grdData.DataSource = dt;  
       grdData.DataBind();  
     }  
 now  
 ------------------------------------------------  
 simple just add this  
 Now, we will be adding a CheckBox column to this Grid. For doing this, we will make use of TemplateField and define a new TemplateField column in the existing set of columns as below –  
   <asp:templatefield HeaderText="Select">  
     <itemtemplate>  
       <asp:checkbox ID="cbSelect" CssClass="gridCB" runat="server"></asp:checkbox>  
     </itemtemplate>  
   </asp:templatefield>  
 Your final GridView definition will appear like below –  
 --------------------------------------------------------  
 <asp:gridview ID="grdData" runat="server" AutoGenerateColumns="False" CellPadding="4" CssClass="grdData" ForeColor="#333333" GridLines="None" Width="200">  
       <alternatingrowstyle BackColor="White" ForeColor="#284775"></alternatingrowstyle>  
       <columns>  
         <asp:templatefield HeaderText="Select">  
           <itemtemplate>  
             <asp:checkbox ID="cbSelect" CssClass="gridCB" runat="server"></asp:checkbox>  
           </itemtemplate>  
         </asp:templatefield>  
         <asp:boundfield DataField="ID" HeaderText="ID"></asp:boundfield>  
         <asp:boundfield DataField="Name" HeaderText="Name"></asp:boundfield>  
       </columns>  
       <editrowstyle BackColor="#999999"></editrowstyle>  
       <footerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></footerstyle>  
       <headerstyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></headerstyle>  
       <pagerstyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"></pagerstyle>  
       <rowstyle BackColor="#F7F6F3" ForeColor="#333333"></rowstyle>  
       <selectedrowstyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></selectedrowstyle>  
       <sortedascendingcellstyle BackColor="#E9E7E2"></sortedascendingcellstyle>  
       <sortedascendingheaderstyle BackColor="#506C8C"></sortedascendingheaderstyle>  
       <sorteddescendingcellstyle BackColor="#FFFDF8"></sorteddescendingcellstyle>  
       <sorteddescendingheaderstyle BackColor="#6F8DAE"></sorteddescendingheaderstyle>  
 </asp:gridview>  

2:25 AM Share:

 checkbox delete in gridview   
 --------------------------------  
 http://www.aspdotnet-suresh.com/2014/11/delete-gridview-rows-in-aspnet-using-checkbox-csharp-vbnet.html  
 http://www.codecomplete4u.com/delete-multiple-rows-gridview-using-checkbox-asp-net/  
 http://www.aspsnippets.com/Articles/Delete-multiple-rows-in-GridView-with-CheckBox-selection-and-with-confirmation-in-ASPNet.aspx  
 http://www.c-sharpcorner.com/UploadFile/1e050f/delete-records-from-gridview-using-checkbox-in-Asp-Net/  
 http://www.codeproject.com/Tips/405576/Deleting-Multiple-Rows-in-GridView-in-ASP-NET  
 http://www.itfunda.com/how-to-delete-multiple-selected-records-from-the-gridview/Free/149  
jquery

checkbox delete in gridview links

Posted by Gnani Palepu  |  No comments


 checkbox delete in gridview   
 --------------------------------  
 http://www.aspdotnet-suresh.com/2014/11/delete-gridview-rows-in-aspnet-using-checkbox-csharp-vbnet.html  
 http://www.codecomplete4u.com/delete-multiple-rows-gridview-using-checkbox-asp-net/  
 http://www.aspsnippets.com/Articles/Delete-multiple-rows-in-GridView-with-CheckBox-selection-and-with-confirmation-in-ASPNet.aspx  
 http://www.c-sharpcorner.com/UploadFile/1e050f/delete-records-from-gridview-using-checkbox-in-Asp-Net/  
 http://www.codeproject.com/Tips/405576/Deleting-Multiple-Rows-in-GridView-in-ASP-NET  
 http://www.itfunda.com/how-to-delete-multiple-selected-records-from-the-gridview/Free/149  

2:23 AM Share:

     save image in to data base and get image from database using jquery  
 -----------------------------------------------------------------     ----  
 here two thing   
 1). converting the image to binary and save into the databse  
 2). converting the binary data to the image for dispaly.  
 Step 1:  
 ---------  
 * i am writing the code for upload button in html  
 * give proper id and all.  
 Html:  
 ======  
 <div class="col-md-5 col-sm-5">  
                          <div class="form-group">  
                               <div class="upload-photo"><center>  
                                    <img src="../../Designing/images/defaultuserpic.png" class="img-responsive user uploadimageclass" />  
                                    </center><div class="uploda-text">  
                                         Home Image – Upload  
                                         <div class="_3jk">  
                 <input type="file" name="filUpload" class="_n _5f0v" id="HomeimagefilUpload" title="Choose a photo to upload" accept="image/*"  
                       tabindex="8" onchange="showimagepreview(this)" />  
                              <input style="color: Black" type="hidden" id="Homeimagefilenames" />  
                                         </div>  
                                    </div>  
                               </div>  
                          </div>  
                </div>  
 step 2:  
 ------  
 put in page load, if you want declare some sessions orther wise write normally.  
 if (Request.Files.Count > 0)  
       {  
         Session[CommonConstants.FILE] = Request.Files[0];  
         Response.Cookies["File"].Value = Request.Files[0].ToString();  
       }  
 step 3):  
 here i am writing the code. after uploading for preview.  
 //showimagepreview function starts here  
 function showimagepreview(sender) {  
   var validExts = new Array('.jpeg', '.jpg', '.gif', '.png');  
   var fileExt = sender.value;  
   fileExt = fileExt.substring(fileExt.lastIndexOf('.'));  
   if (validExts.indexOf(fileExt) < 0) {  
     alert("Invalid file selected, valid files are of " +  
             validExts.toString() + " types.");  
     $("#HomeimagefilUpload").val('');  
     $('.uploadimageclass').attr('src', '../../Designing/images/defaultuserpic.png');  
   } else {  
     callingpreviewimage(sender);  
     SaveImages();  
     $('#Homeimagefilenames').val(sender.value);  
   }  
 } // showimagepreview function end here  
 //callingpreviewimage function starts here  
 function callingpreviewimage(input) {  
   if (input.files && input.files[0]) {  
     var filerdr = new FileReader();  
     filerdr.onload = function (e) {  
       $('.uploadimageclass').attr('src', e.target.result)  
     }  
     filerdr.readAsDataURL(input.files[0]);  
   }  
 } // callingpreviewimage function ends here  
 //saveimages function starts here  
 function SaveImages() {  
   var formData = new FormData();  
   var file = document.getElementById("HomeimagefilUpload").files[0];  
   $('#Homeimagefilenames').val(file.name);  
   formData.append("file", file);  
   formData.append("filename", file.name);  
   formData.append("filesize", file.size);  
   formData.append("fiketype", file.type);  
   var uploadServerSideScriptPath = "UserMaster.aspx";  
   var xhr = new XMLHttpRequest();  
   xhr.open("POST", uploadServerSideScriptPath);  
   xhr.send(formData);  
 }  
 step 4:  
 ===========  
 in request   
       public Byte[] UserImg { get; set; }  
      public Int32 ImgType { get; set; }  
 step 5):  
 ==========  
 in aspx.cs  
 #region SaveGlobalSettings  
     /// <summary>  
     /// Save User Master  
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     ///   
     [System.Web.Script.Services.ScriptMethod, System.Web.Services.WebMethod]  
     public static GlobalSettingsResponse SaveGlobalSettingsValues(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       try  
       {  
         if (request.ImgType == 1)  
         {  
           HttpPostedFile file = (HttpPostedFile)HttpContext.Current.Session[CommonConstants.HOMEIMAGEFILE];  
           int filelenght = file.ContentLength;  
           Byte[] imagebytes = new Byte[filelenght];  
           file.InputStream.Read(imagebytes, 0, filelenght);  
           request.Homeimage = imagebytes;  
         }  
         response = BusinessFactory<UtilitiesBO>.Instance.SaveGlobalSettings(request);  
       }  
       catch (Exception ex)  
       {  
         ExceptionManager.HandleException(ex, request);  
         throw;  
       }  
       return response;  
     }  
     #endregion SaveGlobalSettings  
 Bo  
 =============:  
     #region Save Global Settings  
     public GlobalSettingsResponse SaveGlobalSettings(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       response = DataAccessFactory<UtilitiesDAO>.Instance.SaveGlobalSettings(request);  
       if (response.ResponseCode == 1)  
       {  
         response.IsValid = true;  
         response.ResponseMessage = Utilities.GetMessage("A02");  
       }  
       else  
       {  
         response.IsValid = false;  
         response.ResponseMessage = Utilities.GetMessage("A04");  
       }  
       return response;  
     }  
     #endregion Save Global Settings  
 DAO  
 ------  
     #region Save Global Settings  
     public GlobalSettingsResponse SaveGlobalSettings(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       Database db = DatabaseFactory.CreateDatabase(CommonConstants.CONNECTIONNAME);  
       using (DbCommand dbCommand = db.GetStoredProcCommand(StoredProcedures.spsaveGlobalSettings))  
       {  
         //db.AddInParameter(dbCommand, DBParameter.DocDesignerAppPath, DbType.String, request.DocDesignerAppPath);  
         //db.AddInParameter(dbCommand, DBParameter.Formatoutput, DbType.String, request.Formatoutput);  
         //db.AddInParameter(dbCommand, DBParameter.WhenFrmOpensNewBtn, DbType.String, request.WhenFrmOpensNewBtn);  
         //db.AddInParameter(dbCommand, DBParameter.DefaultNewMode, DbType.String, request.DefaultNewMode);  
         //db.AddInParameter(dbCommand, DBParameter.MarqueeMsg, DbType.String, request.MarqueeMsg);  
         db.AddInParameter(dbCommand, DBParameter.Homeimage, DbType.Binary, request.Homeimage);  
         db.AddInParameter(dbCommand, DBParameter.ImgType, DbType.Int32, request.ImgType);  
         db.AddOutParameter(dbCommand, DBParameter.ResponseCode, DbType.Int32, 20);  
         db.ExecuteNonQuery(dbCommand);  
         response.ResponseCode = Convert.ToInt32(db.GetParameterValue(dbCommand, DBParameter.ResponseCode));  
       }  
       return response;  
     }  
     #endregion Save Global Settings  
 sp  
 ===== change your table names and id  
 for insertion  
 USE [EFACTIC_DEV]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_ADD_USER_NEW_RIGHTS]  Script Date: 02/13/2015 14:23:37 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author:          gopal  
 -- Create date: 02/12/2014  
 -- Description:     save user rights  
 -- =============================================  
 ALTER PROCEDURE [dbo].[USP_ADD_USER_NEW_RIGHTS]  
      @UserImg          VARBINARY(MAX)          =     NULL  
      ,@ResponseCode     BIGINT                    OUTPUT  
 AS  
 BEGIN  
      BEGIN TRY  
                INSERT     INTO MstUser (UserImage)   
                               VALUES     (@UserImg)  
                SET @ResponseCode=IDENT_CURRENT('MstUser')  
      END TRY  
      BEGIN CATCH  
           SET @ResponseCode=-999  
      END CATCH            
 END  
storedprocedures

save image in to data base and get image from database using jquery

Posted by Gnani Palepu  |  No comments


     save image in to data base and get image from database using jquery  
 -----------------------------------------------------------------     ----  
 here two thing   
 1). converting the image to binary and save into the databse  
 2). converting the binary data to the image for dispaly.  
 Step 1:  
 ---------  
 * i am writing the code for upload button in html  
 * give proper id and all.  
 Html:  
 ======  
 <div class="col-md-5 col-sm-5">  
                          <div class="form-group">  
                               <div class="upload-photo"><center>  
                                    <img src="../../Designing/images/defaultuserpic.png" class="img-responsive user uploadimageclass" />  
                                    </center><div class="uploda-text">  
                                         Home Image – Upload  
                                         <div class="_3jk">  
                 <input type="file" name="filUpload" class="_n _5f0v" id="HomeimagefilUpload" title="Choose a photo to upload" accept="image/*"  
                       tabindex="8" onchange="showimagepreview(this)" />  
                              <input style="color: Black" type="hidden" id="Homeimagefilenames" />  
                                         </div>  
                                    </div>  
                               </div>  
                          </div>  
                </div>  
 step 2:  
 ------  
 put in page load, if you want declare some sessions orther wise write normally.  
 if (Request.Files.Count > 0)  
       {  
         Session[CommonConstants.FILE] = Request.Files[0];  
         Response.Cookies["File"].Value = Request.Files[0].ToString();  
       }  
 step 3):  
 here i am writing the code. after uploading for preview.  
 //showimagepreview function starts here  
 function showimagepreview(sender) {  
   var validExts = new Array('.jpeg', '.jpg', '.gif', '.png');  
   var fileExt = sender.value;  
   fileExt = fileExt.substring(fileExt.lastIndexOf('.'));  
   if (validExts.indexOf(fileExt) < 0) {  
     alert("Invalid file selected, valid files are of " +  
             validExts.toString() + " types.");  
     $("#HomeimagefilUpload").val('');  
     $('.uploadimageclass').attr('src', '../../Designing/images/defaultuserpic.png');  
   } else {  
     callingpreviewimage(sender);  
     SaveImages();  
     $('#Homeimagefilenames').val(sender.value);  
   }  
 } // showimagepreview function end here  
 //callingpreviewimage function starts here  
 function callingpreviewimage(input) {  
   if (input.files && input.files[0]) {  
     var filerdr = new FileReader();  
     filerdr.onload = function (e) {  
       $('.uploadimageclass').attr('src', e.target.result)  
     }  
     filerdr.readAsDataURL(input.files[0]);  
   }  
 } // callingpreviewimage function ends here  
 //saveimages function starts here  
 function SaveImages() {  
   var formData = new FormData();  
   var file = document.getElementById("HomeimagefilUpload").files[0];  
   $('#Homeimagefilenames').val(file.name);  
   formData.append("file", file);  
   formData.append("filename", file.name);  
   formData.append("filesize", file.size);  
   formData.append("fiketype", file.type);  
   var uploadServerSideScriptPath = "UserMaster.aspx";  
   var xhr = new XMLHttpRequest();  
   xhr.open("POST", uploadServerSideScriptPath);  
   xhr.send(formData);  
 }  
 step 4:  
 ===========  
 in request   
       public Byte[] UserImg { get; set; }  
      public Int32 ImgType { get; set; }  
 step 5):  
 ==========  
 in aspx.cs  
 #region SaveGlobalSettings  
     /// <summary>  
     /// Save User Master  
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     ///   
     [System.Web.Script.Services.ScriptMethod, System.Web.Services.WebMethod]  
     public static GlobalSettingsResponse SaveGlobalSettingsValues(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       try  
       {  
         if (request.ImgType == 1)  
         {  
           HttpPostedFile file = (HttpPostedFile)HttpContext.Current.Session[CommonConstants.HOMEIMAGEFILE];  
           int filelenght = file.ContentLength;  
           Byte[] imagebytes = new Byte[filelenght];  
           file.InputStream.Read(imagebytes, 0, filelenght);  
           request.Homeimage = imagebytes;  
         }  
         response = BusinessFactory<UtilitiesBO>.Instance.SaveGlobalSettings(request);  
       }  
       catch (Exception ex)  
       {  
         ExceptionManager.HandleException(ex, request);  
         throw;  
       }  
       return response;  
     }  
     #endregion SaveGlobalSettings  
 Bo  
 =============:  
     #region Save Global Settings  
     public GlobalSettingsResponse SaveGlobalSettings(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       response = DataAccessFactory<UtilitiesDAO>.Instance.SaveGlobalSettings(request);  
       if (response.ResponseCode == 1)  
       {  
         response.IsValid = true;  
         response.ResponseMessage = Utilities.GetMessage("A02");  
       }  
       else  
       {  
         response.IsValid = false;  
         response.ResponseMessage = Utilities.GetMessage("A04");  
       }  
       return response;  
     }  
     #endregion Save Global Settings  
 DAO  
 ------  
     #region Save Global Settings  
     public GlobalSettingsResponse SaveGlobalSettings(GlobalSettingsRequest request)  
     {  
       var response = new GlobalSettingsResponse();  
       Database db = DatabaseFactory.CreateDatabase(CommonConstants.CONNECTIONNAME);  
       using (DbCommand dbCommand = db.GetStoredProcCommand(StoredProcedures.spsaveGlobalSettings))  
       {  
         //db.AddInParameter(dbCommand, DBParameter.DocDesignerAppPath, DbType.String, request.DocDesignerAppPath);  
         //db.AddInParameter(dbCommand, DBParameter.Formatoutput, DbType.String, request.Formatoutput);  
         //db.AddInParameter(dbCommand, DBParameter.WhenFrmOpensNewBtn, DbType.String, request.WhenFrmOpensNewBtn);  
         //db.AddInParameter(dbCommand, DBParameter.DefaultNewMode, DbType.String, request.DefaultNewMode);  
         //db.AddInParameter(dbCommand, DBParameter.MarqueeMsg, DbType.String, request.MarqueeMsg);  
         db.AddInParameter(dbCommand, DBParameter.Homeimage, DbType.Binary, request.Homeimage);  
         db.AddInParameter(dbCommand, DBParameter.ImgType, DbType.Int32, request.ImgType);  
         db.AddOutParameter(dbCommand, DBParameter.ResponseCode, DbType.Int32, 20);  
         db.ExecuteNonQuery(dbCommand);  
         response.ResponseCode = Convert.ToInt32(db.GetParameterValue(dbCommand, DBParameter.ResponseCode));  
       }  
       return response;  
     }  
     #endregion Save Global Settings  
 sp  
 ===== change your table names and id  
 for insertion  
 USE [EFACTIC_DEV]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_ADD_USER_NEW_RIGHTS]  Script Date: 02/13/2015 14:23:37 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author:          gopal  
 -- Create date: 02/12/2014  
 -- Description:     save user rights  
 -- =============================================  
 ALTER PROCEDURE [dbo].[USP_ADD_USER_NEW_RIGHTS]  
      @UserImg          VARBINARY(MAX)          =     NULL  
      ,@ResponseCode     BIGINT                    OUTPUT  
 AS  
 BEGIN  
      BEGIN TRY  
                INSERT     INTO MstUser (UserImage)   
                               VALUES     (@UserImg)  
                SET @ResponseCode=IDENT_CURRENT('MstUser')  
      END TRY  
      BEGIN CATCH  
           SET @ResponseCode=-999  
      END CATCH            
 END  

2:21 AM Share:

 how to add,edit,delete in popup using jquery and webservices and jquery  
 ------------------------------------------------------------------------  
 step 1:  
 ========  
 /*Ready document for dashboard start*/  
 $(document).ready(function () {  
   modelforCustomermasterpopupContactbtnControls();  
 });  
 /*Ready document for dashboard end*/  
 step 2:  
 ========  
 function modelforCustomermasterpopupContactbtnControls() {  
   $('#popupbtnContactsSave).click(function () {  
     switch ($(this)[0].id) {  
       case "popupbtnContactsSave":  
         if ($("#frmContacts").valid()) {  
           var argType = parseInt($('#hdfContsctType').html()) == 1 ? 1 : 3;  
           SaveContactsAddEditDeleteAddress(argType);  
         }  
         break;  
       default:  
         break;  
     }  
   });  
 }  
 step 3:  
 =========  
 /*SaveContactsAddEditDeleteAddress funtion starts here*/  
 function SaveContactsAddEditDeleteAddress(argtype) {  
   var request = {};  
   request.Type = parseInt(argtype);  
   request.ContactID = $('#hdfContactID').html() == '' ? 0 : parseInt($('#hdfContactID').html());  
   request.PartyID = parseInt($('#hdfPartyID').html());  
   request.Name = $("#txtName").val();  
   request.MobileNo = $("#txtMobileNo").val();  
   request.Department = $("#txtDepartment").val();  
   request.Desig = $("#txtDesignation").val();  
   request.EmailID = $("#txtEmailId").val();  
   request.Description = $("#txtDescription").val();  
   $.ajax({  
     type: Http_Post,  
     url: WebNav_AddEditDeleteSupplierContcts,  
     contentType: "application/json; charset=utf-8",  
     dataType: "json",  
     data: '{request: ' + JSON.stringify(request) + '}',  
     success: onCustContactsSuccess,  
     error: onCustomersInfoError  
   });  
 }  
 /* onSaveSuccess function starts here*/  
 function onCustContactsSuccess(response) {  
   switch (response.d.IsValid) {  
     case true:  
       bindPartyContacts(response.d.PartyID);  
        alert("sucess");  
       break;  
     default:  
       break;  
   }  
 }  
 /* onSaveSuccess function end here*/  
 webnvavigation  
 ---------------  
 var WebNav_AddEditDeleteSupplierContcts = "/Services/Masters/SupplierInfo.asmx/AddEditDeleteSupplierContcts"; /*contacts Supplier Master web navigation link By Chandra*/  
 webservices  
 -------------  
 #region Add edit Delete Party Contcts  
     /// <summary>  
     /// To Save Multi Address  
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     [System.Web.Script.Services.ScriptMethod, System.Web.Services.WebMethod]  
     public PartyContctsResponse AddEditDeleteSupplierContcts(PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       try  
       {  
         response = BusinessFactory<MastersBO>.Instance.AddEditDeletePartyContcts(request);  
       }  
       catch (Exception ex)  
       {  
         ExceptionManager.HandleException(ex, request);  
         throw;  
       }  
       return response;  
     }  
     #endregion Add edit Delete Party Contcts  
 BO  
 ----  
 here you can change based on your stored procedures and response code.  
 #region Add edit Delete Party Contcts  
     /// <summary>  
     /// Add edit Delete Party Contcts   
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     public PartyContctsResponse AddEditDeletePartyContcts(PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       response = DataAccessFactory<MastersDAO>.Instance.AddEditDeletePartyContcts(request);  
       switch (response.ResponseCode)  
       {  
         case -999:  
           response.IsValid = false;  
           response.ResponseMessage = Utilities.GetMessage("A04");  
           break;  
         case 1:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A37");  
           break;  
         case 2:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A38");  
           break;  
         case 3:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A39");  
           break;  
         case 4:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A40");  
           break;  
         case 5:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A41");  
           break;  
         case 6:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A42");  
           break;  
       }  
       return response;  
     }  
     #endregion Add SupplierMaster Contacts  
 DAO  
 -------  
 #region Add edit Delete Party Contcts   
     /// <summary>  
     /// Add edit Delete Party Contcts   
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     public PartyContctsResponse AddEditDeletePartyContcts (PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       Database db = DatabaseFactory.CreateDatabase(CommonConstants.CONNECTIONNAME);  
       using (DbCommand dbCommand = db.GetStoredProcCommand(StoredProcedures.spAddEditDeleteCustSuppMasterContacts))  
       {  
         db.AddInParameter(dbCommand, DBParameter.ContactID, DbType.Int32, request.ContactID);  
         db.AddInParameter(dbCommand, DBParameter.PartyID, DbType.Int32, request.PartyID);  
         db.AddInParameter(dbCommand, DBParameter.Type, DbType.Int32, request.Type);  
         db.AddInParameter(dbCommand, DBParameter.Name, DbType.String, request.Name);  
         db.AddInParameter(dbCommand, DBParameter.MobileNo, DbType.String, request.MobileNo);  
         db.AddInParameter(dbCommand, DBParameter.Department, DbType.String, request.Department);  
         db.AddInParameter(dbCommand, DBParameter.Desig, DbType.String, request.Desig);  
         db.AddInParameter(dbCommand, DBParameter.EmailID, DbType.String, request.EmailID);  
         db.AddInParameter(dbCommand, DBParameter.Description, DbType.String, request.Description);  
         db.AddOutParameter(dbCommand, DBParameter.ResponseCode, DbType.Int32, 20);  
         db.ExecuteNonQuery(dbCommand);  
         response.ResponseCode = Convert.ToInt32(db.GetParameterValue(dbCommand, DBParameter.ResponseCode));  
         response.PartyID = request.PartyID;  
       }  
       return response;  
     }  
     #endregion Add SupplierMaster Contacts  
 popup div  
 -----------  
 <div class="modal" id="PrtyContacts-widget" role="dialog" aria-labelledby="myModalLabel"  
     aria-hidden="true">  
     <div class="modal-dialog modelAddressbox">  
       <div class="modal-content">  
         <div class="modal-header">  
           <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="Contactscrossbtn">  
             <span aria-hidden="true">&times;</span></button>  
           <h4 class="modal-title" id="H7">  
             Supplier Contacts</h4>  
         </div>  
         <div class="modal-body">  
           <div class="row">  
             <div class="col-md-12 com-sm-12">  
               <form id="frmContacts">  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Name">  
                     <span class="colorred">*</span> Name</label>  
                   <input type="text" class="form-control input-sm" id="txtName" placeholder="Name"  
                     name="Name" required maxlength="30" />  
                   <input type="hidden" id="hdfContactID" />  
                   <input type="hidden" id="hdfPartyID" />  
                   <input type="hidden" id="hdfContsctType" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="MobileNo">  
                     <span class="colorred">*</span> Mobile No</label>  
                   <input type="text" class="form-control input-sm" placeholder="Mobile No" name="MobileNo"  
                     id="txtMobileNo" required maxlength="50" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Designation">  
                     Designation</label>  
                   <input type="text" class="form-control input-sm" placeholder="Designation" name="Designation"  
                     id="txtDesignation" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Department">  
                     Department</label>  
                   <input type="text" class="form-control input-sm" placeholder="Department" name="Department"  
                     id="txtDepartment" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="EmailId">  
                     EmailId</label>  
                   <input type="text" class="form-control input-sm" placeholder="EmailId" name="EmailId"  
                     id="txtEmailId" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Description">  
                     Description</label>  
                   <input type="text" class="form-control input-sm" placeholder="Description" name="Description"  
                     id="txtDescription" />  
                 </div>  
               </div>  
               <div class="col-md-4 col-sm-4">  
                 <div class="form-group">  
                   <div class="upload-photo">  
                     <img src="../../Designing/images/defaultuserpic.png" class="img-responsive user">  
                     <div class="uploda-text">  
                       Upload picture  
                       <div class="_3jk">  
                         <input type="file" class="_n _5f0v" title="Choose a file to upload" accept="image/<b>*</b>"  
                           name="file" id="fileAttachments">  
                       </div>  
                     </div>  
                   </div>  
                 </div>  
               </div>  
               </form>  
             </div>  
           </div>  
         </div>  
         <div class="modal-footer">  
           <button class="btn btn-default btn-primary" type="button" id="popupbtnContactsSave"  
             title="Save">  
             Save</button>  
           <button class="btn btn-default" type="button" id="popupbtnContactsDelete" title="Delete">  
             Delete</button>  
           <button class="btn btn-default" type="button" id="popupbtnContactsClose" title="Close"  
             style="display: none">  
             Close</button>  
         </div>  
       </div>  
     </div>  
   </div>  
 storeprocedes  
 -------------  
 USE [EFACTIC_DEV]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_ADD_EDIT_DELETE_PARTY_CONTACTS]  Script Date: 01/22/2015 13:16:45 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author     :          GNANI .P  
 -- Create date     :          19/01/2015  
 -- Description     :          FOR SUPPLIER AND CUSTOMER CONTACTS  
 -- =============================================  
 ALTER PROCEDURE [dbo].[USP_ADD_EDIT_DELETE_PARTY_CONTACTS]  
       @ContactID               INT  
      ,@PartyID               INT                      
      ,@Name                    NVARCHAR(75)     =NULL       
      ,@MobileNo               NVARCHAR(100)     =NULL  
      ,@Department          NVARCHAR(100)     =NULL  
      ,@Desig                    VARCHAR(50)          =NULL  
      ,@EmailID               NVARCHAR(50)     =NULL  
      ,@Description          NVARCHAR(250)     =NULL  
      ,@TYPE                    INT                    =NULL  
      ,@ResponseCode          BIGINT               OUTPUT       
 AS  
 BEGIN  
      BEGIN TRY  
           IF @Type = 1     --ADD CUST MASTER CONTACTS.  
           BEGIN                 
                INSERT INTO dbo.MstCustContacts(CustID,Name,MobileNo,Department,Desig,EmailID,[Description]) VALUES (@PartyID,@Name,@MobileNo,@Department,@Desig,@EmailID,@Description)  
                SET @ResponseCode=1     --ADD SUCCESS FOR CUSTOMER MASTER.  
           END                 
           IF @Type = 2     --ADD SUPP MASTER CONTACTS.  
           BEGIN  
                INSERT INTO dbo.MstSuppContacts(SuppID,Name,MobileNo,Department,Desig,EmailID,[Description]) VALUES (@PartyID,@Name,@MobileNo,@Department,@Desig,@EmailID,@Description)  
                SET @ResponseCode=2     --ADD SUCCESS FOR SUPPLIER MASTER.  
           END                 
           IF @Type = 3     --EDIT CUST MASTER CONTACTS.  
           BEGIN  
                UPDATE dbo.MstCustContacts SET  Name               =     @Name  
                                                        ,MobileNo          =     @MobileNo  
                                                        ,Desig               =     @Desig  
                                                        ,Department          =     @Department  
                                                        ,EmailID          =     @EmailID  
                                                        ,[Description]     =     @Description  
                                                        WHERE CustID     =     @PartyID AND ContactID=@ContactID  
                SET @ResponseCode=3     --EDIT SUCCESS FOR CUSTOMER MASTER.  
           END       
           IF @Type = 4     --EDIT SUPP MASTER CONTACTS.  
           BEGIN  
                UPDATE dbo.MstSuppContacts SET  Name               =     @Name  
                                                        ,MobileNo          =     @MobileNo  
                                                        ,Desig               =     @Desig  
                                                        ,Department          =     @Department  
                                                        ,EmailID          =     @EmailID  
                                                        ,[Description]     =     @Description  
                                                        WHERE SuppID     =     @PartyID AND ContactID=@ContactID  
                SET @ResponseCode=4     --DELETE SUCCESS FOR SUPPLIER MASTER.  
           END  
           IF @Type = 5     --DELETE CUST MASTER CONTACTS.  
           BEGIN  
                DELETE dbo.MstCustContacts WHERE CustID     =     @PartyID      AND ContactID=@ContactID  
                SET @ResponseCode=5     --EDIT SUCCESS FOR CUSTOMER MASTER.  
           END       
           IF @Type = 6     --DELETE SUPP MASTER CONTACTS.  
           BEGIN  
                DELETE dbo.MstSuppContacts WHERE SuppID     =     @PartyID      AND ContactID=@ContactID  
                SET @ResponseCode=6     --DELETE SUCCESS FOR SUPPLIER MASTER.  
           END  
      END TRY  
      BEGIN CATCH  
           SELECT ERROR_MESSAGE()   
           SELECT ERROR_LINE ( )  
           SET @ResponseCode =-999     --OOPS SOMETHING WENT WRONG.  
      END CATCH       
 END  

how to add,edit,delete in popup using jquery and webservices and jquery

Posted by Gnani Palepu  |  No comments


 how to add,edit,delete in popup using jquery and webservices and jquery  
 ------------------------------------------------------------------------  
 step 1:  
 ========  
 /*Ready document for dashboard start*/  
 $(document).ready(function () {  
   modelforCustomermasterpopupContactbtnControls();  
 });  
 /*Ready document for dashboard end*/  
 step 2:  
 ========  
 function modelforCustomermasterpopupContactbtnControls() {  
   $('#popupbtnContactsSave).click(function () {  
     switch ($(this)[0].id) {  
       case "popupbtnContactsSave":  
         if ($("#frmContacts").valid()) {  
           var argType = parseInt($('#hdfContsctType').html()) == 1 ? 1 : 3;  
           SaveContactsAddEditDeleteAddress(argType);  
         }  
         break;  
       default:  
         break;  
     }  
   });  
 }  
 step 3:  
 =========  
 /*SaveContactsAddEditDeleteAddress funtion starts here*/  
 function SaveContactsAddEditDeleteAddress(argtype) {  
   var request = {};  
   request.Type = parseInt(argtype);  
   request.ContactID = $('#hdfContactID').html() == '' ? 0 : parseInt($('#hdfContactID').html());  
   request.PartyID = parseInt($('#hdfPartyID').html());  
   request.Name = $("#txtName").val();  
   request.MobileNo = $("#txtMobileNo").val();  
   request.Department = $("#txtDepartment").val();  
   request.Desig = $("#txtDesignation").val();  
   request.EmailID = $("#txtEmailId").val();  
   request.Description = $("#txtDescription").val();  
   $.ajax({  
     type: Http_Post,  
     url: WebNav_AddEditDeleteSupplierContcts,  
     contentType: "application/json; charset=utf-8",  
     dataType: "json",  
     data: '{request: ' + JSON.stringify(request) + '}',  
     success: onCustContactsSuccess,  
     error: onCustomersInfoError  
   });  
 }  
 /* onSaveSuccess function starts here*/  
 function onCustContactsSuccess(response) {  
   switch (response.d.IsValid) {  
     case true:  
       bindPartyContacts(response.d.PartyID);  
        alert("sucess");  
       break;  
     default:  
       break;  
   }  
 }  
 /* onSaveSuccess function end here*/  
 webnvavigation  
 ---------------  
 var WebNav_AddEditDeleteSupplierContcts = "/Services/Masters/SupplierInfo.asmx/AddEditDeleteSupplierContcts"; /*contacts Supplier Master web navigation link By Chandra*/  
 webservices  
 -------------  
 #region Add edit Delete Party Contcts  
     /// <summary>  
     /// To Save Multi Address  
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     [System.Web.Script.Services.ScriptMethod, System.Web.Services.WebMethod]  
     public PartyContctsResponse AddEditDeleteSupplierContcts(PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       try  
       {  
         response = BusinessFactory<MastersBO>.Instance.AddEditDeletePartyContcts(request);  
       }  
       catch (Exception ex)  
       {  
         ExceptionManager.HandleException(ex, request);  
         throw;  
       }  
       return response;  
     }  
     #endregion Add edit Delete Party Contcts  
 BO  
 ----  
 here you can change based on your stored procedures and response code.  
 #region Add edit Delete Party Contcts  
     /// <summary>  
     /// Add edit Delete Party Contcts   
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     public PartyContctsResponse AddEditDeletePartyContcts(PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       response = DataAccessFactory<MastersDAO>.Instance.AddEditDeletePartyContcts(request);  
       switch (response.ResponseCode)  
       {  
         case -999:  
           response.IsValid = false;  
           response.ResponseMessage = Utilities.GetMessage("A04");  
           break;  
         case 1:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A37");  
           break;  
         case 2:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A38");  
           break;  
         case 3:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A39");  
           break;  
         case 4:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A40");  
           break;  
         case 5:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A41");  
           break;  
         case 6:  
           response.IsValid = true;  
           response.ResponseMessage = Utilities.GetMessage("A42");  
           break;  
       }  
       return response;  
     }  
     #endregion Add SupplierMaster Contacts  
 DAO  
 -------  
 #region Add edit Delete Party Contcts   
     /// <summary>  
     /// Add edit Delete Party Contcts   
     /// </summary>  
     /// <param name="request"></param>  
     /// <returns></returns>  
     public PartyContctsResponse AddEditDeletePartyContcts (PartyContctsRequest request)  
     {  
       var response = new PartyContctsResponse();  
       Database db = DatabaseFactory.CreateDatabase(CommonConstants.CONNECTIONNAME);  
       using (DbCommand dbCommand = db.GetStoredProcCommand(StoredProcedures.spAddEditDeleteCustSuppMasterContacts))  
       {  
         db.AddInParameter(dbCommand, DBParameter.ContactID, DbType.Int32, request.ContactID);  
         db.AddInParameter(dbCommand, DBParameter.PartyID, DbType.Int32, request.PartyID);  
         db.AddInParameter(dbCommand, DBParameter.Type, DbType.Int32, request.Type);  
         db.AddInParameter(dbCommand, DBParameter.Name, DbType.String, request.Name);  
         db.AddInParameter(dbCommand, DBParameter.MobileNo, DbType.String, request.MobileNo);  
         db.AddInParameter(dbCommand, DBParameter.Department, DbType.String, request.Department);  
         db.AddInParameter(dbCommand, DBParameter.Desig, DbType.String, request.Desig);  
         db.AddInParameter(dbCommand, DBParameter.EmailID, DbType.String, request.EmailID);  
         db.AddInParameter(dbCommand, DBParameter.Description, DbType.String, request.Description);  
         db.AddOutParameter(dbCommand, DBParameter.ResponseCode, DbType.Int32, 20);  
         db.ExecuteNonQuery(dbCommand);  
         response.ResponseCode = Convert.ToInt32(db.GetParameterValue(dbCommand, DBParameter.ResponseCode));  
         response.PartyID = request.PartyID;  
       }  
       return response;  
     }  
     #endregion Add SupplierMaster Contacts  
 popup div  
 -----------  
 <div class="modal" id="PrtyContacts-widget" role="dialog" aria-labelledby="myModalLabel"  
     aria-hidden="true">  
     <div class="modal-dialog modelAddressbox">  
       <div class="modal-content">  
         <div class="modal-header">  
           <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="Contactscrossbtn">  
             <span aria-hidden="true">&times;</span></button>  
           <h4 class="modal-title" id="H7">  
             Supplier Contacts</h4>  
         </div>  
         <div class="modal-body">  
           <div class="row">  
             <div class="col-md-12 com-sm-12">  
               <form id="frmContacts">  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Name">  
                     <span class="colorred">*</span> Name</label>  
                   <input type="text" class="form-control input-sm" id="txtName" placeholder="Name"  
                     name="Name" required maxlength="30" />  
                   <input type="hidden" id="hdfContactID" />  
                   <input type="hidden" id="hdfPartyID" />  
                   <input type="hidden" id="hdfContsctType" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="MobileNo">  
                     <span class="colorred">*</span> Mobile No</label>  
                   <input type="text" class="form-control input-sm" placeholder="Mobile No" name="MobileNo"  
                     id="txtMobileNo" required maxlength="50" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Designation">  
                     Designation</label>  
                   <input type="text" class="form-control input-sm" placeholder="Designation" name="Designation"  
                     id="txtDesignation" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Department">  
                     Department</label>  
                   <input type="text" class="form-control input-sm" placeholder="Department" name="Department"  
                     id="txtDepartment" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="EmailId">  
                     EmailId</label>  
                   <input type="text" class="form-control input-sm" placeholder="EmailId" name="EmailId"  
                     id="txtEmailId" />  
                 </div>  
               </div>  
               <div class="col-md-6 col-sm-6">  
                 <div class="form-group">  
                   <label for="Description">  
                     Description</label>  
                   <input type="text" class="form-control input-sm" placeholder="Description" name="Description"  
                     id="txtDescription" />  
                 </div>  
               </div>  
               <div class="col-md-4 col-sm-4">  
                 <div class="form-group">  
                   <div class="upload-photo">  
                     <img src="../../Designing/images/defaultuserpic.png" class="img-responsive user">  
                     <div class="uploda-text">  
                       Upload picture  
                       <div class="_3jk">  
                         <input type="file" class="_n _5f0v" title="Choose a file to upload" accept="image/<b>*</b>"  
                           name="file" id="fileAttachments">  
                       </div>  
                     </div>  
                   </div>  
                 </div>  
               </div>  
               </form>  
             </div>  
           </div>  
         </div>  
         <div class="modal-footer">  
           <button class="btn btn-default btn-primary" type="button" id="popupbtnContactsSave"  
             title="Save">  
             Save</button>  
           <button class="btn btn-default" type="button" id="popupbtnContactsDelete" title="Delete">  
             Delete</button>  
           <button class="btn btn-default" type="button" id="popupbtnContactsClose" title="Close"  
             style="display: none">  
             Close</button>  
         </div>  
       </div>  
     </div>  
   </div>  
 storeprocedes  
 -------------  
 USE [EFACTIC_DEV]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_ADD_EDIT_DELETE_PARTY_CONTACTS]  Script Date: 01/22/2015 13:16:45 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author     :          GNANI .P  
 -- Create date     :          19/01/2015  
 -- Description     :          FOR SUPPLIER AND CUSTOMER CONTACTS  
 -- =============================================  
 ALTER PROCEDURE [dbo].[USP_ADD_EDIT_DELETE_PARTY_CONTACTS]  
       @ContactID               INT  
      ,@PartyID               INT                      
      ,@Name                    NVARCHAR(75)     =NULL       
      ,@MobileNo               NVARCHAR(100)     =NULL  
      ,@Department          NVARCHAR(100)     =NULL  
      ,@Desig                    VARCHAR(50)          =NULL  
      ,@EmailID               NVARCHAR(50)     =NULL  
      ,@Description          NVARCHAR(250)     =NULL  
      ,@TYPE                    INT                    =NULL  
      ,@ResponseCode          BIGINT               OUTPUT       
 AS  
 BEGIN  
      BEGIN TRY  
           IF @Type = 1     --ADD CUST MASTER CONTACTS.  
           BEGIN                 
                INSERT INTO dbo.MstCustContacts(CustID,Name,MobileNo,Department,Desig,EmailID,[Description]) VALUES (@PartyID,@Name,@MobileNo,@Department,@Desig,@EmailID,@Description)  
                SET @ResponseCode=1     --ADD SUCCESS FOR CUSTOMER MASTER.  
           END                 
           IF @Type = 2     --ADD SUPP MASTER CONTACTS.  
           BEGIN  
                INSERT INTO dbo.MstSuppContacts(SuppID,Name,MobileNo,Department,Desig,EmailID,[Description]) VALUES (@PartyID,@Name,@MobileNo,@Department,@Desig,@EmailID,@Description)  
                SET @ResponseCode=2     --ADD SUCCESS FOR SUPPLIER MASTER.  
           END                 
           IF @Type = 3     --EDIT CUST MASTER CONTACTS.  
           BEGIN  
                UPDATE dbo.MstCustContacts SET  Name               =     @Name  
                                                        ,MobileNo          =     @MobileNo  
                                                        ,Desig               =     @Desig  
                                                        ,Department          =     @Department  
                                                        ,EmailID          =     @EmailID  
                                                        ,[Description]     =     @Description  
                                                        WHERE CustID     =     @PartyID AND ContactID=@ContactID  
                SET @ResponseCode=3     --EDIT SUCCESS FOR CUSTOMER MASTER.  
           END       
           IF @Type = 4     --EDIT SUPP MASTER CONTACTS.  
           BEGIN  
                UPDATE dbo.MstSuppContacts SET  Name               =     @Name  
                                                        ,MobileNo          =     @MobileNo  
                                                        ,Desig               =     @Desig  
                                                        ,Department          =     @Department  
                                                        ,EmailID          =     @EmailID  
                                                        ,[Description]     =     @Description  
                                                        WHERE SuppID     =     @PartyID AND ContactID=@ContactID  
                SET @ResponseCode=4     --DELETE SUCCESS FOR SUPPLIER MASTER.  
           END  
           IF @Type = 5     --DELETE CUST MASTER CONTACTS.  
           BEGIN  
                DELETE dbo.MstCustContacts WHERE CustID     =     @PartyID      AND ContactID=@ContactID  
                SET @ResponseCode=5     --EDIT SUCCESS FOR CUSTOMER MASTER.  
           END       
           IF @Type = 6     --DELETE SUPP MASTER CONTACTS.  
           BEGIN  
                DELETE dbo.MstSuppContacts WHERE SuppID     =     @PartyID      AND ContactID=@ContactID  
                SET @ResponseCode=6     --DELETE SUCCESS FOR SUPPLIER MASTER.  
           END  
      END TRY  
      BEGIN CATCH  
           SELECT ERROR_MESSAGE()   
           SELECT ERROR_LINE ( )  
           SET @ResponseCode =-999     --OOPS SOMETHING WENT WRONG.  
      END CATCH       
 END  

2:19 AM Share:

 form and cursor validation  
 ----------------------------  
 form validation  
 ----------------  
   $('#DetailsectionBOMform').validate({  
     highlight: function (element) {  
       $(element).closest('.form-group').addClass('has-error');  
     },  
     unhighlight: function (element) {  
       $(element).closest('.form-group').removeClass('has-error');  
     },  
     errorElement: 'span',  
     errorClass: 'help-block',  
     errorPlacement: function (error, element) {  
       if (element.parent('.input-group').length) {  
         //error.insertAfter(element.parent());  
       } else {  
         // error.insertAfter(element);  
       }  
     }  
   });  
 cursor validation  
 ------------------  
 function BomFormCurr() {  
   $('#BOMComboForm').find(':text,:radio,:checkbox,select,textarea').each(function () {  
     if (!this.readOnly && !this.disabled && this.required &&  
             $(this).parentsUntil('form', 'div').css('display') != "none" && $(this).css('display') != "none") {  
       if (this.value.trim() == "") {  
         this.focus(); //Dom method  
         this.select(); //Dom method  
         return false;  
       }  
     }  
   });  
 }  
 example see below  
 ---------------------  
 /*Save SaveBOMGrid Save function starts here*/  
 function SaveBOMGridtable() {  
   try {  
     $('#BtnSave').click(function () {  
       $('#pageloaddiv').show();  
       if ($("#BOMComboForm").valid()) {  
           here u can write the logic            
       } else { BomFormCurr(); }  
     });  
   }  
   catch (ex) {  
   }  
 }  
 /*Save SaveBOMGrid Save function end here*/  
jquery

form and cursor validation

Posted by Gnani Palepu  |  No comments


 form and cursor validation  
 ----------------------------  
 form validation  
 ----------------  
   $('#DetailsectionBOMform').validate({  
     highlight: function (element) {  
       $(element).closest('.form-group').addClass('has-error');  
     },  
     unhighlight: function (element) {  
       $(element).closest('.form-group').removeClass('has-error');  
     },  
     errorElement: 'span',  
     errorClass: 'help-block',  
     errorPlacement: function (error, element) {  
       if (element.parent('.input-group').length) {  
         //error.insertAfter(element.parent());  
       } else {  
         // error.insertAfter(element);  
       }  
     }  
   });  
 cursor validation  
 ------------------  
 function BomFormCurr() {  
   $('#BOMComboForm').find(':text,:radio,:checkbox,select,textarea').each(function () {  
     if (!this.readOnly && !this.disabled && this.required &&  
             $(this).parentsUntil('form', 'div').css('display') != "none" && $(this).css('display') != "none") {  
       if (this.value.trim() == "") {  
         this.focus(); //Dom method  
         this.select(); //Dom method  
         return false;  
       }  
     }  
   });  
 }  
 example see below  
 ---------------------  
 /*Save SaveBOMGrid Save function starts here*/  
 function SaveBOMGridtable() {  
   try {  
     $('#BtnSave').click(function () {  
       $('#pageloaddiv').show();  
       if ($("#BOMComboForm").valid()) {  
           here u can write the logic            
       } else { BomFormCurr(); }  
     });  
   }  
   catch (ex) {  
   }  
 }  
 /*Save SaveBOMGrid Save function end here*/  

2:18 AM Share:

 simple Export excel using jquery  
 -------------------------  
 step 1:  
 ---------  
 this is the jquery   
 var tableToExcel = (function () {  
   var uri = 'data:application/vnd.ms-excel;base64,'  
   , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'  
   , base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }  
   , format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }  
   return function (table, name) {  
     if (!table.nodeType) table = document.getElementById(table)  
     var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }  
     window.location.href = uri + base64(format(template, ctx))  
   }  
 })()  
 step 2:  
 ----------  
 in button click event just past this code  
 change the tablename and title   
   tableToExcel("TableName", "Title");  
 simple happy coding.  
jquery

Simple Export Excel using jquery

Posted by Gnani Palepu  |  No comments


 simple Export excel using jquery  
 -------------------------  
 step 1:  
 ---------  
 this is the jquery   
 var tableToExcel = (function () {  
   var uri = 'data:application/vnd.ms-excel;base64,'  
   , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'  
   , base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }  
   , format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }  
   return function (table, name) {  
     if (!table.nodeType) table = document.getElementById(table)  
     var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }  
     window.location.href = uri + base64(format(template, ctx))  
   }  
 })()  
 step 2:  
 ----------  
 in button click event just past this code  
 change the tablename and title   
   tableToExcel("TableName", "Title");  
 simple happy coding.  

2:03 AM Share:

 simple binding sqldata table to gridview in c# and vb net  
 -----------------------------------------------------------  
 just follow 3 steps  
 ----------------------  
 reference  
 -------------:http://www.aspsnippets.com/Articles/Connect-Bind-GridView-to-MySql-database-in-ASPNet-using-C-and-VBNet.aspx  
 step 1:  
 ----------  
 <connectionStrings>  
   <addname="constr"connectionString="Data Source=localhost;port=3306;Initial Catalog=SampleDB;User Id=mudassar;password=pass@123"/>  
 </connectionStrings>  
 step 2:  
 ------------  
  C#  
 using System.Data;  
 using System.Configuration;  
 using MySql.Data.MySqlClient;  
  VB.Net  
 Imports System.Data  
 Imports System.Configuration  
 Imports MySql.Data.MySqlClient  
 step 3  
 ------------  
  C#  
 protected void Page_Load(object sender, EventArgs e)  
 {  
   if (!this.IsPostBack)  
   {  
       string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
       using (MySqlConnection con = new MySqlConnection(constr))  
       {  
         using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM Customers"))  
         {  
           using (MySqlDataAdapter sda = new MySqlDataAdapter())  
           {  
             cmd.Connection = con;  
             sda.SelectCommand = cmd;  
             using (DataTable dt = new DataTable())  
             {  
               sda.Fill(dt);  
               GridView1.DataSource = dt;  
               GridView1.DataBind();  
             }  
           }  
         }  
       }  
   }  
 }  
 vb.net  
 ------  
  VB.Net  
 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load  
   If Not Me.IsPostBack Then  
     Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString  
     Using con As New MySqlConnection(constr)  
       Using cmd As New MySqlCommand("SELECT * FROM Customers")  
         Using sda As New MySqlDataAdapter()  
           cmd.Connection = con  
           sda.SelectCommand = cmd  
           Using dt As New DataTable()  
             sda.Fill(dt)  
             GridView1.DataSource = dt  
             GridView1.DataBind()  
           End Using  
         End Using  
       End Using  
     End Using  
   End If  
 End Sub  
html

Simple binding sqldata table to gridview in c# and vb net

Posted by Gnani Palepu  |  No comments


 simple binding sqldata table to gridview in c# and vb net  
 -----------------------------------------------------------  
 just follow 3 steps  
 ----------------------  
 reference  
 -------------:http://www.aspsnippets.com/Articles/Connect-Bind-GridView-to-MySql-database-in-ASPNet-using-C-and-VBNet.aspx  
 step 1:  
 ----------  
 <connectionStrings>  
   <addname="constr"connectionString="Data Source=localhost;port=3306;Initial Catalog=SampleDB;User Id=mudassar;password=pass@123"/>  
 </connectionStrings>  
 step 2:  
 ------------  
  C#  
 using System.Data;  
 using System.Configuration;  
 using MySql.Data.MySqlClient;  
  VB.Net  
 Imports System.Data  
 Imports System.Configuration  
 Imports MySql.Data.MySqlClient  
 step 3  
 ------------  
  C#  
 protected void Page_Load(object sender, EventArgs e)  
 {  
   if (!this.IsPostBack)  
   {  
       string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
       using (MySqlConnection con = new MySqlConnection(constr))  
       {  
         using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM Customers"))  
         {  
           using (MySqlDataAdapter sda = new MySqlDataAdapter())  
           {  
             cmd.Connection = con;  
             sda.SelectCommand = cmd;  
             using (DataTable dt = new DataTable())  
             {  
               sda.Fill(dt);  
               GridView1.DataSource = dt;  
               GridView1.DataBind();  
             }  
           }  
         }  
       }  
   }  
 }  
 vb.net  
 ------  
  VB.Net  
 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load  
   If Not Me.IsPostBack Then  
     Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString  
     Using con As New MySqlConnection(constr)  
       Using cmd As New MySqlCommand("SELECT * FROM Customers")  
         Using sda As New MySqlDataAdapter()  
           cmd.Connection = con  
           sda.SelectCommand = cmd  
           Using dt As New DataTable()  
             sda.Fill(dt)  
             GridView1.DataSource = dt  
             GridView1.DataBind()  
           End Using  
         End Using  
       End Using  
     End Using  
   End If  
 End Sub  

1:56 AM Share:
Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top