public static void deleteOrderByPurchaseOrder(int purchaseorder) { SOrder thisorder = findUnapprovedOrderByPurchaseOrder(purchaseorder); ds.SOrders.Remove(thisorder); ds.SaveChanges(); }
private void btnPOS_Click(object sender, EventArgs e) { try { int[] selRows = ((GridView)grdOrders.MainView).GetSelectedRows(); DataRowView oOrderID = (DataRowView)((GridView)grdOrders.MainView).GetRow(selRows[0]); int nOrdersID = Convert.ToInt32(oOrderID["OrderID"]); if (nOrdersID <= 0) { MessageBox.Show("Select an item to generate invoice ", "item yet not selected", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (nOrdersID > 0) { _Order = db.SOrders.FirstOrDefault(s => s.SOrderID == nOrdersID); } if (_Order == null) { MessageBox.Show("select an item to generate invoice", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } PrintInvoice oPriInvoice = new PrintInvoice(); oPriInvoice.print(_Order); } catch (Exception Ex) { MessageBox.Show("Cannot generate invoice due to " + Ex.Message); } }
public static byte[] ReOrder(byte[] bytes, int iSeed) { seed = (uint)(iSeed * iSeed * iSeed); SOrder[] tmpOrder = new SOrder[bytes.Length]; for (int i = 0; i < bytes.Length; ++i) { tmpOrder[i] = new SOrder { theOld = i, orderValue = NextI() }; } List <SOrder> tmpList = tmpOrder.ToList(); tmpList.Sort(Sort1); for (int i = 0; i < bytes.Length; ++i) { tmpList[i].theNew = i; } byte[] ret = new byte[bytes.Length]; for (int i = 0; i < bytes.Length; ++i) { ret[tmpList[i].theOld] = bytes[tmpList[i].theNew]; } return(ret); }
private void btnInvoice_Click(object sender, EventArgs e) { try { int[] selRows = ((GridView)grdOrders.MainView).GetSelectedRows(); DataRowView oOrderID = (DataRowView)((GridView)grdOrders.MainView).GetRow(selRows[0]); int nOrdersID = Convert.ToInt32(oOrderID["OrderID"]); if (nOrdersID <= 0) { MessageBox.Show("Select an item to generate invoice ", "item yet not selected", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (nOrdersID > 0) { _Order = db.SOrders.FirstOrDefault(s => s.SOrderID == nOrdersID); } fSOrder objfSOrder = new fSOrder(); objfSOrder.GenerateSOInvoice(_Order); objfSOrder.MoneyReceipt(_Order); } catch (Exception Ex) { MessageBox.Show("Cannot generate invoice due to " + Ex.Message); } }
public SoResponseDto CustomerStatementTest_LogicExec(string wsUrl, string usr, string password, SoParametersDto param) { //CustomerStatement target = new CustomerStatement(wsUrl); IWService <SoParametersDto, SoResponseDto> target = new SOrder(wsUrl); target.RequestParameters(param); target.Credentials(usr, password); return(target.Execute()); }
public void updatesorder(int purchaseid, int userid, String deliveryno) { SOrder order = sce.SOrders.Where(x => x.purchaseordernumber == purchaseid).First(); order.deliverydate = DateTime.Now; order.receivercode = userid; order.deliveryordernumber = deliveryno; sce.SaveChanges(); }
public static void approveOrderByPurchaseOrder(int purchaseorder, int approvercode, DateTime findThreeworkingday) { SOrder s = findUnapprovedOrderByPurchaseOrder(purchaseorder); DateTime dt; //need to change approvercode after session['employeecode'] is create s.approvercode = 1029; s.approvaldate = DateTime.Today; if (s.approvaldate.HasValue) { dt = s.approvaldate.Value; s.expecteddeliverydate = findThreeworkingday; } ds.SaveChanges(); }
public void deleteOrderByPurchaseOrder(int purchaseorder, int userNo, string message) { string fromemail = StoreSupplierDAO.findEmployeeByCode(userNo).employeeemail; SOrder po = StoreSupplierDAO.findUnapprovedOrderByPurchaseOrder(purchaseorder); string toemail = po.Employee.employeeemail; try { StoreSupplierDAO.deleteOrderByPurchaseOrder(purchaseorder); } catch (Exception e) { throw new SSexception("delete order failed because order not found :" + e.Message); } sendMailToEmployee(String.Format("Order no. {0} has been rejected. Reason given: {1}", purchaseorder, message), fromemail, toemail); }
public static SOrder GetCyouStoreOrder() { string strOder = PlayerPrefs.GetString(CyouStoreOrder, NORESULT); if (strOder == NORESULT) { return(null); } SOrder curOrder = new SOrder(); curOrder.strOder = strOder; curOrder.goodId = PlayerPrefs.GetInt(CyouStoreGoodId); curOrder.productID = PlayerPrefs.GetString(CyouStorePid); curOrder.reciept = PlayerPrefs.GetString(CyouStoreRecieipt); return(curOrder); }
public static SOrder GetIAppPayOrder() { string strOder = PlayerPrefs.GetString(IAppPayOrder, NORESULT); if (strOder == NORESULT) { return(null); } SOrder curOrder = new SOrder(); curOrder.strOder = strOder; curOrder.goodId = PlayerPrefs.GetInt(IAppPayGoodId); curOrder.productID = PlayerPrefs.GetString(IAppPayProductID); return(curOrder); }
public async Task <Option <SOrder> > AddServerOrder(SOrder order, string userId) { var apiResult = await _webScannerRepository.AddServerOrder(new RefitDto.ServerOrderDto(order.Frequency, order.TargetAddress, order.Question)); var result = _context.UserOrders.Add(new UserOrder(userId, apiResult, "Server")); await _context.SaveChangesAsync(); var addedOrder = await _context.ServerOrders.FirstOrDefaultAsync(x => x.Id == apiResult); if (addedOrder != null) { return(Option.Some <SOrder>(addedOrder.MapServerOrderToSOrder())); } else { return(Option.None <SOrder>()); } }
public static SOrder findLastUnapprovedOrder(int userNo, string suppliercode) { SOrder lastUnapproved = findUnapprovedOrders().Where(x => x.storeclerkcode == userNo && x.suppliercode == suppliercode).LastOrDefault(); if (lastUnapproved == null) { SOrder result = new SOrder(); result.suppliercode = suppliercode; result.storeclerkcode = userNo; ds.SOrders.Add(result); ds.SaveChanges(); return(result); } else { return(lastUnapproved); } }
public static SOrder GetPPPayOrder() { string strOder = PlayerPrefs.GetString(PPPayOrder, NORESULT); if (strOder == NORESULT) { return(null); } SOrder curOrder = new SOrder(); curOrder.strOder = strOder; curOrder.goodId = PlayerPrefs.GetInt(PPPayGoodId); curOrder.productID = PlayerPrefs.GetString(PPPayProductID); //curOrder.price = PlayerPrefs.GetInt(PPPayPrice); curOrder.userID = PlayerPrefs.GetString(PPPayUserID); curOrder.zoneID = PlayerPrefs.GetInt(PPPayZoneID); return(curOrder); }
public void Copy(SOrder otherOrder) { strOder = otherOrder.strOder; goodId = otherOrder.goodId; productID = otherOrder.productID; reciept = otherOrder.reciept; #if UNITY_ANDROID goodPrice = otherOrder.goodPrice; signature = otherOrder.signature; purchaseData = otherOrder.purchaseData; #else price = otherOrder.price; #endif productName = otherOrder.productName; userID = otherOrder.userID; zoneID = otherOrder.zoneID; date = otherOrder.date; channel = otherOrder.channel; state = otherOrder.state; }
public static void addItemOrder(Item item, int userNo, string suppliercode) { string itemSupplier = item.supplier1; SOrder lastUnconfirmedAuto = StoreSupplierDAO.findLastUnapprovedOrder(userNo, suppliercode); if (lastUnconfirmedAuto.OrderItems.Where(x => x.itemcode == item.itemcode && x.purchaseordernumber == lastUnconfirmedAuto.purchaseordernumber).Count() == 0) { OrderItem oi = new OrderItem(); oi.purchaseordernumber = lastUnconfirmedAuto.purchaseordernumber; oi.itemcode = item.itemcode; oi.orderquantity = item.reorderquantity; oi.cost = StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * item.reorderquantity; ds.OrderItems.Attach(oi); ds.OrderItems.Add(oi); lastUnconfirmedAuto.OrderItems.Add(oi); if (lastUnconfirmedAuto.totalcost == null) { lastUnconfirmedAuto.totalcost = StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * oi.orderquantity; } else { lastUnconfirmedAuto.totalcost = lastUnconfirmedAuto.totalcost + StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * item.reorderquantity; } ds.SaveChanges(); } else { OrderItem oi = lastUnconfirmedAuto.OrderItems.Where(x => x.itemcode == item.itemcode && x.purchaseordernumber == lastUnconfirmedAuto.purchaseordernumber).First(); oi.orderquantity = oi.orderquantity + item.reorderquantity; oi.cost = StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * oi.orderquantity; if (lastUnconfirmedAuto.totalcost == null) { lastUnconfirmedAuto.totalcost = StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * oi.orderquantity; } else { lastUnconfirmedAuto.totalcost = lastUnconfirmedAuto.totalcost + StoreSupplierDAO.findTenderQuotation(itemSupplier, item.itemcode) * item.reorderquantity; } ds.SaveChanges(); } }
private void ctlCustomer_SelectedItemChanged(object sender, EventArgs e) { try { _oCustomer = (Customer)(db.Customers.FirstOrDefault(o => o.CustomerID == ctlCustomer.SelectedID)); if (_oCustomer != null) { _SOrder = db.SOrders .Where(c => c.CustomerID == ctlCustomer.SelectedID && c.Status == 1) .OrderByDescending(t => t.InvoiceDate) .FirstOrDefault(); numTotalDue.Value = _oCustomer.TotalDue; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEdit_Click(object sender, EventArgs e) { try { using (DEWSRMEntities db = new DEWSRMEntities()) { int[] selRows = ((GridView)grdOrders.MainView).GetSelectedRows(); DataRowView oOrderD = (DataRowView)(((GridView)grdOrders.MainView).GetRow(selRows[0])); DataRowView InvoiceDate = (DataRowView)(((GridView)grdOrders.MainView).GetRow(selRows[0])); DateTime dInvoiceDate = Convert.ToDateTime(InvoiceDate["OrderDate"]); int nOrderID = Convert.ToInt32(oOrderD["OrderID"]); SOrder oOrder = db.SOrders.FirstOrDefault(p => p.SOrderID == nOrderID); if (oOrder == null) { MessageBox.Show("select an item to Edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Global.CurrentUser.ISEditable == 1) { if (dInvoiceDate < DateTime.Today) { MessageBox.Show("This order can't be editable, Please contact BD Team.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } fSOrder frm = new fSOrder(); frm.ItemChanged = RefreshList; frm.ShowDlg(oOrder); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SOrderTest_Execution_Regular() { string wsUrl = "http://mxoccsapmrp02.noam.cemexnet.com:8000/sap/bc/srt/xip/sap/zsi_is_external_to_ordertaking/500/zs_ordtakingcrm/zb_ordtakingcrm"; // TODO: Initialize to an appropriate value SOrder target = new SOrder(wsUrl); OrdHeaderDto header = new OrdHeaderDto() { doc_Type = "ZTA", sales_Org = "7460", channel = "00", division = "03", ship_Cond = "01", country = "CO", currency = "COP", purch_Ord = "", order_Dte = "20130725", inbo_Outb = "", agent = "", cond_Man = "", cap_Min = "", cap_Max = "", ship_Method = "" }; OrdItemDto[] items = new OrdItemDto[2] { new OrdItemDto() { Item = "", Material = "20018265", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F002" }, new OrdItemDto() { Item = "", Material = "60003350", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F002" } }; OrdPartnerDto[] partners = new OrdPartnerDto[1] { new OrdPartnerDto() { Part_Role = "SH", Part_Number = "65301717" } }; SoParametersDto parameters = new SoParametersDto { Header = header, Item = items, Partner = partners }; var actual = CustomerStatementTest_LogicExec(wsUrl, "ITOPERCOL", "cemex2011", parameters); Assert.IsTrue(actual.ExceptionMessageList == null); }
public void SOrderTest_Execution_Failure_Mock() { string wsUrl = "http://10.0.1.7:8080/mock_Failure"; // TODO: Initialize to an appropriate value SOrder target = new SOrder(wsUrl); OrdHeaderDto header = new OrdHeaderDto() { doc_Type = "ZTA", sales_Org = "7460", channel = "00", division = "03", ship_Cond = "01", country = "CO", currency = "COP", purch_Ord = "", order_Dte = "20130725", inbo_Outb = "", agent = "", cond_Man = "", cap_Min = "", cap_Max = "", ship_Method = "" }; OrdItemDto[] items = new OrdItemDto[2] { new OrdItemDto() { Item = "", Material = "20018265", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F072" }, new OrdItemDto() { Item = "", Material = "60003350", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F072" } }; OrdPartnerDto[] partners = new OrdPartnerDto[1] { new OrdPartnerDto() { Part_Role = "SH", Part_Number = "" } }; SoParametersDto parameters = new SoParametersDto { Header = header, Item = items, Partner = partners }; var actual = CustomerStatementTest_LogicExec(wsUrl, "ITOPERCOL", "cemex2011", parameters); var expected = new SoResponseDto() { ExceptionMessageList = new SoRespErrorMsgList[1] { new SoRespErrorMsgList() { Type = "", Id = "", Number = "211", Message = "", MessageV1 = "", MessageV2 = "", MessageV3 = "", MessageV4 = "" } }, OutList = null }; //var expected = new CsResponseDto() //{ // Exception = "SHIPTO_NOT_FOUND" //}; Assert.IsTrue(actual.ExceptionMessageList != null); Assert.AreEqual(actual.ExceptionMessageList[0].Number, expected.ExceptionMessageList[0].Number); }
public void SOrderTest_Execution_Regular_Mock() { string wsUrl = "http://10.0.1.7:8088/mockZB_ORDTAKINGCRM"; // TODO: Initialize to an appropriate value SOrder target = new SOrder(wsUrl); OrdHeaderDto header = new OrdHeaderDto() { doc_Type = "ZTA", sales_Org = "7460", channel = "00", division = "03", ship_Cond = "01", country = "CO", currency = "COP", purch_Ord = "", order_Dte = "20130725", inbo_Outb = "", agent = "", cond_Man = "", cap_Min = "", cap_Max = "", ship_Method = "" }; OrdItemDto[] items = new OrdItemDto[2] { new OrdItemDto() { Item = "", Material = "20018265", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F072" }, new OrdItemDto() { Item = "", Material = "60003350", Dlv_Grp = "", Tar_Qty = "", Tar_QU = "", Req_Qty = "10", Req_Dte = "", Req_Time = "", Item_typ = "", Paym_Trm = "", Plant = "F072" } }; OrdPartnerDto[] partners = new OrdPartnerDto[1] { new OrdPartnerDto() { Part_Role = "SH", Part_Number = "65603243" } }; SoParametersDto parameters = new SoParametersDto { Header = header, Item = items, Partner = partners }; var actual = CustomerStatementTest_LogicExec(wsUrl, "ITOPERCOL", "cemex2011", parameters); var expected = new SoResponseDto() { ExceptionMessageList = null, OutList = new SoRespOutList[2] { new SoRespOutList() { Item = "", Material = "", NetVal = 0, NetValSpecified = true, TaxVal = 0, TaxValSpecified = true, Currency = "", SalesUnit = "", DelDate = DateTime.Now, DelDateSpecified = true, SubTot = 304720400, SubTotSpecified = true, TaxTot = 0, TaxTotSpecified = true, ItemCat = "", Plant = "", ShipPoint = "", Conditions = new SoRespCondList[1] { new SoRespCondList() { Cond_Code = "", Cond_Name = "", Cond_Value = "", Cond_Type = "", Value_Cond = "", Cond_Curr = "", } } }, new SoRespOutList() { Item = "", Material = "", NetVal = 0, NetValSpecified = true, TaxVal = 0, TaxValSpecified = true, Currency = "", SalesUnit = "", DelDate = DateTime.Now, DelDateSpecified = true, SubTot = 0, SubTotSpecified = true, TaxTot = 0, TaxTotSpecified = true, ItemCat = "", Plant = "", ShipPoint = "", Conditions = new SoRespCondList[1] { new SoRespCondList() { Cond_Code = "", Cond_Name = "", Cond_Value = "", Cond_Type = "", Value_Cond = "", Cond_Curr = "", } } } } }; Assert.AreEqual(expected.OutList[0].SubTot, actual.OutList[0].SubTot); Assert.AreEqual(expected.OutList[1].SubTot, actual.OutList[1].SubTot); }
private void btnReturn_Click(object sender, EventArgs e) { try { int[] selRows = ((GridView)grdOrders.MainView).GetSelectedRows(); DataRowView oOrderID = (DataRowView)((GridView)grdOrders.MainView).GetRow(selRows[0]); DataRowView InvoiceDate = (DataRowView)(((GridView)grdOrders.MainView).GetRow(selRows[0])); int nOrdersID = Convert.ToInt32(oOrderID["OrderID"]); DateTime dInvoiceDate = Convert.ToDateTime(InvoiceDate["OrderDate"]); List <Stock> oStockList = db.Stocks.ToList(); List <StockDetail> oStockDList = db.StockDetails.ToList(); if (nOrdersID <= 0) { MessageBox.Show("Select an item to cancel order.", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Global.CurrentUser.ISEditable == 1) { if (dInvoiceDate < DateTime.Today) { MessageBox.Show("This order can't be return, Please contact BD Team", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (MessageBox.Show("Do you want to return this order sure?", "Return Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (nOrdersID > 0) { _Order = db.SOrders.FirstOrDefault(s => s.SOrderID == nOrdersID); if (_Order.Status == (int)EnumSalesType.Return) { MessageBox.Show("This item already return please select correct item.", "Return Item", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #region Update SOrder Data _Order.Status = (int)EnumSalesType.Return; #endregion #region Stock Data Stock oStock = null; StockDetail oStockDetail = null; Product oProduct = null; foreach (SOrderDetail sODetail in _Order.SOrderDetails) { oProduct = db.Products.FirstOrDefault(i => i.ProductID == sODetail.ProductID); oStockDetail = oStockDList.FirstOrDefault(sd => sd.SDetailID == sODetail.StockDetailID); if (oStockDetail != null) { oStock = oStockList.FirstOrDefault(o => o.ProductID == sODetail.ProductID && o.StockID == oStockDetail.StockID); } oStock.Quantity = oStock.Quantity + sODetail.Quantity; oStockDetail.Status = (int)EnumStockDetailStatus.Stock; if (oProduct.ProductType == (int)EnumProductType.NoBarCode) { oStockDetail.Quantity += sODetail.Quantity; } } #endregion #region Update Customer Due Amount Customer oCustomer = db.Customers.FirstOrDefault(c => c.CustomerID == _Order.CustomerID); if (oCustomer != null) { oCustomer.TotalDue = (decimal)(oCustomer.TotalDue - _Order.PaymentDue); } #endregion #region Bank Transactions and Bank Update if (_Order.BankTranID != 0) { FCreditSales bankdepo = new FCreditSales(); bankdepo.ReturnBankDepositTransaction(_Order.BankTranID); } #endregion db.SaveChanges(); MessageBox.Show("Order return successfully.", "Return Information", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshList(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static private int Sort1(SOrder o1, SOrder o2) { return(o1.orderValue >= o2.orderValue ? 1 : -1); }
//public static List<OrderItem> findOrderItemByPurchaseOrder(int purchaseorder) //{ // List<OrderItem> orderitems = new List<OrderItem>(); // orderitems = ds.OrderItems.Where(x => x.purchaseordernumber == purchaseorder).Select(y => y).ToList<OrderItem>(); // return orderitems; //} //add 1/19 public static SOrder findUnapprovedOrderByPurchaseOrder(int purchaseorder) { SOrder thisorder = ds.SOrders.Where(x => x.purchaseordernumber == purchaseorder && x.approvercode == null).Select(y => y).FirstOrDefault(); return(thisorder); }