Ejemplo n.º 1
0
        private void salesToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmSales frm = new frmSales();

            frm.lblUser.Text = lblUser.Text;
            frm.Reset();
            frm.Show();
        }
Ejemplo n.º 2
0
 private void dgw_MouseClick(object sender, MouseEventArgs e)
 {
     try
     {
         if (lblOperation.Text == "Sales")
         {
             DataGridViewRow dr = dgw.SelectedRows[0];
             this.Hide();
             frmSales frm = new frmSales();
             frm.Show();
             frm.txtID.Text           = dr.Cells[0].Value.ToString();
             frm.txtBillNo.Text       = dr.Cells[1].Value.ToString();
             frm.dtpBillDate.Text     = dr.Cells[2].Value.ToString();
             frm.txtC_Id.Text         = dr.Cells[3].Value.ToString();
             frm.txtCustomerID.Text   = dr.Cells[4].Value.ToString();
             frm.txtCustomerName.Text = dr.Cells[5].Value.ToString();
             frm.txtGrandTotal.Text   = dr.Cells[6].Value.ToString();
             frm.txtCash.Text         = dr.Cells[7].Value.ToString();
             frm.txtChange.Text       = dr.Cells[8].Value.ToString();
             frm.btnUpdate.Enabled    = true;
             frm.btnDelete.Enabled    = true;
             frm.btnSave.Enabled      = false;
             frm.lblUser.Text         = lblUser.Text;
             lblOperation.Text        = "";
             cc.con = new SqlConnection(cs.DBConn);
             cc.con.Open();
             cc.cmd = new SqlCommand("SELECT RTRIM(ProductSold.ProductID),RTRIM(ProductName),RTRIM(ProductSold.Price),RTRIM(Quantity),RTRIM(Amount),RTRIM(DiscountPer), RTRIM(DiscountAmount), RTRIM(STPer), RTRIM(STAmount), RTRIM(VATPer), RTRIM(VATAmount),RTRIM(TotalAmount) from Product,OrderedProduct,ProductSold where Product.P_ID=ProductSold.ProductID and Orderedproduct.B_ID=ProductSold.BillID and BillNo='" + dr.Cells[1].Value + "'", cc.con);
             cc.rdr = cc.cmd.ExecuteReader(CommandBehavior.CloseConnection);
             frm.DataGridView1.Rows.Clear();
             while (cc.rdr.Read() == true)
             {
                 frm.DataGridView1.Rows.Add(cc.rdr[0], cc.rdr[1], cc.rdr[2], cc.rdr[3], cc.rdr[4], cc.rdr[5], cc.rdr[6], cc.rdr[7], cc.rdr[8], cc.rdr[9], cc.rdr[10]);
             }
             cc.con.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
 private void dgw_MouseClick(object sender, MouseEventArgs e)
 {
     try
     {
         if (lblOperation.Text == "Customer Master")
         {
             DataGridViewRow dr = dgw.SelectedRows[0];
             this.Hide();
             frmCustomer frm = new frmCustomer();
             frm.Show();
             frm.txtID.Text           = dr.Cells[0].Value.ToString();
             frm.txtCustomerID.Text   = dr.Cells[1].Value.ToString();
             frm.txtCustomerName.Text = dr.Cells[2].Value.ToString();
             frm.txtAddress.Text      = dr.Cells[3].Value.ToString();
             frm.txtCity.Text         = dr.Cells[4].Value.ToString();
             frm.txtContactNo.Text    = dr.Cells[5].Value.ToString();
             frm.txtEmailID.Text      = dr.Cells[6].Value.ToString();
             byte[]       data = (byte[])dr.Cells[7].Value;
             MemoryStream ms   = new MemoryStream(data);
             frm.Picture.Image     = Image.FromStream(ms);
             frm.btnUpdate.Enabled = true;
             frm.btnDelete.Enabled = true;
             frm.btnSave.Enabled   = false;
             frm.lblUser.Text      = lblUser.Text;
             lblOperation.Text     = "";
         }
         if (lblOperation.Text == "Membership")
         {
             DataGridViewRow dr = dgw.SelectedRows[0];
             this.Hide();
             frmCustomerMembership frm = new frmCustomerMembership();
             frm.Show();
             frm.txtM_ID.Text       = dr.Cells[0].Value.ToString();
             frm.txtMemberName.Text = dr.Cells[2].Value.ToString();
             frm.txtAddress.Text    = dr.Cells[3].Value.ToString();
             frm.txtCity.Text       = dr.Cells[4].Value.ToString();
             frm.txtContactNo.Text  = dr.Cells[5].Value.ToString();
             frm.txtEmailID.Text    = dr.Cells[6].Value.ToString();
             byte[]       data = (byte[])dr.Cells[7].Value;
             MemoryStream ms   = new MemoryStream(data);
             frm.Picture.Image = Image.FromStream(ms);
             frm.lblUser.Text  = lblUser.Text;
             lblOperation.Text = "";
             frm.auto();
         }
         if (lblOperation.Text == "Sales")
         {
             DataGridViewRow dr = dgw.SelectedRows[0];
             this.Hide();
             frmSales frm = new frmSales();
             frm.Show();
             frm.txtC_Id.Text         = dr.Cells[0].Value.ToString();
             frm.txtCustomerID.Text   = dr.Cells[1].Value.ToString();
             frm.txtCustomerName.Text = dr.Cells[2].Value.ToString();
             frm.lblUser.Text         = lblUser.Text;
             lblOperation.Text        = "";
             frm.auto();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }