コード例 #1
0
 /// <summary>
 /// Function to fill the values in curresponding controls for updation
 /// </summary>
 public void FillControls()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser              = spUser.UserView(decUserId);
         txtUserName.Text      = infoUser.UserName;
         txtPassword.Text      = infoUser.Password;
         cmbRole.SelectedValue = infoUser.RoleId;
         txtNarration.Text     = infoUser.Narration;
         if (infoUser.Active)
         {
             cbxActive.Checked = true;
         }
         else
         {
             cbxActive.Checked = false;
         }
         txtRetype.Text = txtPassword.Text;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// Function to fill the values in curresponding controls for updation
 /// </summary>
 public void FillControls()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser              = spUser.UserView(decUserId);
         txtUserName.Text      = infoUser.UserName;
         txtPassword.Text      = infoUser.Password;
         cmbRole.SelectedValue = infoUser.RoleId;
         txtNarration.Text     = infoUser.Narration;
         if (infoUser.Active)
         {
             cbxActive.Checked = true;
         }
         else
         {
             cbxActive.Checked = false;
         }
         txtRetype.Text = txtPassword.Text;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "UC:8" + ex.Message;
     }
 }
コード例 #3
0
ファイル: frmLogin.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Start a login
 /// </summary>
 public void Login()
 {
     try
     {
         UserSP spUser = new UserSP();
         CompanySP spCompany = new CompanySP();
         CompanyInfo infoCompany = new CompanyInfo();
         string strUserName = txtUserName.Text.Trim();
         string strPassword = spUser.LoginCheck(strUserName);
         
         if (strPassword == txtPassword.Text.Trim() && strPassword != string.Empty)
         {
             int inUserId = spUser.GetUserIdAfterLogin(strUserName, strPassword);
             PublicVariables._decCurrentUserId = inUserId;
             infoCompany = spCompany.CompanyView(1);
             PublicVariables._decCurrencyId = infoCompany.CurrencyId;
             formMDI.MDIObj.CallFromLogin();
             SettingsCheck();
             //for Quock Launch menu
             formMDI.MDIObj.ShowQuickLaunchMenu();
             formMDI.MDIObj.CurrentSettings();
             //Display ChangeCurrentDate form//
             frmChangeCurrentDate frmCurrentDateChangeObj = new frmChangeCurrentDate();
             frmCurrentDateChangeObj.MdiParent = formMDI.MDIObj;
             frmCurrentDateChangeObj.CallFromLogin(this);
             formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]";
             // For showing the OpenMiracle message from the website
             formMDI.MDIObj.logoutToolStripMenuItem.Enabled = true;
             if (PublicVariables.MessageToShow != string.Empty)
             {
                 frmMessage frmMsg = new frmMessage();
                 frmMsg.lblHeading.Text = PublicVariables.MessageHeadear;
                 frmMsg.lblMessage.Text = PublicVariables.MessageToShow;
                 frmMsg.MdiParent = formMDI.MDIObj;
                 frmMsg.Show();
                 frmMsg.Location = new Point(0, formMDI.MDIObj.Height - 270);
                 foreach (Form form in Application.OpenForms)
                 {
                     if (form.GetType() == typeof(frmChangeCurrentDate))
                     {
                         form.Focus();
                     }
                 }
             }
         }
         else
         {
             Messages.InformationMessage("Invalid username or password");
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("LOGIN02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #4
0
        /// <summary>
        /// Start a login
        /// </summary>
        public void Login()
        {
            try
            {
                UserSP      spUser      = new UserSP();
                CompanySP   spCompany   = new CompanySP();
                CompanyInfo infoCompany = new CompanyInfo();
                string      strUserName = txtUserName.Text.Trim();
                string      strPassword = spUser.LoginCheck(strUserName);

                if (strPassword == txtPassword.Text.Trim() && strPassword != string.Empty)
                {
                    int inUserId = spUser.GetUserIdAfterLogin(strUserName, strPassword);
                    PublicVariables._decCurrentUserId = inUserId;
                    infoCompany = spCompany.CompanyView(1);
                    PublicVariables._decCurrencyId = infoCompany.CurrencyId;
                    formMDI.MDIObj.CallFromLogin();
                    SettingsCheck();
                    //for Quock Launch menu
                    formMDI.MDIObj.ShowQuickLaunchMenu();
                    formMDI.MDIObj.CurrentSettings();
                    //Display ChangeCurrentDate form//
                    frmChangeCurrentDate frmCurrentDateChangeObj = new frmChangeCurrentDate();
                    frmCurrentDateChangeObj.MdiParent = formMDI.MDIObj;
                    frmCurrentDateChangeObj.CallFromLogin(this);
                    formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]";
                    // For showing the OpenMiracle message from the website
                    formMDI.MDIObj.logoutToolStripMenuItem.Enabled = true;
                    if (PublicVariables.MessageToShow != string.Empty)
                    {
                        frmMessage frmMsg = new frmMessage();
                        frmMsg.lblHeading.Text = PublicVariables.MessageHeadear;
                        frmMsg.lblMessage.Text = PublicVariables.MessageToShow;
                        frmMsg.MdiParent       = formMDI.MDIObj;
                        frmMsg.Show();
                        frmMsg.Location = new Point(0, formMDI.MDIObj.Height - 270);
                        foreach (Form form in Application.OpenForms)
                        {
                            if (form.GetType() == typeof(frmChangeCurrentDate))
                            {
                                form.Focus();
                            }
                        }
                    }
                }
                else
                {
                    Messages.InformationMessage("Invalid username or password");
                    Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("LOGIN02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #5
0
 /// <summary>
 ///  Form load make the form controls based on settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChangePassword_Load(object sender, EventArgs e)
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser             = spUser.UserView(PublicVariables._decCurrentUserId);
         txtUserName.Text     = infoUser.UserName;
         txtUserName.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CHGPWD:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
ファイル: frmChangePassword.cs プロジェクト: nwelsheimer/NBS
 /// <summary>
 ///  Form load make the form controls based on settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChangePassword_Load(object sender, EventArgs e)
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser             = spUser.UserView(PublicVariables._decCurrentUserId);
         txtUserName.Text     = infoUser.UserName;
         txtUserName.ReadOnly = true;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CHGPWD:3" + ex.Message;
     }
 }
コード例 #7
0
 /// <summary>
 /// User Creation GridFill
 /// </summary>
 public void GridFill()
 {
     try
     {
         UserSP    spUser            = new UserSP();
         DataTable dtblUserCreation  = new DataTable();
         string    strSearchUserName = txtSearchUserName.Text.Trim();
         string    strSearchRole     = cmbSearchRole.Text;
         dtblUserCreation           = spUser.UserCreationViewForGridFill(strSearchUserName, strSearchRole);
         dgvUserCreation.DataSource = dtblUserCreation;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "UC:7" + ex.Message;
     }
 }
コード例 #8
0
 /// <summary>
 /// User Creation GridFill
 /// </summary>
 public void GridFill()
 {
     try
     {
         UserSP    spUser            = new UserSP();
         DataTable dtblUserCreation  = new DataTable();
         string    strSearchUserName = txtSearchUserName.Text.Trim();
         string    strSearchRole     = cmbSearchRole.Text;
         dtblUserCreation           = spUser.UserCreationViewForGridFill(strSearchUserName, strSearchRole);
         dgvUserCreation.DataSource = dtblUserCreation;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #9
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 UserInfo infoUser = new UserInfo();
                 UserSP   spUser   = new UserSP();
                 if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text      = "Save";
                     btnDelete.Enabled = false;
                     ClearFunction();
                     GridFill();
                 }
             }
         }
         else
         {
             UserInfo infoUser = new UserInfo();
             UserSP   spUser   = new UserSP();
             if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 ClearFunction();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "UC:9" + ex.Message;
     }
 }
コード例 #10
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 UserInfo infoUser = new UserInfo();
                 UserSP   spUser   = new UserSP();
                 if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text      = "Save";
                     btnDelete.Enabled = false;
                     ClearFunction();
                     GridFill();
                 }
             }
         }
         else
         {
             UserInfo infoUser = new UserInfo();
             UserSP   spUser   = new UserSP();
             if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 ClearFunction();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:9" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #11
0
 /// <summary>
 /// Update Function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser.UserId   = Convert.ToDecimal(dgvUserCreation.CurrentRow.Cells["dgvtxtUserId"].Value);
         infoUser.UserName = txtUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         if (cbxActive.Checked)
         {
             infoUser.Active = true;
         }
         else
         {
             infoUser.Active = false;
         }
         infoUser.RoleId    = Convert.ToDecimal(cmbRole.SelectedValue);
         infoUser.Narration = txtNarration.Text.Trim();
         infoUser.Extra1    = string.Empty;
         infoUser.Extra2    = string.Empty;
         string strUserName = txtUserName.Text.Trim();
         if (spUser.UserCreationCheckExistence(decUserId, strUserName) == false)
         {
             spUser.UserEdit(infoUser);
             Messages.UpdatedMessage();
             ClearFunction();
             GridFill();
             txtUserName.Focus();
         }
         else
         {
             Messages.InformationMessage("User name already exists");
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #12
0
 /// <summary>
 /// Save Function
 /// </summary>
 private void SaveFunction()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser.UserName = txtUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         if (cbxActive.Checked)
         {
             infoUser.Active = true;
         }
         else
         {
             infoUser.Active = false;
         }
         infoUser.RoleId    = Convert.ToDecimal(cmbRole.SelectedValue);
         infoUser.Narration = txtNarration.Text.Trim();
         infoUser.Extra1    = string.Empty;
         infoUser.Extra2    = string.Empty;
         string strUserName = txtUserName.Text.Trim();
         if (spUser.UserCreationCheckExistence(decUserId, strUserName) == false)
         {
             spUser.UserAdd(infoUser);
             Messages.SavedMessage();
             ClearFunction();
             GridFill();
             txtUserName.Focus();
         }
         else
         {
             Messages.InformationMessage("User name already exists");
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "UC:3" + ex.Message;
     }
 }
コード例 #13
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanySP spCompany = new CompanySP();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathSP spCompanyPath = new CompanyPathSP();
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         strPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
         infoCompanyPath.CompanyPath = strPath;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoCompanyPath.ExtraDate = DateTime.Now;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         infoCompanyPath.CompanyId = 1;
         infoCompany.CompanyId = 1;
         infoUser.UserId = PublicVariables._decCurrentUserId;
         spCompany.CompanyEdit(infoCompany);
         spCompanyPath.CompanyPathEdit(infoCompanyPath);
         spUser.UserEdit(infoUser);
         Messages.UpdatedMessage();
         //  To set default currencyId...........In exchangeRate..//
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         infoExchangeRate.ExchangeRateId = 1;
         infoExchangeRate.Date = PublicVariables._dtCurrentDate;
         infoExchangeRate.CurrencyId = infoCompany.CurrencyId;
         infoExchangeRate.ExtraDate = PublicVariables._dtCurrentDate;
         infoExchangeRate.Narration = string.Empty;
         infoExchangeRate.Rate = 1;
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         spExchangeRate.ExchangeRateEdit(infoExchangeRate);
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         decimal decIdentity;
         infoFinancialYear.FromDate = PublicVariables._dtFromDate;
         infoFinancialYear.ToDate = PublicVariables._dtToDate;
         infoFinancialYear.ExtraDate = DateTime.Now;
         infoFinancialYear.Extra1 = string.Empty;
         infoFinancialYear.Extra2 = string.Empty;
         bool isExist = spFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate);
         if (!isExist)
         {
             decIdentity = spFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear);
         }
         //===========Add companyDetails in ExternalDb =====================//
         decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId;
         PublicVariables._decCurrentCompanyId = 0;
         CompanySP spExCompany = new CompanySP();
         CompanyPathSP spExCompanyPath = new CompanyPathSP();
         CompanyInfo infoExCompany = new CompanyInfo();
         CompanyPathInfo infoExCompanyPath = new CompanyPathInfo();
         infoExCompany = infoCompany;
         infoExCompanyPath = infoCompanyPath;
         infoExCompany.CompanyId = decCompanyIdForTemp;
         infoExCompanyPath.CompanyId = decCompanyIdForTemp;
         spExCompany.CompanyEdit(infoExCompany);
         spExCompanyPath.CompanyPathEdit(infoExCompanyPath);
         PublicVariables._decCurrentCompanyId = decCompanyIdForTemp;
        this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #14
0
        /// <summary>
        /// Save function, Checking the Invalid entries
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                UserInfo infoUser    = new UserInfo();
                UserSP   spUser      = new UserSP();
                string   strUserName = txtUserName.Text.Trim();
                string   strPassword = spUser.LoginCheck(strUserName);

                if (txtOldPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter password");
                    txtOldPassword.Focus();
                }
                else if (txtNewPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter new password");
                    txtNewPassword.Focus();
                }
                else if (txtRetype.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter confirmation password");
                    txtRetype.Focus();
                }
                else if (txtNewPassword.Text != txtRetype.Text)
                {
                    Messages.InformationMessage("Password and confirm password should match");
                    txtRetype.Focus();
                    txtRetype.SelectAll();
                }
                else if (strPassword == txtOldPassword.Text.Trim())
                {
                    if (PublicVariables.isMessageAdd)
                    {
                        if (Messages.SaveMessage())
                        {
                            infoUser.UserId   = PublicVariables._decCurrentUserId;
                            infoUser.UserName = txtUserName.Text.Trim();
                            infoUser.Password = txtNewPassword.Text.Trim();
                            spUser.ChangePasswordEdit(infoUser);
                            Clear();
                            Messages.SavedMessage();
                            this.Close();
                        }
                    }
                    else
                    {
                        infoUser.UserId   = PublicVariables._decCurrentUserId;
                        infoUser.UserName = txtUserName.Text.Trim();
                        infoUser.Password = txtNewPassword.Text.Trim();
                        spUser.ChangePasswordEdit(infoUser);
                    }
                }
                else
                {
                    Messages.InformationMessage("Invalid password");
                    txtOldPassword.Focus();
                    txtOldPassword.SelectAll();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CHGPWD:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #15
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 UserInfo infoUser = new UserInfo();
                 UserSP spUser = new UserSP();
                 if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text = "Save";
                     btnDelete.Enabled = false;
                     ClearFunction();
                     GridFill();
                 }
             }
         }
         else
         {
             UserInfo infoUser = new UserInfo();
             UserSP spUser = new UserSP();
             if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text = "Save";
                 btnDelete.Enabled = false;
                 ClearFunction();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:9" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #16
0
 /// <summary>
 /// Save Function
 /// </summary>
 private void SaveFunction()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         infoUser.UserName = txtUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         if (cbxActive.Checked)
         {
             infoUser.Active = true;
         }
         else
         {
             infoUser.Active = false;
         }
         infoUser.RoleId = Convert.ToDecimal(cmbRole.SelectedValue);
         infoUser.Narration = txtNarration.Text.Trim();
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         string strUserName=txtUserName.Text.Trim();
         if (spUser.UserCreationCheckExistence(decUserId,strUserName) == false)
         {
             spUser.UserAdd(infoUser);
             Messages.SavedMessage();
             ClearFunction();
             GridFill();
             txtUserName.Focus();
         }
         else
         {
             Messages.InformationMessage("User name already exists");
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #17
0
 /// <summary>
 ///  Form load make the form controls based on settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChangePassword_Load(object sender, EventArgs e)
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         infoUser = spUser.UserView(PublicVariables._decCurrentUserId);
         txtUserName.Text = infoUser.UserName;
         txtUserName.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CHGPWD:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #18
0
        /// <summary>
        /// Save function, Checking the Invalid entries
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                UserInfo infoUser = new UserInfo();
                UserSP spUser = new UserSP();
                string strUserName = txtUserName.Text.Trim();
                string strPassword = spUser.LoginCheck(strUserName);

                if (txtOldPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter password");
                    txtOldPassword.Focus();
                }
                else if (txtNewPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter new password");
                    txtNewPassword.Focus();
                }
                else if (txtRetype.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter confirmation password");
                    txtRetype.Focus();
                }
                else if (txtNewPassword.Text != txtRetype.Text)
                {
                    Messages.InformationMessage("Password and confirm password should match");
                    txtRetype.Focus();
                    txtRetype.SelectAll();
                }
                else if (strPassword == txtOldPassword.Text.Trim())
                {
                    if (PublicVariables.isMessageAdd)
                    {
                        if (Messages.SaveMessage())
                        {
                            infoUser.UserId = PublicVariables._decCurrentUserId;
                            infoUser.UserName = txtUserName.Text.Trim();
                            infoUser.Password = txtNewPassword.Text.Trim();
                            spUser.ChangePasswordEdit(infoUser);
                            Clear();
                            Messages.SavedMessage();
                            this.Close();
                        }
                    }
                    else
                    {
                        infoUser.UserId = PublicVariables._decCurrentUserId;
                        infoUser.UserName = txtUserName.Text.Trim();
                        infoUser.Password = txtNewPassword.Text.Trim();
                        spUser.ChangePasswordEdit(infoUser);
                    }
                }
                else
                {
                    Messages.InformationMessage("Invalid password");
                    txtOldPassword.Focus();
                    txtOldPassword.SelectAll();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CHGPWD:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #19
0
 /// <summary>
 /// Function to fill controls for Update
 /// </summary>
 public void CompanyViewForEdit()
 {
     try
     {
         isEditMode = true;
         this.Text = "Edit Company";
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         gbxDetails.Visible = false;
         txtAdminUserName.ReadOnly = true;
         txtAdminUserName.BackColor = Color.White;
         cmbCurrency.Enabled = false;
         CompanySP spCompany = new CompanySP();
         CompanyInfo infoCompany = new CompanyInfo();
         decimal decCompanyId = 1;
         infoCompany = spCompany.CompanyView(decCompanyId);
         txtCompanyName.Text = infoCompany.CompanyName;
         txtMailingName.Text = infoCompany.MailingName;
         txtAddress.Text = infoCompany.Address;
         txtPhoneNo.Text = infoCompany.Phone;
         txtMobile.Text = infoCompany.Mobile;
         txtEmail.Text = infoCompany.EmailId;
         txtWeb.Text = infoCompany.Web;
         txtCountry.Text = infoCompany.Country;
         txtState.Text = infoCompany.State;
         txtPincode.Text = infoCompany.Pin;
         cmbCurrency.SelectedValue = infoCompany.CurrencyId;
         txtFinancialYearFrom.Text = infoCompany.FinancialYearFrom.ToString("dd-MMM-yyyy");
         dtpFinancialYearFrom.Text = infoCompany.FinancialYearFrom.ToString();
         txtBooksBegining.Text = infoCompany.BooksBeginingFrom.ToString("dd-MMM-yyyy");
         dtpBooksBegining.Text = infoCompany.BooksBeginingFrom.ToString();
         txtTinNo.Text = infoCompany.Tin;
         txtCstNo.Text = infoCompany.Cst;
         txtPanNo.Text = infoCompany.Pan;
         logo = (byte[])infoCompany.Logo;
         MemoryStream ms = new MemoryStream(logo);
         Image newimage = Image.FromStream(ms);
         pbxLogo.Image = newimage;
         pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathSP spComapnyPath = new CompanyPathSP();
         infoCompanyPath = spComapnyPath.CompanyPathView(1);
         if (infoCompanyPath.IsDefault == true)
         {
             cbxSetAsDefault.Checked = true;
         }
         else
         {
             cbxSetAsDefault.Checked = false;
         }
         UserSP spUser = new UserSP();
         UserInfo infoUser = new UserInfo();
         decimal decuserId = PublicVariables._decCurrentUserId;
         infoUser = spUser.UserView(decuserId);
         txtAdminUserName.Text = infoUser.UserName;
         txtPassword.Text = infoUser.Password;
         txtRetypePassword.Text = infoUser.Password;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #20
0
 /// <summary>
 /// Function to fill the values in curresponding controls for updation
 /// </summary>
 public void FillControls()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         infoUser = spUser.UserView(decUserId);
         txtUserName.Text = infoUser.UserName;
         txtPassword.Text = infoUser.Password;
         cmbRole.SelectedValue = infoUser.RoleId;
         txtNarration.Text = infoUser.Narration;
         if (infoUser.Active)
         {
             cbxActive.Checked = true;
         }
         else
         {
             cbxActive.Checked = false;
         }
         txtRetype.Text = txtPassword.Text;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #21
0
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanySP spCompany = new CompanySP();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathSP spCompanyPath = new CompanyPathSP();
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         decCurrencyIdForStatus = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         if (spCompany.CompanyCheckExistence(txtCompanyName.Text.Trim().ToString(), 0) == false)
         {
             decimal decCompanyId = spCompany.CompanyAddParticularFeilds(infoCompany);
             PublicVariables._decCurrentCompanyId = decCompanyId;
             infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
             spCompanyPath.CompanyPathAdd(infoCompanyPath);
             if (formMDI.demoProject || CreateCompany())
             {
                 if (!formMDI.demoProject)
                 {
                     infoCompanyPath.CompanyPath = strPath;
                 }
                 else
                 {
                     infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data";
                     PublicVariables._decCurrentCompanyId = 0;
                 }
                 CompanyInfo infoNewCompany = new CompanyInfo();
                 CompanySP spNewCompany = new CompanySP();
                 CompanyPathInfo infoNewCompanyPath = new CompanyPathInfo();
                 CompanyPathSP spNewCompanyPath = new CompanyPathSP();
                 UserInfo infoNewUser = new UserInfo();
                 UserSP spNewUser = new UserSP();
                 ExchangeRateInfo infoNewExchangeRate = new ExchangeRateInfo();
                 ExchangeRateSP spNewExchangeRate = new ExchangeRateSP();
                 infoNewCompany = infoCompany;
                 infoNewCompanyPath = infoCompanyPath;
                 infoNewUser = infoUser;
                 decCompanyId = spNewCompany.CompanyAddParticularFeilds(infoNewCompany);
                 spNewUser.UserAdd(infoNewUser);
                 spNewCompanyPath.CompanyPathAdd(infoNewCompanyPath);
                 Messages.SavedMessage();
                 formMDI.MDIObj.MenuStripEnabling();
                 //  To set default currencyId.............//
                 infoNewExchangeRate.CurrencyId = infoNewCompany.CurrencyId;
                 infoNewExchangeRate.Rate = 1;
                 infoNewExchangeRate.Narration = string.Empty;
                 infoNewExchangeRate.Extra1 = string.Empty;
                 infoNewExchangeRate.Extra2 = string.Empty;
                 infoNewExchangeRate.ExtraDate = System.DateTime.Now;
                 infoNewExchangeRate.Date = System.DateTime.Now;
                 spNewExchangeRate.ExchangeRateAdd(infoNewExchangeRate);
                 CurrencySP spCurrency = new CurrencySP();
                 spCurrency.DefaultCurrencySet(decCurrencyIdForStatus);
                 AfterCompanyCreation();
                 Clear();
                 this.Close();
             }
             else
             {
                 Messages.InformationMessage("Company creation failed");
             }
         }
         else
         {
             Messages.InformationMessage("Companyname already exist");
             txtCompanyName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #22
0
 /// <summary>
 /// User Creation GridFill
 /// </summary>
 public void GridFill()
 {
     try
     {
         UserSP spUser = new UserSP();
         DataTable dtblUserCreation = new DataTable();
         string strSearchUserName = txtSearchUserName.Text.Trim();
         string strSearchRole = cmbSearchRole.Text;
         dtblUserCreation = spUser.UserCreationViewForGridFill(strSearchUserName, strSearchRole);
         dgvUserCreation.DataSource = dtblUserCreation;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }