public MainWindow(User user)
        {
            InitializeComponent();
            MainWindow.user = user;
            userName.Text   = MainWindow.user.username;
            if (MainWindow.user.admin)
            {
                userPermissions.Text = "Administrator";
            }
            else
            {
                userPermissions.Text = "User";
            }

            m_dashboard  = new Dashboard();
            m_invoice    = new InvoiceMain();
            m_receipt    = new ReceiptMain();
            m_creditNote = new CreditNoteMain();
            m_statement  = new StatementMain(this);
            m_product    = new ProductMain();
            m_customer   = new CustomerMain();
            m_quote      = new QuoteMain();
            m_expenses   = new ExpensesMain();
            m_settings   = new SettingsMain();
            m_order      = new OrderMain(this);

            BtnDashboard_Click(null, null);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lnkHusWifeBack_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            ExpensesMain expenses = new ExpensesMain();

            expenses.Show();
        }
Exemple #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUser.Text == string.Empty)
            {
                errorProvider1.SetError(txtUser, XmlFunction.GetMessageById(istrPath, Constant.Common.ENTITY_NAME, Constant.Error.ERROR_2));
            }

            if (txtpassword.Text == string.Empty)
            {
                errorProvider1.SetError(txtpassword, XmlFunction.GetMessageById(istrPath, Constant.Common.ENTITY_NAME, Constant.Error.ERROR_3));
            }

            if (txtUser.Text != string.Empty && txtpassword.Text != string.Empty)
            {
                errorProvider1.Clear();
                string str = XmlFunction.GetQueriesById(istrPath, Constant.Common.ENTITY_NAME, Constant.Query.GET_USER_INFO);
                str = String.Format(str, txtUser.Text, txtpassword.Text);

                string result = DBFunction.FetchScalarFromDatabase(Constant.Common.DATABASE_NAME, str);
                if (result != string.Empty && Convert.ToInt32(result) > 0)
                {
                    Login.UserId = Convert.ToInt32(result);
                    if (checkBoxRemember.Checked)
                    {
                        str = XmlFunction.GetQueriesById(istrPath, Constant.Common.ENTITY_NAME, Constant.Query.UPDATE_REMEMBER_ME_CODE_VALUE);
                        str = String.Format(str, Login.UserId);
                        DBFunction.UpdateTable(Constant.Common.DATABASE_NAME, str);
                    }
                    this.Hide();
                    ExpensesMain form1 = new ExpensesMain();
                    form1.Show();
                }
                else
                {
                    MessageBox.Show(XmlFunction.GetMessageById(istrPath, Constant.Common.ENTITY_NAME, Constant.Error.ERROR_1));
                }
            }
        }