Esempio n. 1
0
 /// <summary>
 /// Form closing event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmNewFinancialYear_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (frmCompanyCreationObj != null)
         {
             if (isSave)
             {
                 frmChangeCurrentDate frmChangeCurrenttDateObj = new frmChangeCurrentDate();
                 frmChangeCurrenttDateObj.MdiParent = formMDI.MDIObj;
                 frmCompanyCreation CompanyCreationObj = new frmCompanyCreation();
                 CompanyCreationObj    = frmCompanyCreationObj;
                 frmCompanyCreationObj = null;
                 frmChangeCurrenttDateObj.CallFromNewFinancialYear(CompanyCreationObj);
             }
             else
             {
                 e.Cancel = true;
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "NFY 13 : " + ex.Message;
     }
 }
Esempio n. 2
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 = "Oneaccount " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]";
                    // For showing the Oneaccount 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
                {
                    lblError.Visible = true;
                    Clear();
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "LOGIN1:" + ex.Message;
            }
        }