Esempio n. 1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtUserName.Text != string.Empty && txtPassword.Text != string.Empty)
         {
             string    strUserName = txtUserName.Text;
             string    strPassword = _crypt.Encrypt(txtPassword.Text);
             DataTable dtUsers     = _repoLogin.ValidateUser(strUserName, strPassword);
             if (dtUsers != null && dtUsers.Rows.Count > 0)
             {
                 GlobalVariables.glbUserId = Convert.ToInt32(dtUsers.Rows[0]["UserId"].ToString());
                 GlobalVariables.glbName   = dtUsers.Rows[0]["Name"].ToString();
                 GlobalVariables.glbroleId = Convert.ToInt32(dtUsers.Rows[0]["UserType"].ToString());
                 lblNotify.Visible         = false;
                 if (Convert.ToString(dtUsers.Rows[0]["UserType"]) == "1")
                 {
                     this.Hide();
                     using (Parent frmParent = new Parent())
                     {
                         frmParent.ShowDialog();
                     }
                     this.Close();
                 }
                 else if (Convert.ToString(dtUsers.Rows[0]["UserType"]) == "2")
                 {
                     this.Hide();
                     using (Parent frmParent = new Parent())
                     {
                         frmParent.invoiceToolStripMenuItem.Visible = false;
                         //frmParent.OrderToolStripMenuItem.Visible = false;
                         frmParent.usersToolStripMenuItem.Visible         = false;
                         frmParent.reportsToolStripMenuItem.Visible       = false;
                         frmParent.stockMenuItem.Visible                  = false;
                         frmParent.registrationToolStripMenuItem2.Visible = false;
                         frmParent.chartMenuItem.Visible                  = false;
                         frmParent.ShowDialog();
                     }
                     this.Close();
                 }
             }
             else
             {
                 lblNotify.Text    = ".. Invalid user!";
                 lblNotify.Visible = true;
                 txtPassword.Clear();
             }
         }
         else
         {
             lblNotify.Text    = "Please Enter Username && password";
             lblNotify.Visible = true;
         }
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("Login", "btnLogin_Click", ex.Message);
     }
 }
Esempio n. 2
0
 private void SubCategory_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dtSubcat = _objSubCat.GetAllSubCategory();
         if (dtSubcat != null)
         {
             dataGridView1.DataSource = dtSubcat;
         }
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("Sub_Category", "SubCategory_Load", ex.Message);
     }
 }
Esempio n. 3
0
 private void btnProduct_Click(object sender, EventArgs e)
 {
     try
     {
         using (CreateProduct createProduct = new CreateProduct())
         {
             createProduct.MdiParent = this.MdiParent;
             createProduct.ShowDialog();
         }
         loadData();
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("Products", "btnProduct_Click", ex.Message);
     }
 }
Esempio n. 4
0
 private void frmSplash_Shown(object sender, EventArgs e)
 {
     try
     {
         tmr = new Timer();
         //set time interval 3 sec
         tmr.Interval = 100;
         //starts the timer
         tmr.Start();
         tmr.Tick += tmr_Tick;
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmSplash", "frmSplash_Shown", ex.Message);
     }
 }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         openFileDialog1.Filter = "jpeg|*.jpg|bmp|*.bmp|all files|*.*";
         DialogResult res = openFileDialog1.ShowDialog();
         if (res == DialogResult.OK)
         {
             pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
         }
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("CreateCategory", "button1_Click", ex.Message);
     }
 }
Esempio n. 6
0
        public void loadData()
        {
            DataTable dtcat = new DataTable("tblCategory");

            try
            {
                dtcat = _objCat.GetAllCategories();
                if (dtcat != null)
                {
                    dataGridView1.DataSource = dtcat;
                }
                //setGridStyle();
            }
            catch (Exception ex)
            {
                _errorLogs.LogErrors("Category", "Category_Load", ex.Message);
            }
        }
Esempio n. 7
0
 //fillCustomerChart method
 private void fillCustomerChart()
 {
     try
     {
         DataTable dtCustomerChart = _repoChart.getCustomerChart();
         chartCustomer.DataSource = dtCustomerChart;
         chartCustomer.Series.Add("Price");
         chartCustomer.Name = "Price";
         //set the member of the chart data source used to data bind to the X-values of the series
         chartCustomer.Series["Price"].XValueMember = "Name";
         //set the member columns of the chart data source used to data bind to the X-values of the series
         chartCustomer.Series["Price"].YValueMembers = "Price";
         chartCustomer.Titles.Add("Customer Report Chart");
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmChart", "fillCustomerChart", ex.Message);
     }
 }
Esempio n. 8
0
 private void frmStocks_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dtProducts = _repoProduct.GetAllProducts();
         DataRow   dr         = dtProducts.NewRow();
         dr["ProductId"] = 0;
         dr["Name"]      = "--Select Product--";
         dtProducts.Rows.InsertAt(dr, 0);
         cmbProducts.DisplayMember = "Name";
         cmbProducts.ValueMember   = "ProductId";
         cmbProducts.DataSource    = dtProducts;
         dtpStockDate.MaxDate      = DateTime.Now;
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmStocks", "frmStocks_Load", ex.Message);
     }
 }
Esempio n. 9
0
 private void BindCategory()
 {
     try
     {
         DataTable dtCategory = _repoProduct.getCategories();
         DataRow   dr         = dtCategory.NewRow();
         dr["CategoryId"] = 0;
         dr["Name"]       = "Select Category";
         dtCategory.Rows.InsertAt(dr, 0);
         if (dtCategory != null)
         {
             cbCategory.DataSource    = dtCategory;
             cbCategory.ValueMember   = "CategoryId";
             cbCategory.DisplayMember = "Name";
         }
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("CreateProduct", "BindCategory", ex.Message);
     }
 }
Esempio n. 10
0
 private void frmRegistration_Load(object sender, EventArgs e)
 {
     try
     {
         bindUserType();
         txtName.Focus();
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmRegistration", "frmRegistration_Load", ex.Message);
     }
 }
Esempio n. 11
0
 private void Print_Load(object sender, EventArgs e)
 {
     try
     {
         lblInvoiceDate.Text = System.DateTime.Now.ToShortDateString();
         dgvInvoice.Columns["Status"].Visible = false;
         StrikeOutInActiveProduct();
         //Add a Panel control.
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("Print", "Print_Load", ex.Message);
     }
 }
Esempio n. 12
0
 private void frmInvoice_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dtProducts = _repoProduct.GetAllProducts();
         dtpInvoiceDate.MaxDate = DateTime.Now; //Minimum Date is today
         //dtpInvoiceDate.MinDate = DateTime.Now.AddMonths(1); //Maximum Date is 1 month from today
         Int64 InvoiceNo = _repoInvoice.getInvoiceIdentity() + 1;
         txtInvoiceNo.Text = InvoiceNo.ToString();
         AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection();
         foreach (DataRow row in dtProducts.Rows)
         {
             MyCollection.Add(row["Name"].ToString() + "|" + row["ProductId"].ToString());
         }
         //AutoCompleteStringCollection data = new AutoCompleteStringCollection();
         //data.Add("Mahesh Chand");
         //data.Add("Mac Jocky");
         //data.Add("Millan Peter");
         txtProductName.AutoCompleteCustomSource = MyCollection;
         GridStructure();
         dataGridView1.Height = 400;
         txtProductName.Focus();
         cmbCashCard.SelectedIndex = cmbCashCard.FindStringExact("Cash");
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmInvoice", "frmInvoice_Load", ex.Message);
     }
     finally
     {
     }
 }
Esempio n. 13
0
 private void Parent_Load(object sender, EventArgs e)
 {
     try
     {
         this.Location = new Point(0, 0);
         this.Size     = Screen.PrimaryScreen.WorkingArea.Size;
         lblName.Text  = "Welcome: " + GlobalVariables.glbName.ToString();
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("Parent", "Parent_Load", ex.Message);
     }
 }