public Boolean saveMoreItems(SaveOrder orderData) { Boolean valid = false; SqlConnection connection = new SqlConnection(connectionString); for (int i = 0; i < orderData.ItemsList.Length; i++) { String query2 = "insert into TrnDtlKOT values('" + orderData.KOTNO + "','" + orderData.ItemsList[i].SlNo + "','" + orderData.ItemsList[i].ItemId + "','" + orderData.ItemsList[i].AdditionalInstructions + "','" + orderData.ItemsList[i].KOTQuantity + "','" + orderData.ItemsList[i].KOTRate + "','" + orderData.ItemsList[i].KOTAmount + "',0.00,0.00)"; SqlCommand cmd2 = new SqlCommand(query2, connection); try { connection.Open(); cmd2.ExecuteNonQuery(); valid = true; } catch (Exception) { valid = false; } finally { connection.Close(); } } return(valid); }
/// <summary> /// Returns a list of all saves /// </summary> /// <returns>The list of save names</returns> public static List <string> CreateListOfSaves(SaveOrder order = SaveOrder.LastModifiedFirst) { var result = new List <string>(); using (var directory = new Directory()) { if (!directory.DirExists(Constants.SAVE_FOLDER)) { return(result); } directory.Open(Constants.SAVE_FOLDER); directory.ListDirBegin(true, true); while (true) { var filename = directory.GetNext(); if (string.IsNullOrEmpty(filename)) { break; } if (!filename.EndsWith(Constants.SAVE_EXTENSION, StringComparison.Ordinal)) { continue; } result.Add(filename); } directory.ListDirEnd(); } switch (order) { case SaveOrder.LastModifiedFirst: { using var file = new File(); result = result.OrderByDescending(item => file.GetModifiedTime(PathUtils.Join(Constants.SAVE_FOLDER, item))).ToList(); break; } case SaveOrder.FirstModifiedFirst: { using var file = new File(); result = result.OrderBy(item => file.GetModifiedTime(PathUtils.Join(Constants.SAVE_FOLDER, item))).ToList(); break; } } return(result); }
public async Task <IActionResult> PostOrder(CancellationToken cancellationToken = default) { var message = SaveOrder.New(Guid.NewGuid()); await _bus.PublishAsync(message, cancellationToken); return(Accepted(new { SagaId = message.CorrelationId })); }
public override OrderEdit Save() { var dg = new Csla.DiffGram.DiffGramGenerator(); var dto = dg.GenerateGraph(this); var cmd = new SaveOrder { DiffGram = dto }; cmd = DataPortal.Execute <SaveOrder>(cmd); dg.IntegrateGraph(this, cmd.DiffGram); return(this); }
public IHttpActionResult Post(SaveOrder saveOrder) { var activeOrderModal = new ActiveOrderModal(); var output = activeOrderModal.saveMoreItems(saveOrder); if (output) { return(Ok("Saved Items")); } else { return(Content(HttpStatusCode.NotFound, "Error Saveing Items")); } }
internal void SaveOrder() { SaveOrder form = new SaveOrder(); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { support.SaveOrder(order); order = null; MessageBox.Show("Order has been saved", "LegacyWinForm", MessageBoxButtons.OK); RefreshScreen(); } }
public String SaveKOTOrder(SaveOrder saveorder) { int insertId = 0; String valid = "false"; SqlConnection connection = new SqlConnection(connectionString); //var smalldate = saveorder.KOTDate.ToString("yyyy-MM-dd hh:mm:ss"); String query = "insert into TrnHdrKOT values('" + saveorder.KOTDate + "','N','" + saveorder.TableId + "','" + saveorder.WaiterId + "','" + saveorder.AddedBy + "','" + saveorder.TimeOfKOT + "','" + saveorder.AddedDateTime + "','N','-','" + saveorder.PAX + "') SELECT SCOPE_IDENTITY()"; SqlCommand cmd = new SqlCommand(query, connection); try { connection.Open(); insertId = (int)(decimal)cmd.ExecuteScalar(); valid = "true"; } catch (Exception ex) { valid = "false"; } finally { connection.Close(); } for (int i = 0; i < saveorder.ItemsList.Length; i++) { String query2 = "insert into TrnDtlKOT values('" + insertId + "','" + saveorder.ItemsList[i].SlNo + "','" + saveorder.ItemsList[i].ItemId + "','" + saveorder.ItemsList[i].AdditionalInstructions + "','" + saveorder.ItemsList[i].KOTQuantity + "','" + saveorder.ItemsList[i].KOTRate + "','" + saveorder.ItemsList[i].KOTAmount + "',0.00,0.00)"; SqlCommand cmd2 = new SqlCommand(query2, connection); try { connection.Open(); cmd2.ExecuteNonQuery(); valid = "true"; } catch (Exception) { valid = "false"; } finally { connection.Close(); } } return(valid); }
public IHttpActionResult Post([FromBody] SaveOrder saveorder) { var saveOrderModal = new SaveOrderModal(); var result = saveOrderModal.SaveKOTOrder(saveorder); if (result == "true") { return(Ok(result)); } else if (result == "false") { return(Content(HttpStatusCode.NotFound, "Error saving order")); } return(Content(HttpStatusCode.NotFound, "Try again")); }
public ActionResult PlaceOrder(SaveOrder model) { try { if (model != null) { var UserId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value; model.OrderBy = int.Parse(UserId); var product = _dbContext.Products.SingleOrDefault(x => x.ProductId == model.ProductId); var availableQuantity = product.Quantity; var appliedQuantity = model.Quantity; if (appliedQuantity > availableQuantity) { var resultReturnModel = new ReturnModelValue(enumReturnStatus.Failed, "There is no such quanties vailable", "Select Within a given quantity", null); return(Ok(resultReturnModel)); } else if (appliedQuantity == availableQuantity) { _dbContext.SaveOrders.Add(model); _dbContext.SaveChanges(); var data = _dbContext.Products.SingleOrDefault(x => x.ProductId == model.ProductId); _dbContext.Remove(data); _dbContext.SaveChanges(); var resultReturnModel = new ReturnModelValue(enumReturnStatus.Success, "Order Purchase", "Purchased", null); return(Ok(resultReturnModel)); } else if (appliedQuantity < availableQuantity) { _dbContext.SaveOrders.Add(model); _dbContext.SaveChanges(); var data = _dbContext.Products.SingleOrDefault(x => x.ProductId == model.ProductId); var CurrentQuantity = availableQuantity - appliedQuantity; data.Quantity = CurrentQuantity; _dbContext.Update(data); _dbContext.SaveChanges(); var resultReturnModel = new ReturnModelValue(enumReturnStatus.Success, "Order Purchaes", "Purchased", null); return(Ok(resultReturnModel)); } } } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } return(null); }
/// <summary> /// A simple function that takes a string and does a ToUpper /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public LexResponse FunctionHandler(LexEvent request, ILambdaContext context) { LambdaLogger.Log(JsonSerializer.Serialize(request)); if (request.SessionAttributes == null || !request.SessionAttributes.ContainsKey("Initialized")) { var validationResult = new InitialValidation(request).HandleJob(); if (validationResult.DialogAction.FulfillmentState == FulfillmentState.Failed.ToString()) { return(validationResult); } } IIntentHandler validator = null; switch (request.CurrentIntent.Name) { case "OrderPizza": switch (request.InvocationSource) { case "DialogCodeHook": validator = new OrderPizzaIntentValidation(request); break; case "FulfillmentCodeHook": validator = new SaveOrder(request); break; } break; case "QueryOrder": validator = new QueryOrder(request); break; default: return(new HandlerBase(request).DelegateToLex()); } return(validator?.HandleJob()); }
public JsonResult SaveOrderSummary(SaveOrder SaveOrder) { if (SaveOrder.type == 3) { StatusChange model = new StatusChange(); model.OrderID = SaveOrder.strorderID; model.Type = "8"; objOrderData.GetUpdateCustomerStatus(model); var AllStatus = custOrderData.GetCustOrderDetailList(Convert.ToInt64(securityHelper.Decrypt(SaveOrder.strorderID, false))); return(new JsonResult { Data = AllStatus, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { var OrderSummary = objCustRequest.SaveConfirmOrder(SaveOrder); return(new JsonResult { Data = OrderSummary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
private void highPriceBt_Click(object sender, EventArgs e) { logStr += "点击了获取销售订单" + "\r\n"; writeLog(); macAddressLb.Text = GetNetworkAdpaterID(); orderNoLb.Text = ""; SaveOrder saveOrder = new SaveOrder(); GoodsResponse goods = saveOrder.requestOrder(); if ("00000".Equals(goods.code)) { orderNoLb.Text = goods.Data.orderNo; logStr += goods.Data.orderNo + "\r\n"; } else { logStr += "code: " + goods.code + "\nerrMsg: " + goods.message + "\r\n"; } writeLog(); }
public List <dynamic> SaveConfirmOrder(SaveOrder SaveOrder) { List <dynamic> objDynamic = new List <dynamic>(); Int64 intOrderID = 0, intCustomerID = 0, intUserID = 0, intConfirmOrderID = 0; try { if (!string.IsNullOrEmpty(SaveOrder.strorderID)) { intOrderID = Convert.ToInt64(SaveOrder.strorderID); } if (!string.IsNullOrEmpty(SaveOrder.strCustId)) { intCustomerID = Convert.ToInt64(SaveOrder.strCustId); } if (!string.IsNullOrEmpty(UserID)) { intUserID = Convert.ToInt64(UserID); } intConfirmOrderID = orddata.AddConfirmOrderDetail(intOrderID, intCustomerID, intUserID, SaveOrder.type); string strencOrderID = securityHelper.Encrypt(intConfirmOrderID.ToString(), false); objDynamic.Add(strencOrderID); objDynamic.Add(custOrderData.GetCustOrderDetailList(intConfirmOrderID)); if (true) { } EmailTemplate emailTemplate = new EmailTemplate(); EmailFormatDTO emailFormatDTO = GetEmailDetails(intConfirmOrderID.ToString(), string.Empty, string.Empty); } catch (Exception ex) { } return(objDynamic); }
public dynamic Save(Guid id, SaveOrderModel model) { var commandService = _clientFactory.GetCommandServiceClient(); var queryService = _clientFactory.GetCustomersQueryServiceClient(); var order = queryService.GetOrderById(id); if (!ModelState.IsValid) throw ApiHelpers.ServerError(ModelState); if (model.Items == null) model.Items = new SaveOrderModel.LineItem[] { }; if (model.CashPayments == null) model.CashPayments = new SaveOrderModel.CashPayment[] { }; if (model.CheckPayments == null) model.CheckPayments = new SaveOrderModel.CheckPayment[] { }; if (model.DeletedCCPaymentIds == null) model.DeletedCCPaymentIds = new HashSet<Guid>(); if (model.Followups == null) model.Followups = new FollowUpItem[] { }; var cashPayments = model.CashPayments.Select(p => new Payment { PaymentId = p.PaymentId == Guid.Empty ? Guid.NewGuid() : p.PaymentId, PaymentType = PaymentType.Cash, AmountPaid = p.Amount, PaymentDateUtc = p.PaymentDateUtc }); var checkPayments = model.CheckPayments.Select(p => new Payment { PaymentId = p.PaymentId == Guid.Empty ? Guid.NewGuid() : p.PaymentId, PaymentType = PaymentType.PersonalCheck, AmountPaid = p.Amount, CheckNumber = p.CheckNumber, PaymentDateUtc = p.PaymentDateUtc }); // Pass through CC payments since they cannot be changed by saving an order. They must be changed through the ccpayment web api // CC Payments that are not approved can be removed though so exclude those. var ccPayments = order.Payments.Where(p => p.PaymentType == PaymentType.CreditCard && !model.DeletedCCPaymentIds.Contains(p.PaymentId)); var command = new SaveOrder { CommandId = Guid.NewGuid(), OrderId = id, OrderDateUtc = model.OrderDateUtc, OrderStatus = model.OrderStatus, PaymentStatus = model.PaymentStatus, ShipCDS = model.ShipCDS, CatalogName = _appSettings.GetValue("ProductCatalog.CatalogName"), IsGift = model.IsGift, GiftMessage = model.GiftMessage, Notes = model.Notes, DeliveryDateUtc = model.DeliveryDateUtc, DeliveryAddress = model.DeliveryAddress, Payments = cashPayments.Concat(checkPayments).Concat(ccPayments).ToArray(), Followups = model.Followups.Distinct().ToArray(), AddDeliveryAddressToCustomer = model.AddDeliveryAddressToCustomer, Items = model.Items.Select(i => new SaveOrder.LineItem { ProductId = i.Id, Price = i.Price, Qty = i.Qty, UseupRateInDays = i.UseupRate }).ToArray() }; if (command.DeliveryAddress != null && (command.DeliveryAddress.AddressKey == Guid.Empty || model.AddDeliveryAddressToCustomer)) { command.DeliveryAddress.IsPrimary = false; command.DeliveryAddress.AddressKey = Guid.NewGuid(); } try { commandService.Execute(command); return new { id = command.OrderId, links = new { self = new { href = Url.Route("DefaultApi", new { id = command.OrderId }) }, detail = new { href = Url.Route("Default", new { controller = "orders", action = "detail", id = command.OrderId }) } } }; } catch (CommandException ex) { throw ApiHelpers.ServerError(ex.Message, string.Join("\r\n", ex.Errors)); } }
public SaveOrder getOrderDetails(String tableid) { var orderData = new SaveOrder(); var orderList = new List <SaveOrder>(); SqlConnection connection = new SqlConnection(connectionString); String query = "select * from TrnHdrKOT where TblID='" + tableid + "' and Billed='N' order by KOTNO asc"; SqlCommand cmd = new SqlCommand(query, connection); try { connection.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var orderDataTemp = new SaveOrder(); orderData.KOTNO = reader.GetInt32(0); orderDataTemp.KOTNO = reader.GetInt32(0); orderData.KOTDate = reader.GetDateTime(1).ToString(); orderData.TableId = reader.GetInt32(3); orderData.WaiterId = reader.GetInt32(4); orderData.PAX = reader.GetInt32(10); orderList.Add(orderDataTemp); } } catch (Exception ex) { } finally { connection.Close(); } var itemList = new List <KOTOrderItems>(); for (int i = 0; i < orderList.Count; i++) { String query2 = "select d.*, i.itemName,i.KCATID, (d.KOTQty - d.QtyCancelled) as KOTActiveQty from TrnDtlKOT as d, MstItem as i where KOTNO='" + orderList[i].KOTNO + "' and d.ItemID= i.ItemID order by d.SlNO"; SqlCommand cmd2 = new SqlCommand(query2, connection); try { connection.Open(); SqlDataReader reader = cmd2.ExecuteReader(); while (reader.Read()) { if (reader.GetDecimal(12) > 0) { var itemData = new KOTOrderItems(); itemData.KOTNO = reader.GetInt32(1); itemData.SlNo = reader.GetInt32(2); itemData.ItemId = reader.GetInt32(3); itemData.AdditionalInstructions = reader.GetString(4); itemData.KOTQuantity = (int)reader.GetDecimal(5); itemData.KOTRate = (int)reader.GetDecimal(6); itemData.KOTAmount = (int)reader.GetDecimal(7); itemData.ItemName = reader.GetString(10); itemData.KCATID = reader.GetInt32(11); itemList.Add(itemData); } } orderData.ItemsList = itemList.ToArray(); } catch (Exception) { } finally { connection.Close(); } } return(orderData); }