Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Validation() == true)
            {
                DataTable dtUserDetails = userBLL.GetUserDetails(txtLoginId.Text.Trim(), txtPassword.Text.Trim());

                if (dtUserDetails != null)
                {
                    if (dtUserDetails.Rows.Count > 0)
                    {
                        USERID = Convert.ToInt32(dtUserDetails.Rows[0]["Id"].ToString());
                        MDIParent obj = new MDIParent();
                        obj.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Please enter correct  login id  and password.");
                        txtLoginId.Focus();
                    }
                }
            }
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPassword.Text == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }


            bool          IsValid = false;
            UserMasterDto user    = new UserMasterDto();

            IsValid = UserMasterDao.LoginCheck(txtUserName.Text.Trim(), txtPassword.Text, out user);



            if (IsValid)
            {
                MDIParent mdi = new MDIParent(user);
                mdi.IsMdiContainer = true;
                mdi.Show();
                mdi.BringToFront();
                this.Hide();
            }



            //if (txtUserName.Text == "user name")
            //{
            //    MessageBox.Show("Please intput your user name.", "User Name is required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //    txtUserName.Focus();
            //}
            //else if (txtPassword.Text == "password")
            //{
            //    MessageBox.Show("Please intput your password.", "Password is required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //    txtPassword.Focus();
            //}
            //else
            //{
            //    USER_MASTER _user = new USER_MASTER();
            //    try
            //    {
            //        using (BaseManager manager = new BaseManager())
            //        {
            //            _user = manager.GetManagerInstance<UserManager>().GetUserByNameORPassword(txtUserName.Text.Trim(), txtPassword.Text.Trim());
            //        }
            //        if (_user != null)
            //        {
            //            frmMDIParent _parent = new frmMDIParent(_user.USERNAME, _user.USERFULLNAME);
            //            _parent.Show();
            //            _parent.BringToFront();
            //            this.Hide();


            //        }
            //        else
            //        {
            //            MessageBox.Show("Login ID/Password is incorrect", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //        }



            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: " + ex.Message, "Fatal Error Occured!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    }

            //}
        }
Example #3
0
        //private void btnOK_Click(object sender, EventArgs e)
        //{
        //    Hashtable htComp = new Hashtable();
        //    objData = new Security();

        //    try
        //    {
        //        if (CheckData())
        //        {
        //            DataTable dt = objData.UserLogin(txtUserId.Text.ToString(), txtPassword.Text.ToString());
        //            if (dt.Rows.Count > 0)
        //            {
        //                if (txtUserId.Text.ToString().Trim().ToUpper() == "ADMIN")
        //                {
        //                    CommonData.CompanyCode = cbCompany.SelectedValue.ToString();
        //                    CommonData.CompanyName = cbCompany.Text.ToString();
        //                    CommonData.BranchCode = cbBranch.SelectedValue.ToString();
        //                    CommonData.BranchName = cbBranch.Text.ToString();
        //                    CommonData.StateCode = cbBranch.SelectedValue.ToString().Substring(3, 2);
        //                    CommonData.LogUserId = txtUserId.Text.ToString().Trim();
        //                }
        //                else
        //                    CommonData.SetCompanyDetails(dt.Rows[0]["companycode"].ToString(), dt.Rows[0]["companyname"].ToString(), dt.Rows[0]["userid"].ToString());
        //                dt.Dispose();
        //                dt = null;
        //                htComp = objData.GetCompanyDocumentMonth();
        //                if (htComp.Count > 0)
        //                {
        //                    CommonData.SetCompanyDocMonthDetails(htComp["DocMonth"].ToString()
        //                        , Convert.ToDateTime(htComp["DocFDate"]).ToString("dd/MM/yyyy")
        //                        , Convert.ToDateTime(htComp["DocTDate"]).ToString("dd/MM/yyyy")
        //                        , htComp["FYear"].ToString()
        //                        , Convert.ToDateTime(htComp["CurDate"]).ToString("dd/MMM/yyyy"));
        //                    string strComp = CommonData.CompanyName;
        //                    if (strComp.ToString().Length > 0)
        //                    {
        //                        MDIParent MDIForm = new MDIParent();
        //                        MDIForm.Text = CommonData.CompanyName + '-' + CommonData.BranchName;
        //                        MDIForm.Show();
        //                        this.Hide();
        //                    }
        //                }
        //                else
        //                {
        //                    MessageBox.Show("No Document month for " + cbCompany.Text.ToString() +
        //                        "\nPlease contact to IT - Department", "SS CRM", MessageBoxButtons.OK, MessageBoxIcon.Stop);
        //                }
        //            }
        //            else
        //            {
        //                MessageBox.Show("Invalid User ID, Password. ", "SS CRM", MessageBoxButtons.OK, MessageBoxIcon.Stop);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        if (ex.Message.ToString().IndexOf("network") > -1)
        //            MessageBox.Show("Database connection problem, Please check network.\nContact to IT Department");
        //        else
        //            MessageBox.Show(ex.Message.ToString());
        //    }
        //    finally
        //    {

        //        objData = null;
        //        htComp = null;
        //    }
        //}

        private void btnOK_Click(object sender, EventArgs e)
        {
            uint iInt = 312;
            byte val2 = (byte)iInt;

            if (chkHO.CheckState == CheckState.Checked)
            {
                CommonData.ConnectionType = "LOCAL";
            }
            else
            {
                CommonData.ConnectionType = "";
            }

            objUtil = new UtilityDB();

            try
            {
                if (CheckData())
                {
                    if (cbDocmentMonth.SelectedIndex > -1)
                    {
                        if (txtUserId.Text.ToString().Trim().ToUpper() == "ADMIN")
                        {
                            CommonData.CompanyCode = cbCompany.SelectedValue.ToString();
                            CommonData.CompanyName = cbCompany.Text.ToString();
                            CommonData.BranchCode  = cbBranch.SelectedValue.ToString();
                            CommonData.BranchType  = cbBranch.Text.ToString().Substring(cbBranch.Text.Length - 3, 2);
                            CommonData.BranchName  = cbBranch.Text.ToString();
                            CommonData.StateCode   = cbBranch.SelectedValue.ToString().Substring(3, 2);
                            CommonData.LogUserId   = txtUserId.Text.ToString().Trim();
                            CommonData.DocMonth    = cbDocmentMonth.SelectedText.ToString();
                        }
                        else
                        {
                            string[] strBranchCode = cbUserBranch.SelectedValue.ToString().Split('@');
                            CommonData.BranchCode  = strBranchCode[0].ToString();
                            CommonData.CompanyCode = strBranchCode[1].ToString();
                            CommonData.BranchName  = strBranchCode[2].ToString();
                            CommonData.CompanyName = strBranchCode[3].ToString();
                            CommonData.StateCode   = strBranchCode[4].ToString();
                            CommonData.LogUserId   = txtUserId.Text.ToString().Trim();
                            CommonData.DocMonth    = cbDocmentMonth.SelectedText.ToString();
                            CommonData.BranchType  = strBranchCode[2].Substring(strBranchCode[2].Length - 3, 2);
                        }
                        string[] strArrDocMon = cbDocmentMonth.SelectedValue.ToString().Split('@');
                        CommonData.SetCompanyDocMonthDetails(cbDocmentMonth.Text.ToString()
                                                             , Convert.ToDateTime(strArrDocMon[1]).ToString("dd/MM/yyyy")
                                                             , Convert.ToDateTime(strArrDocMon[2]).ToString("dd/MM/yyyy")
                                                             , strArrDocMon[0].ToString()
                                                             , CommonData.CurrentDate);
                        string strComp = CommonData.CompanyName;
                        if (strComp.ToString().Length > 0)
                        {
                            objUtil.SetInvoiceDataExistedForPostMonth();
                            MDIParent MDIForm = new MDIParent();
                            MDIForm.Text = CommonData.CompanyName + '-' + CommonData.BranchName;
                            MDIForm.Show();
                            InsertUserHistory("LOGIN");
                            this.Hide();
                        }
                        objUtil = null;
                    }
                    else
                    {
                        MessageBox.Show("No Document month for " + cbCompany.Text.ToString() +
                                        "\nPlease contact to IT - Department", "SS CRM", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString().IndexOf("network") > -1)
                {
                    MessageBox.Show("Database connection problem, Please check network.\nContact to IT Department");
                }
                else
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
            finally
            {
                objData = null;
            }
        }