private void BtnUpdate_Click(object sender, EventArgs e) { ProductBAL PB = new ProductBAL(); if (TxtProductName.Text.Trim() != "") { PB.Product_Name = TxtProductName.Text.Trim(); if (CMBBrandValueMember != 0) { PB.Brand_ID = CMBBrandValueMember; if (TxtCost.Text.Trim() != "") { PB.Product_Cost = Convert.ToDecimal(TxtCost.Text.Trim()); if (TxtSellingRate.Text.Trim() != "") { PB.Selling_Rate = Convert.ToDecimal(TxtSellingRate.Text.Trim()); PB.Description = TxtDescription.Text.Trim(); PB.Product_ID = ProductID; ProductDAL PD = new ProductDAL(); int result = PD.UpdateProduct(PB); if (result > 0) { MessageBox.Show("Product Updated Successfully"); LoadDGVProducts(); } else { MessageBox.Show("Something Went Wrong"); } } else { MessageBox.Show("Please Enter the selling price of the product"); TxtSellingRate.Focus(); } } else { MessageBox.Show("Please Enter the Product Cost"); TxtCost.Focus(); } } else { MessageBox.Show("Please Select the Brand Name"); } } else { MessageBox.Show("Product Name cannot be blank"); TxtProductName.Focus(); } }
private void BtnAdd_Click(object sender, EventArgs e) { TxtName.Clear(); TxtQty.Clear(); TxtCost.Clear(); TxtMarkup.Clear(); TxtSetupCost.Clear(); TxtSetupHr.Clear(); TxtOptCost.Clear(); TxtOptHr.Clear(); lockAdd = false; lockModify = true; }
private void MemberClick(UInt32 MemberID_UL) { // Load client info in each control String SQLRequest_ST; SqlDataReader SqlDataReader_O; UInt32 CPID_UL = 0; UInt32 PersStatusID_UL = 0; mInitializingData_b = true; TxtTel.Clear(); DTPBirthdate.Value = DTPBirthdate.MinDate; DTPEntryDate.Value = DTPEntryDate.MinDate; TxtCost.Clear(); TxtBankAccount.Clear(); TxtRegNumber.Clear(); TxtChilds.Clear(); TxtAdress.Clear(); ComBoxFamilyState.SelectedItem = null; CheckBoxActivePartner.Checked = false; DBComboxStatus.ClearSelectedItem(); ComboxPostalCode.ClearSelectedItem(); ComboxLocality.ClearSelectedItem(); LblMemberName.Text = ""; CheckBoxActivePartner.Checked = false; DepartmentSelector.Clear(); MemberDayChickingViewer.ChangePers(0, true); TxtLogin.Clear(); bool ActivePartner_b = false; if (mDBManager_O != null && mDBManager_O.mConnected_b) { // Fill fields of member SQLRequest_ST = "SELECT * FROM Pers WHERE PersID=" + MemberID_UL; SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST); while (SqlDataReader_O.Read()) { bool.TryParse(SqlDataReader_O["ConjActif"].ToString(), out ActivePartner_b); // Fill info in panel edit controls TxtTel.Text = SqlDataReader_O["NumTel"].ToString(); try { DTPBirthdate.Value = Convert.ToDateTime(SqlDataReader_O["DateNaissance"].ToString()); } catch (FormatException e) { DTPBirthdate.Value = DTPBirthdate.MinDate; } try { DTPEntryDate.Value = Convert.ToDateTime(SqlDataReader_O["DateEntreeService"].ToString()); } catch (FormatException e) { DTPEntryDate.Value = DTPEntryDate.MinDate; } TxtCost.Text = SqlDataReader_O["CoutHeure"].ToString() + "\u20AC"; TxtBankAccount.Text = SqlDataReader_O["CompteBanq"].ToString(); TxtRegNumber.Text = SqlDataReader_O["NumRegNat"].ToString(); TxtChilds.Text = SqlDataReader_O["NbrEnfCharge"].ToString(); TxtAdress.Text = SqlDataReader_O["Adresse"].ToString(); ComBoxFamilyState.Text = SqlDataReader_O["SitFam"].ToString(); TxtLogin.Text = SqlDataReader_O["UserLogin"].ToString(); CheckBoxActivePartner.Checked = ActivePartner_b; if (UInt32.TryParse(SqlDataReader_O["PersStatutID"].ToString(), out PersStatusID_UL)) { DBComboxStatus.SelectItemByID(PersStatusID_UL); } if (UInt32.TryParse(SqlDataReader_O["CodePostalID"].ToString(), out CPID_UL)) { ComboxPostalCode.SelectItemByID(CPID_UL); ComboxLocality.SelectItemByID(CPID_UL); } else { ComboxPostalCode.ClearSelectedItem(); ComboxLocality.ClearSelectedItem(); } // Fill info in panel check controls LblMemberName.Text = SqlDataReader_O["PersNom"].ToString(); CheckBoxActivePartner.Checked = ActivePartner_b; // Refresh checking recap //int NbDays = DateTime.Today.DayOfWeek - DayOfWeek.Monday; if (!String.IsNullOrEmpty(SqlDataReader_O["PersNom"].ToString())) { MemberDayChickingViewer.ChangePers(MemberID_UL, true); } } SqlDataReader_O.Close(); // Fill associated departments SQLRequest_ST = "SELECT DepID FROM RelDepPers WHERE PersID=" + MemberID_UL; SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST); List <UInt32> DepID_UL = new List <UInt32>(); UInt32 ID_UL; while (SqlDataReader_O.Read()) { if (UInt32.TryParse(SqlDataReader_O["DepID"].ToString(), out ID_UL)) { DepID_UL.Add(ID_UL); } } DepartmentSelector.CheckDepartments(DepID_UL); SqlDataReader_O.Close(); } mInitializingData_b = false; }