public int updateDeliveryAddr(DeliveryAddr addr, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.DeliveryAddrs.Add(addr); break; case DataActionMode.Edit: var _addr = getAddrById(addr.id); _addr.Address = addr.Address; _addr.City = addr.City; _addr.ContactName = addr.ContactName; _addr.Country = addr.Country; _addr.email = addr.email; _addr.fax = addr.fax; _addr.mobile = addr.mobile; _addr.phone = addr.phone; _addr.Province = addr.Province; _addr.Zipcode = addr.Zipcode; break; } return(_context.SaveChanges()); } catch { return(0); } }
private void updateItemMaster(data.ItemMaster item, DataActionMode mode) { if (new ItemMasterDAL().updateItemMaster(item, mode) > 0) { if (_itemPicMode == DataActionMode.Add) { if (picMaster.Image != null) { _itemMasterPic = new ItemMasterPic(); _itemMasterPic.ItemNo = _itemMaster.ItemNo; _itemMasterPic.ItemPic = picMaster.Image.ImageToByte(); updateItemPicture(_itemMasterPic, _itemPicMode); } } else if (_itemPicMode == DataActionMode.Edit) // item picture in edit mode { if (picMaster.Image == null) { if (_itemPicMode == DataActionMode.Edit) { if (new ItemMasterPicDAL().removeItemMasterPic(_itemMaster.ItemNo) <= 0) { } } } else { _itemMasterPic.ItemPic = picMaster.Image.ImageToByte(); updateItemPicture(_itemMasterPic, _itemPicMode); } } } }
public int UpdateStockIssue(SKIssueH issue, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.SKIssueHs.Add(issue); break; case DataActionMode.Edit: var _issue = GetIssueInfo(issue.ISSUE_NUM); _issue.IsPosted = issue.IsPosted; _issue.IssueDate = issue.IssueDate; _issue.IssuedBy = issue.IssuedBy; _issue.ModifyBy = issue.ModifyBy; _issue.ModifyDate = issue.ModifyDate; _issue.PostedBy = issue.PostedBy; _issue.PostedDate = issue.PostedDate; _issue.Reason = issue.Reason; _issue.Remark = issue.Remark; _issue.TotalCost = issue.TotalCost; _issue.TotalPrice = issue.TotalPrice; break; } return(_context.SaveChanges()); } catch { return(0); } }
public int UpdateIssueItem(SKIssueItem item, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.SKIssueItems.Add(item); break; case DataActionMode.Edit: var _item = GetIssueItemInfo(item.Id); _item.Currency = item.Currency; _item.IsPosted = item.IsPosted; _item.IssueQty = item.IssueQty; _item.ItemId = item.ItemId; _item.ItemName = item.ItemName; _item.ItemNo = item.ItemNo; _item.UnitPrice = item.UnitPrice; _item.UnitCost = item.UnitCost; _item.TotalItemCost = item.TotalItemCost; _item.TotalItemPrice = item.TotalItemPrice; _item.Unit = item.Unit; break; } return(_context.SaveChanges()); } catch { return(0); } }
public int UpdateSKU(SKU sku, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.SKUs.Add(sku); break; case DataActionMode.Edit: var _sku = GetSKUbyId(sku.SKUCode); _sku.SKUCode = sku.SKUCode; _sku.SKUDetail = sku.SKUDetail; _sku.ConvertFactor = sku.ConvertFactor; break; } return(_context.SaveChanges()); } catch { return(0); } }
private void updateItemPicture(ItemMasterPic item, DataActionMode mode) { if (new ItemMasterPicDAL().updateItemMasterPic(_itemMasterPic, _itemPicMode) > 0) { MessageBox.Show("Update Item master successfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public int AddOrUpdateOrder(OrderHH order, DataActionMode mode) { switch (mode) { case DataActionMode.Add: _context.OrderHHs.Add(order); break; case DataActionMode.Edit: var _order = GetOrderById(order.OrderId); _order.CollectionDate = order.CollectionDate; _order.CreditTerm = order.CreditTerm; _order.Currency = order.Currency; _order.CustomerCode = order.CustomerCode; _order.CustomerName = order.CustomerName; _order.DeliveryAddr = order.DeliveryAddr; _order.Duedate = order.Duedate; _order.InvoiceDate = order.InvoiceDate; _order.InvoiceNo = order.InvoiceNo; _order.ModifyBy = order.ModifyBy; _order.ModifyDate = order.ModifyDate; _order.OrderAmount = order.OrderAmount; _order.OrderDate = order.OrderDate; _order.OrderStatus = order.OrderStatus; break; } return(_context.SaveChanges()); }
private void tsbtnAddAddr_Click(object sender, EventArgs e) { _addr = new DeliveryAddr(); _addr.CustCode = txtCustomerCode.Text; _addrMode = DataActionMode.Add; deliveryAddrInfo(_addr, _custMode, _addrMode); }
public int UpdateUser(DataActionMode mode, User user) { int _result = 0; try { switch (mode) { case DataActionMode.Add: _context.Users.Add(user); break; case DataActionMode.Edit: var u = GetUserByName(user.Username); u.IsActive = user.IsActive; u.Password = user.Password; u.PermissionClass = user.PermissionClass; u.PermissionName = user.PermissionName; u.Username = user.Username; break; } _result = _context.SaveChanges(); } catch (Exception ex) { _result = 0; } return(_result); }
private void updateVendorInfo(DataActionMode mode) { _vendor.Address = txtAddress.Text; _vendor.City = txtCity.Text; _vendor.ContactName = txtContactName.Text; _vendor.Country = txtCountry.Text; _vendor.Currency = cbxCurrency.Text; _vendor.email = txtEmail.Text; _vendor.Fax = txtFax.Text; _vendor.Isactive = chkIsActive.Checked; _vendor.mobile = txtMobile.Text; _vendor.Province = txtProvince.Text; _vendor.Tel = txtPhone.Text; _vendor.VendorCode = txtVendorCode.Text; _vendor.VendorName = txtVendorName.Text; _vendor.website = txtWebsite.Text; _vendor.Zipcode = txtZipCode.Text; int _result = new VendorDAL().UpdateVendor(_vendor, _mode); if (_result > 0) { MessageBox.Show("Vendor record update successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public SKUinfo(string SKUCode) { InitializeComponent(); _skuCode = SKUCode; _mode = String.IsNullOrEmpty(_skuCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); }
public WHLocInfo(string Code) { InitializeComponent(); _whCode = Code; _mode = String.IsNullOrEmpty(_whCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); }
public AccountGroupInfo(string AccountCode) { InitializeComponent(); _mode = String.IsNullOrEmpty(AccountCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); GetAccountInfo(AccountCode); }
public ItemCatInfo(string CatCode) { InitializeComponent(); _catCode = CatCode; _mode = String.IsNullOrEmpty(_catCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); }
public CurrencyInfo(string currencyCode) { InitializeComponent(); updateLanguage(); _currencyCode = currencyCode; _mode = String.IsNullOrEmpty(_currencyCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = vars.LANG_USE != "EN" ? _mode.ToString() : _mode.ToString(); }
public UOMInfo(string UOMName) { InitializeComponent(); _mode = String.IsNullOrEmpty(UOMName) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); GetUOMInfo(UOMName); }
public ExchangeInfo(string code, int exchangeId) { InitializeComponent(); updateLanguage(); _code = code; _exchangeId = exchangeId; _mode = _exchangeId == 0 ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); }
public LangItem(string keyWord) { InitializeComponent(); _keyword = keyWord; _mode = String.IsNullOrEmpty(keyWord) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); GetItemLanguageInfo(_keyword); }
public SysConfig(DataActionMode mode) { InitializeComponent(); updateLangauge(); _mode = mode; lbMode.Text = _mode.ToString(); getLang(); }
public MemberInfo(string UserName) { InitializeComponent(); _mode = String.IsNullOrEmpty(UserName) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); GetPermissions(); GetUserInfo(UserName); }
public AddrInfo(DeliveryAddr addr, DataActionMode custMode, DataActionMode addrMode) { InitializeComponent(); Address = addr; _custMode = custMode; _addrMode = addrMode; lbMode.Text = _addrMode.ToString(); lbCustomerCode.Text = Address.CustCode; }
public VendorInfo(string vendorCode) { InitializeComponent(); _vendorCode = vendorCode; _mode = String.IsNullOrEmpty(vendorCode) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); getCurrency(); getVendorStatus(); getVendorType(); }
private void btnPostSave_Click(object sender, EventArgs e) { _doPosted = true; _mode = DataActionMode.Edit; _issueH.IsPosted = _doPosted; _issueH.PostedBy = vars.USER_NAME; _issueH.PostedDate = DateTime.Now; _issueH.ModifyBy = vars.USER_NAME; _issueH.ModifyDate = DateTime.Now; UpdateStockIssue(_issueH, _mode); }
public StockReceiveItem(string SKCode, string DocNum, int recordId, int ItemId, DataActionMode docMode) { InitializeComponent(); _docMode = docMode; _SKCode = SKCode; _docNo = DocNum; _itemId = ItemId; _recordId = recordId; _mode = (recordId == 0 ? DataActionMode.Add : DataActionMode.Edit); lbCode.Text = _SKCode; lbDocId.Text = _docNo; grpItem.Text = $"Stock Item [{_mode.ToString()}]"; getUnits(); }
public SysSetting(string ProfileId, DataActionMode Mode = DataActionMode.Add) { InitializeComponent(); getLang(); getHomeCurrency(); getSourchCurrency(); getUOMs(); getWarehouses(); getCreditTerm(); _mode = Mode; _companyId = ProfileId; lbMode.Text = _mode.ToString(); GetProfile(_companyId); }
public StockIssueInfo(String SKCode, String IssueNo) { InitializeComponent(); _issueNo = IssueNo; _skCode = SKCode; _mode = String.IsNullOrEmpty(_issueNo) ? DataActionMode.Add : DataActionMode.Edit; utils.utilcore.SettingDataGrid(ref dgv); lbMode.Text = _mode.ToString(); lbCode.Text = _skCode; getCurrency(); getIssueReason(); }
public int updateCustomer(Customer customer, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.Customers.Add(customer); break; case DataActionMode.Edit: var _customer = _context.Customers.Find(customer.CustomerCode); _customer.Active = customer.Active; _customer.Address = customer.Address; _customer.Balance = customer.Balance; _customer.City = customer.City; _customer.CompanyName = customer.CompanyName; _customer.ContactName = customer.ContactName; _customer.Country = customer.Country; _customer.Creditlimit = customer.Creditlimit; _customer.CreditTerm = customer.CreditTerm; _customer.Currency = customer.Currency; _customer.CustomerType = customer.CustomerType; _customer.DeliveryAddress = customer.DeliveryAddress; _customer.Email = customer.Email; _customer.Fax = customer.Fax; _customer.Industry = customer.Industry; _customer.Mobile = customer.Mobile; _customer.Phone = customer.Phone; _customer.Province = customer.Province; _customer.Status = customer.Status; _customer.TaxCode = customer.TaxCode; _customer.Website = customer.Website; _customer.Zipcode = customer.Zipcode; break; case DataActionMode.Delete: _context.Customers.Remove(_context.Customers.Find(customer.CustomerCode)); break; } return(_context.SaveChanges()); } catch { return(0); } }
public StockReceiveInfo(string SKCode, string docNum) { InitializeComponent(); utils.utilcore.SettingDataGrid(ref dgv); _SKCode = SKCode; _docNum = docNum; _mode = String.IsNullOrEmpty(docNum) ? DataActionMode.Add : DataActionMode.Edit; lbMode.Text = _mode.ToString(); lbCode.Text = _SKCode; getCurrency(); getReason(); }
private void UpdateStockIssue(SKIssueH issue, DataActionMode mode) { if (new StockDAL().UpdateStockIssue(issue, mode) > 0) { // save issue item if (_mode == DataActionMode.Add) { foreach (SKIssueItem item in _issueItems) { if (new StockDAL().UpdateIssueItem(item, DataActionMode.Add) > 0) { MessageBox.Show($"Issue '{issue.ISSUE_NUM}' save!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { if (_doPosted) { // Posting - update IssueItem foreach (SKIssueItem item in _issueItems) { item.IsPosted = _doPosted; if (new StockDAL().UpdateIssueItem(item, mode) > 0) { } } // Update Transaction if (new StockDAL().PostedStockIssueItems(_issueItems) > 0) { // update last cost for ItemMaster int _r = 0; foreach (var _item in _issueItems) { _r += new ItemMasterDAL().UpdateLastUnitCost(_item.ItemNo); } if (_r > 0) { MessageBox.Show($"Posted Issue '{issue.ISSUE_NUM}' successfully!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } }
public ItemInfo(string itemNo) { InitializeComponent(); _itemNo = itemNo; _mode = (String.IsNullOrEmpty(_itemNo) ? DataActionMode.Add : DataActionMode.Edit); _itemPicMode = _mode == DataActionMode.Add ? DataActionMode.Add : DataActionMode.None; lbMode.Text = _mode.ToString(); getCurrency(); getCategories(); getAccountGroups(); getWarehouses(); getSKUs(); getUOMs(); }