protected void Login_Click(object sender, EventArgs e)
    {
        sResult = LG.CheckLoginStage(Userid.Value, encrypt(pass.Value));
        if (sResult == "1004")
        {
            WebMsgBox.Show("Login Failed!! User is Suspended!!", this.Page);
            return;
        }
        else
        {
            //Below commented by Abhishek as per requirement on 19-02-2018
            string RC = LG.CheckLoginStatus(Userid.Value, encrypt(pass.Value));
            if (RC == "1")
            {
                pass.Focus();
                pass.Value        = "";
                Lbl_Error.Visible = true;
                Lbl_Error.Text    = "Sorry User is Already Logged in ..!!";
                return;
            }

            //cmd = "Select B.BankCD As BankCode, B.BankName, B.MidName As BranchName, " +
            //          "(Select IsNull(BrCd, 0) From BankName Where BranchDesc = 'HO') As HOBRCD, U.BrCd, " +
            //          "Left(U.UserName, Case When CharIndex(' ', U.UserName) > 0 Then CharIndex(' ', U.UserName) Else Len(U.UserName) End) As UserName, " +
            //          "U.LoginCode, U.PermissionNo, U.UserGroup, U.MultiLog, U.EPassWord From UserMaster U " +
            //          "Inner Join BankName B With(NoLock) On U.BrCd = B.BrCd "+
            //"Where U.LoginCode = '" + "ATUL7" + "' And EPassword = '******' ";
            //SqlCommand cd = new SqlCommand(cmd);
            //string cs= ConfigurationManager.ConnectionStrings["ocbs"].ConnectionString;

            //SqlConnection con = new SqlConnection(cs);

            //con.Open();

            //SqlDataAdapter dt = new SqlDataAdapter(cmd, con);


            DT = LG.GetDetaile(Userid.Value, encrypt(pass.Value));
            string       txtpath = System.Web.HttpContext.Current.Server.MapPath("~/SqlConn/SYS.dat");
            StreamReader sr      = new StreamReader(txtpath);
            string       line    = sr.ReadToEnd();
            string[]     con     = line.Split("\n".ToCharArray());
            string       Date    = Decrypt(con[5].ToString());

            string Date1 = LG.getdate(Date);
            if (Date == null || Date1 == "")
            {
                WebMsgBox.Show("Error code-305", this.Page);
                return;
            }
            else
            {
                if (DT.Rows.Count > 0)
                {
                    Session["SessionTimeout"] = LG.GetSessionTime();
                    //  Added by amol on 21/11/2018 (for bank details)
                    Session["BankCode"]   = DT.Rows[0]["BankCode"].ToString();
                    Session["BankName"]   = DT.Rows[0]["BankName"].ToString();
                    Session["BranchName"] = DT.Rows[0]["BranchName"].ToString();
                    //  End added by amol on 21/11/2018

                    Session["BRCD"]      = DT.Rows[0]["BrCd"].ToString();
                    Session["HOBRCD"]    = DT.Rows[0]["HOBRCD"].ToString();
                    Session["MID"]       = DT.Rows[0]["PermissionNo"].ToString();
                    Session["LOGINCODE"] = DT.Rows[0]["LoginCode"].ToString();
                    Session["UserName"]  = DT.Rows[0]["UserName"].ToString();
                    Session["UGRP"]      = DT.Rows[0]["UserGroup"].ToString();
                    Session["MULTILOG"]  = DT.Rows[0]["MultiLog"].ToString();

                    if (DT.Rows.Count > 0)//Dhanya Shetty-To store the activity in Avs500 table as log details//
                    {
                        CLM.LOGDETAILS("Insert", Session["BRCD"].ToString(), Session["MID"].ToString(), "Login _" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());
                    }
                    if (DT.Rows[0]["EPassWord"].ToString() == "")
                    {
                        if (DT.Rows[0]["UserGroup"].ToString() == "1" || DT.Rows[0]["UserGroup"].ToString() == "2" || DT.Rows[0]["UserGroup"].ToString() == "3")
                        {
                            string url = "FrmSetPWD.aspx";
                            NewTab(url);
                        }
                    }
                    else
                    {
                        int RS = LG.UpdateLoginsts(Userid.Value, encrypt(pass.Value), "1", Session["BRCD"].ToString());
                        if (RS > 0)
                        {
                            Session["UID"] = Userid.Value;
                            Session["PWD"] = pass.Value;
                            Response.Redirect("FrmBlank.aspx", true);
                        }
                    }
                }
                else
                {
                    Lbl_Error.Visible = true;
                    Lbl_Error.Text    = "Login Fail Please Check UserId or Password ...!!";
                    Userid.Focus();
                    return;
                }
            }
        }
    }