private void dgw_MouseClick(object sender, MouseEventArgs e) { try { DataGridViewRow dr = dgw.SelectedRows[0]; this.Hide(); frmFitnessMeasure frm = new frmFitnessMeasure(); frm.Show(); frm.txtID.Text = dr.Cells[0].Value.ToString(); frm.txtM_ID.Text = dr.Cells[1].Value.ToString(); frm.txtMembershipID.Text = dr.Cells[2].Value.ToString(); frm.txtMembershipType.Text = dr.Cells[3].Value.ToString(); frm.txtMemberName.Text = dr.Cells[5].Value.ToString(); frm.txtCity.Text = dr.Cells[6].Value.ToString(); frm.txtAddress.Text = dr.Cells[7].Value.ToString(); frm.dtpDateFrom.Text = dr.Cells[8].Value.ToString(); frm.dtpDateTo.Text = dr.Cells[9].Value.ToString(); frm.dtpDate.Text = dr.Cells[10].Value.ToString(); frm.txtBodyWeight.Text = dr.Cells[11].Value.ToString(); frm.txtBodyFat.Text = dr.Cells[12].Value.ToString(); frm.txtBodyMass.Text = dr.Cells[13].Value.ToString(); byte[] data = (byte[])dr.Cells[14].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 = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void metroTile4_Click(object sender, EventArgs e) { frmFitnessMeasure frm = new frmFitnessMeasure(); frm.lblUser.Text = lblUser.Text; frm.Reset(); frm.Show(); }
private void fitnessMeasureToolStripMenuItem1_Click(object sender, EventArgs e) { frmFitnessMeasure frm = new frmFitnessMeasure(); frm.lblUser.Text = lblUser.Text; frm.Reset(); frm.Show(); }
private void dgw_MouseClick(object sender, MouseEventArgs e) { try { if (lblOperation.Text == "Customer Membership") { DataGridViewRow dr = dgw.SelectedRows[0]; this.Hide(); frmCustomerMembership frm = new frmCustomerMembership(); frm.Show(); frm.txtID.Text = dr.Cells[0].Value.ToString(); frm.txtMembershipID.Text = dr.Cells[1].Value.ToString(); frm.dtpBillDate.Text = dr.Cells[2].Value.ToString(); frm.txtMemberID.Text = dr.Cells[3].Value.ToString(); frm.txtMembershipTypeID.Text = dr.Cells[5].Value.ToString(); frm.cmbMembershipType.Text = dr.Cells[6].Value.ToString(); frm.dtpDateFrom.Text = dr.Cells[7].Value.ToString(); frm.txtMonths.Text = dr.Cells[8].Value.ToString(); frm.dtpDateTo.Text = dr.Cells[9].Value.ToString(); frm.txtChargesPerMonth.Text = dr.Cells[10].Value.ToString(); frm.txtTotalCharges.Text = dr.Cells[11].Value.ToString(); frm.txtDiscountPer.Text = dr.Cells[12].Value.ToString(); frm.txtDiscountAmount.Text = dr.Cells[13].Value.ToString(); frm.txtSubTotal.Text = dr.Cells[14].Value.ToString(); frm.txtVATPer.Text = dr.Cells[15].Value.ToString(); frm.txtVATAmount.Text = dr.Cells[16].Value.ToString(); frm.txtServiceTaxPer.Text = dr.Cells[17].Value.ToString(); frm.txtServiceTaxAmount.Text = dr.Cells[18].Value.ToString(); frm.txtGrandTotal.Text = dr.Cells[19].Value.ToString(); frm.txtTotalPaid.Text = dr.Cells[20].Value.ToString(); frm.txtBalance.Text = dr.Cells[21].Value.ToString(); frm.btnUpdate.Enabled = true; frm.btnDelete.Enabled = true; frm.btnSave.Enabled = false; frm.dtpBillDate.Enabled = false; frm.lblUser.Text = lblUser.Text; lblOperation.Text = ""; cc.con = new SqlConnection(cs.DBConn); cc.con.Open(); cc.cmd = cc.con.CreateCommand(); cc.cmd.CommandText = "SELECT C_ID,Name,Address,City,ContactNo,Email,Photo from Customer where CustomerID='" + dr.Cells[3].Value + "'"; cc.rdr = cc.cmd.ExecuteReader(); if (cc.rdr.Read()) { frm.txtM_ID.Text = cc.rdr.GetValue(0).ToString().Trim(); frm.txtMemberName.Text = cc.rdr.GetValue(1).ToString().Trim(); frm.txtAddress.Text = cc.rdr.GetValue(2).ToString().Trim(); frm.txtCity.Text = cc.rdr.GetValue(3).ToString().Trim(); frm.txtContactNo.Text = cc.rdr.GetValue(4).ToString().Trim(); frm.txtEmailID.Text = cc.rdr.GetValue(5).ToString().Trim(); byte[] data = (byte[])cc.rdr.GetValue(6); MemoryStream ms = new MemoryStream(data); frm.Picture.Image = Image.FromStream(ms); } if ((cc.rdr != null)) { cc.rdr.Close(); } if (cc.con.State == ConnectionState.Open) { cc.con.Close(); } } if (lblOperation.Text == "Fitness Measure") { DataGridViewRow dr = dgw.SelectedRows[0]; this.Hide(); frmFitnessMeasure frm = new frmFitnessMeasure(); frm.Show(); frm.txtM_ID.Text = dr.Cells[0].Value.ToString(); frm.txtMembershipID.Text = dr.Cells[1].Value.ToString(); frm.txtMembershipType.Text = dr.Cells[6].Value.ToString(); frm.dtpDateFrom.Text = dr.Cells[7].Value.ToString(); frm.dtpDateTo.Text = dr.Cells[9].Value.ToString(); frm.lblUser.Text = lblUser.Text; lblOperation.Text = ""; frm.auto(); cc.con = new SqlConnection(cs.DBConn); cc.con.Open(); cc.cmd = cc.con.CreateCommand(); cc.cmd.CommandText = "SELECT C_ID,Name,Address,City,ContactNo,Email,Photo from Customer where CustomerID='" + dr.Cells[3].Value + "'"; cc.rdr = cc.cmd.ExecuteReader(); if (cc.rdr.Read()) { frm.txtMemberName.Text = cc.rdr.GetValue(1).ToString().Trim(); frm.txtAddress.Text = cc.rdr.GetValue(2).ToString().Trim(); frm.txtCity.Text = cc.rdr.GetValue(3).ToString().Trim(); byte[] data = (byte[])cc.rdr.GetValue(6); MemoryStream ms = new MemoryStream(data); frm.Picture.Image = Image.FromStream(ms); } if ((cc.rdr != null)) { cc.rdr.Close(); } if (cc.con.State == ConnectionState.Open) { cc.con.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }