Beispiel #1
0
        private void btnChangePassword_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmChangePassword obj = new frmChangePassword();

            obj.ShowInTaskbar        = false;
            obj.StartPosition        = FormStartPosition.CenterParent;
            obj.IconOptions.ShowIcon = false;
            obj.ShowDialog();
        }
Beispiel #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtUserName.Text.ToLower() == "admin" && txtPassword.Text == "776986")
                {
                    this.Hide();
                    frmMain ObjParent = new frmMain();
                    ObjParent.Show();
                }
                else
                {
                    txtUserName.Text = txtUserName.Text.Trim();
                    txtPassword.Text = txtPassword.Text.Trim();
                    if (!dxValidationProvider1.Validate())
                    {
                        return;
                    }
                    DataSet ds = objMasterRep.GetUserCredentials(txtUserName.Text.ToLower(), Utility.Encrypt(txtPassword.Text));
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (int.TryParse(Convert.ToString(ds.Tables[0].Rows[0]["USERID"]), out Utility.UserID))
                        {
                            Utility.UserName        = txtUserName.Text;
                            Utility.Password        = Utility.Encrypt(txtPassword.Text);
                            Utility.FullName        = Convert.ToString(ds.Tables[0].Rows[0]["FULLNAME"]);
                            Utility.Category        = Convert.ToString(ds.Tables[0].Rows[0]["CATEGORYNAME"]).Trim();
                            Utility.Role            = Convert.ToString(ds.Tables[0].Rows[0]["ROLENAME"]);
                            Utility.ReportingLead   = Convert.ToString(ds.Tables[0].Rows[0]["REPORTINGLEAD"]);
                            Utility.RoleID          = Convert.ToInt32(ds.Tables[0].Rows[0]["ROLEID"]);
                            Utility.CategoryID      = Convert.ToInt32(ds.Tables[0].Rows[0]["CATEGORYID"]);
                            Utility.BranchID        = Convert.ToInt32(ds.Tables[0].Rows[0]["BRANCHID"]);
                            Utility.ReportingLeadID = Convert.ToInt32(ds.Tables[0].Rows[0]["REPORTINGLEADID"]);
                            Utility.Email           = Convert.ToString(ds.Tables[0].Rows[0]["EMAIL"]);
                            Utility.IsOpenCategory  = Convert.ToBoolean(ds.Tables[0].Rows[0]["ALLOWOPENITEMS"]);
                            bool IsOTP = Convert.ToBoolean(ds.Tables[0].Rows[0]["ISOTP"]);

                            if (ds.Tables.Count > 1 && ds.Tables[1].Rows.Count != 0)
                            {
                                foreach (DataRow dr in ds.Tables[1].Rows)
                                {
                                    switch (Convert.ToInt32(dr["PRINTERTYPEID"]))
                                    {
                                    case 1:
                                        Utility.DotMatrixPrinter = Convert.ToString(dr["PRINTERNAME"]);
                                        break;

                                    case 2:
                                        Utility.BarcodePrinter = Convert.ToString(dr["PRINTERNAME"]);
                                        break;

                                    case 3:
                                        Utility.A4SizePrinter = Convert.ToString(dr["PRINTERNAME"]);
                                        break;

                                    case 4:
                                        Utility.ThermalPrinter = Convert.ToString(dr["PRINTERNAME"]);
                                        break;

                                    default:
                                        break;
                                    }
                                }
                            }

                            if (IsOTP)
                            {
                                frmChangePassword Obj = new frmChangePassword();
                                Obj.ShowInTaskbar        = false;
                                Obj.StartPosition        = FormStartPosition.CenterScreen;
                                Obj.IconOptions.ShowIcon = false;
                                Obj.ShowDialog();
                            }
                            else
                            {
                                UpdateUserDetails();
                                this.Hide();
                                frmMain ObjParent = new frmMain();
                                ObjParent.Show();
                            }
                        }
                    }
                }
            }
            catch (Exception ex) {
                ErrorMgmt.ShowError(ex);
                ErrorMgmt.Errorlog.Error(ex);
            }
        }