protected override int SaveData() { int result = 1; BsDetail.EndEdit(); var tableChanged = dsDictionary.Customer.GetChanges(); if (tableChanged == null) { return((int)EnumResultInsertUpdate.Success); } else { if (tableChanged.Rows.Count == 0) { return((int)EnumResultInsertUpdate.Success); } } DictionaryDataSet.CustomerRow drObjectChange = (DictionaryDataSet.CustomerRow)tableChanged.Rows[0]; if (drObjectChange != null) { result = objBLDetail.InsertUpdate(drObjectChange); } return(result); }
private void FrmInvoice_Load(object sender, EventArgs e) { try { dsDictionary.EnforceConstraints = false; BLOrder oBL = new BLOrder(); var table = oBL.GetDataByID(SAInvoiceID); if (table.Rows.Count <= 0) { BLSAInvoice oBLSAInvoice = new BLSAInvoice(); table = oBLSAInvoice.GetDataByID(SAInvoiceID); // Nếu tạo mới từ Order if (SAInvoiceID != Guid.Empty) { btnSave.Visible = true; dsDictionary.Clear(); dsDictionary.SAInvoice.Merge(oBLSAInvoice.GetDataByID(SAInvoiceID), false, MissingSchemaAction.Ignore); dsDictionary.SAInvoiceDetail.Merge(oBLSAInvoice.GetDataDetailByID(SAInvoiceID), false, MissingSchemaAction.Ignore); CreateSAInvoice(); } // Nếu không phải tạo mới thì load dữ liệu else { btnSave.Visible = false; LoadSAInvoice(); } } else { // Nếu tạo mới từ Order if (SAInvoiceID != Guid.Empty) { btnSave.Visible = true; dsDictionary.Clear(); dsDictionary.Order.Merge(oBLOrder.GetDataByID(SAInvoiceID), false, MissingSchemaAction.Ignore); dsDictionary.OrderDetail.Merge(oBLOrder.GetDataDetailByID(SAInvoiceID), false, MissingSchemaAction.Ignore); CreateSAInvoice(); } // Nếu không phải tạo mới thì load dữ liệu else { btnSave.Visible = false; LoadSAInvoice(); } } if (table != null && table.Rows.Count > 0) { SAInvoiceRow = dsDictionary.SAInvoice.FirstOrDefault(); dsDictionary.Customer.Merge(new BLCustomer().GetDataByID(Guid.Parse(table.Rows[0][5].ToString()))); CustomerRow = dsDictionary.Customer.FindByCustomerID(Guid.Parse(table.Rows[0][5].ToString())); } BindingData(table); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
protected override void InitCopyRow() { base.InitNewRow(); DictionaryDataSet.CustomerRow drCurrent = (DictionaryDataSet.CustomerRow)((DataRowView)bsDetail.Current).Row; objBLDetail.InitCopyRow(DsDictionary.Customer, drCurrent); BsDetail.MoveFirst(); txtCustomerCode.Focus(); }
public DataRow InitCopyRow(DictionaryDataSet.CustomerDataTable table, DictionaryDataSet.CustomerRow row) { DictionaryDataSet.CustomerRow drNewRow = table.NewCustomerRow(); drNewRow.CustomerID = Guid.NewGuid(); drNewRow.CustomerCode = row.CustomerCode; drNewRow.CustomerName = row.CustomerName; drNewRow.Email = row.Email; drNewRow.Mobile = row.Mobile; drNewRow.Address = row.Address; drNewRow.Description = row.Description; drNewRow.Inactive = row.Inactive; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
public int InsertUpdate(DictionaryDataSet.CustomerRow drObjectChange) { ServiceResult result = CloudServiceFactory.ExecuteFunction("Customer/InsertUpdate", CommonFunction.GetItem <Customer>(drObjectChange), HeaderParameter); if (result.Success == false) { if (result.ErrorCode == ErrorCode.DuplicateCode) { return(2); } return(0); } return(1); }
/// <summary> /// Khởi tạo dữ liệu /// </summary> /// <param name="table"></param> public DataRow InitNewRow(DictionaryDataSet.CustomerDataTable table) { DictionaryDataSet.CustomerRow drNewRow = table.NewCustomerRow(); drNewRow.CustomerID = Guid.NewGuid(); drNewRow.CustomerCode = ""; drNewRow.CustomerName = ""; drNewRow.Birthday = DateTime.Now.AddYears(-10); drNewRow.Email = ""; drNewRow.Mobile = ""; drNewRow.Address = ""; drNewRow.Description = ""; drNewRow.Inactive = false; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
public bool CheckCodeExists(DictionaryDataSet.CustomerRow drObjectChange) { return(new DL.DLCustomer(Session.Token).CheckCodeExists(drObjectChange)); }
public int InsertUpdate(DictionaryDataSet.CustomerRow drObjectChange) { return(new DL.DLCustomer(Session.Token).InsertUpdate(drObjectChange)); }
public bool CheckCodeExists(DictionaryDataSet.CustomerRow drObjectChange) { ServiceResult result = CloudServiceFactory.ExecuteFunction("Customer/CheckCodeExists", CommonFunction.GetItem <Customer>(drObjectChange), HeaderParameter); return(result.Success); }