Exemplo n.º 1
0
 private void login()
 {
     ds = cl.getdata("select * from UserInfo where isActive=1 and UserName='******' and CompanyId='" + txthCompId.Text + "'");
     dt = ds.Tables[0];
     if (dt.Rows.Count > 0)
     {
         if (dt.Rows[0][5].ToString() == txtPassword.Text)
         {
             txtPassword.Text = "";
             //         master = new Master(this);
             Master.userid = dt.Rows[0]["Userid"].ToString();
             try
             {
                 master_1.setheader(companydt, dt.Rows[0]["UserName"].ToString());
                 master_1.enablemenu(true);
                 master_1.disablecompany(false);
                 master_1.compId(txthCompId.Text);
             }
             catch
             {
             }
             try
             {
                 master.setheader(companydt, dt.Rows[0]["UserName"].ToString());
                 master.enablemenu(true);
                 master.disablecompany(false);
                 master.compId(txthCompId.Text);
             }
             catch
             {
             }
             //frm.Show();
             //  this.Close();
             options = cl.getdataset("select * from options");
             LogGenerator.Info("Company LogIN CompanyID=" + txthCompId.Text);
             LogGenerator.Info("User Login UserID=" + Master.userid);
             if (options.Rows[0]["userlog"].ToString() == "True")
             {
                 cl.execute("INSERT INTO [dbo].[USerLog]([userid],[loginpalce],[Status],[isactive],[datetime])VALUES('" + Master.userid + "','" + "Company" + "','" + "Login" + "','" + "1" + "','" + DateTime.Now.ToString("MM/dd/yyyy h:mm:ss") + "')");
             }
             int tabs = tabControl.TabPages.Count;
             if (tabs > 0)
             {
                 master.RemoveCurrentTab();
                 Businessplus bus = new Businessplus();
                 master.AddNewTab(bus);
             }
         }
         else
         {
             MessageBox.Show("Password Incorrect. Try again!!!");
             txtPassword.Text = "";
         }
     }
 }
Exemplo n.º 2
0
        private void login()
        {
            ds = cl.getdata("select * from UserInfo where isActive=1 and UserName='******' and CompanyId='" + txthCompId.Text + "'");
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][5].ToString() == txtPassword.Text)
                {
                    txtPassword.Text = "";
                    //         master = new Master(this);
                    Master.userid = dt.Rows[0]["Userid"].ToString();
                    try
                    {
                        master_1.setheader(companydt, dt.Rows[0]["UserName"].ToString());
                        master_1.enablemenu(true);
                        master_1.disablecompany(false);
                        master_1.compId(txthCompId.Text);
                    }
                    catch
                    {
                    }
                    try
                    {
                        master.setheader(companydt, dt.Rows[0]["UserName"].ToString());
                        master.enablemenu(true);
                        master.disablecompany(false);
                        master.compId(txthCompId.Text);
                    }
                    catch
                    {
                    }
                    //frm.Show();
                    //  this.Close();

                    int tabs = tabControl.TabPages.Count;
                    if (tabs > 0)
                    {
                        master.RemoveCurrentTab();
                        Businessplus bus = new Businessplus();
                        master.AddNewTab(bus);
                    }
                }
                else
                {
                    MessageBox.Show("Password Incorrect. Try again!!!");
                    txtPassword.Text = "";
                }
            }
        }