private void btn_Update_Click(object sender, EventArgs e) { if (txt_Name.Text == "") { messeage.error("Bạn chưa nhập Tên Vật Tư !"); } else { if (idGroup == 0) { messeage.error("Bạn chưa chọn Nhóm Vật Tư !"); } else { if (idUnit == 0) { messeage.error("Bạn chưa chọn Đơn Vị Vật Tư !"); } else { if (idVender == 0) { messeage.error("Bạn chưa chọn Nhà Cung Cấp !"); } else { if (txt_InPutPrice.Text == "") { messeage.error("Bạn chưa nhập Giá nhập !"); } else { if (txt_OutPutPrice.Text == "") { messeage.error("Bạn chưa nhập Giá bán !"); } else { if (txt_Ton.Text == "") { messeage.error("Bạn chưa số lượng Tồn kho !"); } else { ST_supply sup = new ST_supply( ); sup.supplies_id = id_Suppliesc; sup.group_supplies_id = Int64.Parse(lue_GroupSuplies.EditValue.ToString( ));;; sup.unit_id = Int64.Parse(lue_Units.EditValue.ToString()); sup.vendor_id = Int64.Parse(lue_Vender.EditValue.ToString( ));; sup.supplies_name = txt_Name.Text; sup.supplies_description = txt_Description.Text; sup.supplies_entry_price = Decimal.Parse(txt_InPutPrice.Text); sup.supplies_commercial_price = Decimal.Parse(txt_OutPutPrice.Text); sup.supplies_survive_the_norm = Int16.Parse(txt_Ton.Text); Decimal price_Giam = 0; if (txt_PriceGiam.Text == "") { price_Giam = 0; } else { price_Giam = Decimal.Parse(txt_PriceGiam.Text); } sup.supplies_wholesale_price = price_Giam; if (linkImage != "") { sup.supplies_image = imageToByteArray(pic_Logo.Image); } bool bUpdate = _sup.updateSuplies(sup); if (bUpdate) { messeage.success("Cập Nhật Thành Công !"); } else { messeage.error("Không Thể Cập Nhật"); } } } } } } } } }
// Them Moi private void btn_AddNew_Click(object sender, EventArgs e) { if (txt_Name.Text == "") { messeage.error("Bạn chưa nhập Tên Vật Tư !"); } else { if (idGroup == 0) { messeage.error("Bạn chưa chọn Nhóm Vật Tư !"); } else { if (idUnit == 0) { messeage.error("Bạn chưa chọn Đơn Vị Vật Tư !"); } else { if (idVender == 0) { messeage.error("Bạn chưa chọn Nhà Cung Cấp !"); } else { if (txt_InPutPrice.Text == "") { messeage.error("Bạn chưa nhập Giá nhập !"); } else { if (txt_OutPutPrice.Text == "") { messeage.error("Bạn chưa nhập Giá bán !"); } else { if (txt_Ton.Text == "") { messeage.error("Bạn chưa số lượng Tồn kho !"); } else { ST_supply sup = new ST_supply(); sup.group_supplies_id = idGroup; sup.unit_id = idUnit; sup.vendor_id = idVender; sup.supplies_name = txt_Name.Text; sup.supplies_description = txt_Description.Text; sup.supplies_entry_price = Decimal.Parse(txt_InPutPrice.Text); sup.supplies_commercial_price = Decimal.Parse(txt_OutPutPrice.Text); sup.supplies_survive_the_norm = Int16.Parse(txt_Ton.Text); Decimal price_Giam = 0; if (txt_PriceGiam.Text == "") { price_Giam = 0; } else { price_Giam = Decimal.Parse(txt_PriceGiam.Text); } sup.supplies_wholesale_price = price_Giam; sup.employee_created = frm_Main.Vitual_id; if (linkImage != "") { sup.supplies_image = imageToByteArray(pic_Logo.Image); } bool bInsert = _sup.insertSuplies(sup); if (bInsert) { messeage.success("Thêm Mới Thành Công !"); this.Close(); } else { messeage.error("Không Thể Thêm Mới"); } } } } } } } } }