public static bool CloseOrder(Model.Order order, double currentPrice, Constants.TrendPhase trendPhase) { bool closeOrder = false; if (order != null) { if (trendPhase == Constants.TrendPhase.LONG) { if (currentPrice <= order.StopLoss && order != null) { closeOrder = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(DateTime.Now + " CLOSE ORDER :" + currentPrice + " SL :" + order.StopLoss); LogWriter.WriteLog(DateTime.Now + " CLOSE ORDER :" + currentPrice + " SL :" + order.StopLoss); Console.ResetColor(); } } else if (trendPhase == Constants.TrendPhase.SHORT) { if (currentPrice >= order.StopLoss) { closeOrder = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(DateTime.Now + " CLOSE ORDER :" + currentPrice + " SL :" + order.StopLoss); LogWriter.WriteLog(DateTime.Now + " CLOSE ORDER :" + currentPrice + " SL :" + order.StopLoss); Console.ResetColor(); } } } return(closeOrder); }
public bool UpdateAPIDelivery(Delivery modelData, FCMNotificationModel FCMModelData) { bool bSuccess = false; try { if (modelData.DeliveryId > 0) { ProDelivery deliveryData = deliveryRepository.GetDelivery(modelData.DeliveryId); deliveryData.ModifiedOn = DateTime.Now; deliveryData.ModifiedBy = modelData.DriverId; deliveryData.DeliveryStatus = modelData.DeliveryStatus; deliveryData.DeliveredTo = modelData.DeliveredTo; deliveryData.DeliveryRemarks = modelData.DeliveryRemarks; bSuccess = deliveryRepository.SaveDelivery(deliveryData); if (bSuccess) { ProOrder orderData = orderRepository.GetOrder(deliveryData.OrderId.Value); orderData.ModifiedOn = DateTime.Now; orderData.ModifiedBy = modelData.DriverId; Model.Order orderModelData = new Model.Order(); int? orderOldStatus = orderData.OrderStatus; orderData.OrderStatus = (int)GetOrderStatusForDeliveryStatus((DeliveryStatus)deliveryData.DeliveryStatus); orderModelData.Remarks = $"Changed status to {GetOrderStatusForDeliveryStatus((DeliveryStatus)deliveryData.DeliveryStatus).ToString()}"; bSuccess = orderRepository.SaveOrder(orderData, orderModelData); } } } catch (Exception ex) { logger.LogError(ex, ex.Message); } return(bSuccess); }
public OrderDetail(Model.Order order) { this.Order = order; InitializeComponent(); this.DataContext = order; LoadData(); }
/// <summary> /// Get a Order by id from the database /// </summary> public virtual Model.Order GetById(Int32 id) { DbDataReader reader = null; try { var helper = Database.GetDbHelper(); reader = helper.ExecuteSPReader(_storedProcedure_GetById, helper.CreateInputParam("@Id", id)); Model.Order result = null; if (reader.Read()) { result = CreateOrder(reader); } return(result); } catch (Exception ex) { Trace.WriteError("{0}", Trace.GetMethodName(), CLASSNAME, ex, id); throw DbHelper.TranslateException(ex); } finally { if (reader != null) { reader.Close(); } } }
/// <summary> /// Add a new Order to the database /// </summary> public virtual Int32 Add(Model.Order newOrder) { try { Trace.WriteVerbose("({0})", Trace.GetMethodName(), CLASSNAME, newOrder.ToString()); var helper = Database.GetDbHelper(); DbParameter IdParam = helper.CreateOutputParam("@Id", DbType.Int32); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Add, IdParam, helper.CreateInputParam("@OrderMessageId", newOrder.OrderMessageId), helper.CreateInputParam("@Code", newOrder.Code), helper.CreateInputParam("@MaterialId", newOrder.MaterialId), helper.CreateInputParam("@ResourceId", newOrder.ResourceId), helper.CreateInputParam("@TargetQuantity", newOrder.TargetQuantity), helper.CreateInputParam("@UOM", newOrder.UOM), helper.CreateInputParam("@PlannedStartDate", newOrder.PlannedStartDate), helper.CreateInputParam("@StartDate", newOrder.StartDate.HasValue ? (object)newOrder.StartDate : DBNull.Value), helper.CreateInputParam("@FinishDate", newOrder.FinishDate.HasValue ? (object)newOrder.FinishDate : DBNull.Value)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("Unable to add Order with Id={0}", newOrder); } return((Int32)IdParam.Value); } catch (Exception ex) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, newOrder.ToString()); throw DbHelper.TranslateException(ex); } }
/// <summary> /// Delete the given Order from the database /// </summary> public virtual void Delete(Model.Order delOrder) { try { Trace.WriteInformation("({0})", Trace.GetMethodName(), CLASSNAME, delOrder); //Begin Checks if (!Exists(delOrder)) { throw new BusinessException(string.Format("There is no Order with this id. ({0})", delOrder)); } DataAccess.Orders orders = new DataAccess.Orders(); orders.Delete(delOrder); } catch (DalForeignKeyException ex_fk) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex_fk, delOrder); throw new BusinessException(string.Format("The Order is still used by {0}", ex_fk.Table), ex_fk); } catch (Exception ex) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, delOrder); throw; } }
public async Task <ActionResult> NewOrderForTest([FromBody] NewOrder newOrder) { if (newOrder == null) { return(StatusCode(500)); } if (newOrder.OrderId <= 0) { return(StatusCode(500)); } if (String.IsNullOrEmpty(newOrder.StoreName)) { return(StatusCode(500)); } Model.Order order = _mapper.Map <Model.Order>(newOrder); if (order.Store == null) { return(new Helper.UnprocessableEntityResult(ModelState)); } if (order.Store.StoreId == Guid.Empty) { return(new Helper.UnprocessableEntityResult(ModelState)); } await _orderService.Insert(order); return(StatusCode(200)); }
public async Task Get_Order_For_Id() { Model.Order order = await CreateOrder(); IExecutionResult result = await ServiceProvider.ExecuteRequestAsync( QueryRequestBuilder .New() .SetQuery(@" query OrderById($id:ID!) { orderById(id: $id) { id name address1 address2 town postcode phone email deliveryInstructions items { itemId name description quantity } } } ") .SetVariableValue(name : "id", value : order.Id.ToString()) .Create()); result.MatchSnapshot(); }
protected override void SetValue(string id) { cartast = BLL.C_CarTast.GetModel(int.Parse(id)); supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName)); cid.Value = id; if (!string.IsNullOrEmpty(cartast.OCode)) { order = BLL.Order.GetModel(cartast.OCode); listord = order.OrderDetail; } if (order != null) { listcost = BLL.C_CostDetalis.GetModelList(" CID=" + order.Id); } if (cartast.TState == 1 || !TModel.Role.SiJi) { anbtn.Visible = false; } Model.Member zm = BLL.Member.GetModelByMID(cartast.CarSJ1); if (zm != null) { zhusiji = zm.MName; } Model.Member fm = BLL.Member.GetModelByMID(cartast.CarSJ2); if (fm != null) { fusiji = fm.MName; } }
public Model.IMessage SaveOrder(Model.Order order, IList <Model.OrderBook> orderBooks) { IList <SqlParameter> param = order.ToInPrarmterList(Order._Id); DataTable table = new DataTable(); table.Columns.Add("OrderID", typeof(int)); table.Columns.Add("BookID", typeof(int)); table.Columns.Add("Quantity", typeof(int)); table.Columns.Add("UnitPrice", typeof(decimal)); foreach (var item in orderBooks) { DataRow row = table.NewRow(); row["OrderID"] = 0; row["BookID"] = item.BookID; row["Quantity"] = item.Quantity; row["UnitPrice"] = item.UnitPrice; table.Rows.Add(row); } SqlParameter listParameter = new SqlParameter("@OrderBooks", table); listParameter.TypeName = "OrderBookTvp"; param.Add(listParameter); return(base.Database.GetMessage("SP_SaveOrder", param.ToArray())); }
public Model.Order GetOrderDetail(long orderId, bool buildEmptyRows = true) { var orderData = new Model.Order(); try { if (orderId > 0) { orderData = MapOrderData(orderId); if (buildEmptyRows) { if (orderData.OrderDetails != null) { var totalDetailCount = orderData.OrderDetails.Count; for (int i = totalDetailCount; i < 50; i++) { orderData.OrderDetails.Add(new Model.OrderDetail { IsVisible = false }); } } } orderData.OldOrderStatus = orderData.OrderStatus; } } catch (Exception ex) { logger.LogError(ex, ex.Message); } return(orderData); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Order GetModel(string id) { StringBuilder strSql = new StringBuilder(); StringBuilder str1 = new StringBuilder(); Model.Order model = new Model.Order(); //利用反射获得属性的所有公共属性 PropertyInfo[] pros = model.GetType().GetProperties(); foreach (PropertyInfo p in pros) { str1.Append(p.Name + ",");//拼接字段 } strSql.Append("select top 1 " + str1.ToString().Trim(',')); strSql.Append(" from MS_Order"); strSql.Append(" where o_id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.VarChar, 11) }; parameters[0].Value = id; DataTable dt = DbHelperSQL.Query(strSql.ToString(), parameters).Tables[0]; if (dt.Rows.Count > 0) { return(DataRowToModel(dt.Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.Order model) { StringBuilder strSql = new StringBuilder(); StringBuilder str1 = new StringBuilder(); //利用反射获得属性的所有公共属性 PropertyInfo[] pros = model.GetType().GetProperties(); List <SqlParameter> paras = new List <SqlParameter>(); strSql.Append("update MS_Order set "); foreach (PropertyInfo pi in pros) { //如果不是主键则追加sql字符串 if (!pi.Name.Equals("o_id")) { //判断属性值是否为空 if (pi.GetValue(model, null) != null) { str1.Append(pi.Name + "=@" + pi.Name + ","); //声明参数 paras.Add(new SqlParameter("@" + pi.Name, pi.GetValue(model, null))); //对参数赋值 } } } strSql.Append(str1.ToString().Trim(',')); strSql.Append(" where o_id=@id "); paras.Add(new SqlParameter("@id", model.o_id)); return(DbHelperSQL.ExecuteSql(strSql.ToString(), paras.ToArray()) > 0); }
public bool SaveOrder(Model.Order modelData, string mailContent, string surgeryOrderMailContent, FCMNotificationModel FCMModelData) { bool bSuccess = false; try { ProOrder orderData; if (modelData.OrderId > 0) { orderData = orderRepository.GetOrder(modelData.OrderId); modelData.ModifiedOn = DateTime.Now; modelData.ModifiedBy = userService.GetLoggdInUser().UserId; } //modelData.SurgeryNote = modelData.SurgeryNote; orderData = MapperConfig.Mapper.Map <Model.Order, ProOrder>(modelData, orderData); orderData.Customer = customerRepository.GetCustomer(modelData.CustomerId); bSuccess = orderRepository.SaveOrder(orderData, modelData); } catch (Exception ex) { logger.LogError(ex, ex.Message); } return(bSuccess); }
public Model.Order CompletePurchase(int userId, List <Model.OrderItem> orderItems) { if (userId == 0) { var order1 = new Model.Order() { OrderUser = new Model.Users() { Id = 0 } }; return(order1); } else { var order2 = new Model.Order() { OrderUser = new Model.Users() { Id = 1, Fornavn = "Fornavn", Etternavn = "Etternavn", Adresse = "Adressen 1", Epost = "*****@*****.**", // Passord = "passord", } }; return(order2); } }
private string getStringCZ(Model.Order offer) { string op = ""; if (offer.Status == 1) { if (offer.MID == TModel.MID) { op += "<a href='javascript:void(0)' class='xiangqing' onclick='payOrder(" + offer.Id + ")' >付款</a>"; } } if (offer.Status == 3) { op += "<a style='color:green;' href='javascript:wuliu(\"快递公司:" + offer.ExpressCompany + "<br/>快递单号:" + offer.ExpressCode + "\");'>查看物流</a>"; if (offer.MID == TModel.MID) { op += "<br/><a href='javascript:void(0)' class='del_xiangqing' onclick='receiveOrder(" + offer.Id + ")'>确认收货</a>"; } } if (offer.Status == 4) { op += "已完成"; } return(op); }
public void When_Order_Has_Been_Cancelled_The_OrderStatus_Should_Be_Correct() { var order = new Model.Order { OrderStatusId = DataConstants.OrderStatus.Cancelled, OrderDetails = new[] { new OrderDetail { OrderDetailId = 1, ProductTypeId = DataConstants.ProductTypes.Slim, Qty = 10 }, new OrderDetail { OrderDetailId = 1, ProductTypeId = DataConstants.ProductTypes.Round, Qty = 5 } } }; var orderDto = Mapper.Map <OrderDto>(order); Assert.AreEqual(DataConstants.OrderStatus.Cancelled, orderDto.CalculatedStatusId); }
/// <summary> /// Modify the given Order in the database /// </summary> public virtual void Modify(Model.Order modifiedOrder) { try { Trace.WriteVerbose("({0})", Trace.GetMethodName(), CLASSNAME, modifiedOrder.ToString()); var helper = Database.GetDbHelper(); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Modify, helper.CreateInputParam("@Id", modifiedOrder.Id), helper.CreateInputParam("@OrderMessageId", modifiedOrder.OrderMessageId), helper.CreateInputParam("@Code", modifiedOrder.Code), helper.CreateInputParam("@MaterialId", modifiedOrder.MaterialId), helper.CreateInputParam("@ResourceId", modifiedOrder.ResourceId), helper.CreateInputParam("@TargetQuantity", modifiedOrder.TargetQuantity), helper.CreateInputParam("@UOM", modifiedOrder.UOM), helper.CreateInputParam("@PlannedStartDate", modifiedOrder.PlannedStartDate), helper.CreateInputParam("@StartDate", modifiedOrder.StartDate.HasValue ? (object)modifiedOrder.StartDate : DBNull.Value), helper.CreateInputParam("@FinishDate", modifiedOrder.FinishDate.HasValue ? (object)modifiedOrder.FinishDate : DBNull.Value)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("No records were updated (Table: Orders). Order=" + modifiedOrder.ToString()); } } catch (Exception ex) { Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, modifiedOrder.ToString()); throw DbHelper.TranslateException(ex); } }
private async Task afterSelection(IDialogContext context, IAwaitable <string> result) { try { var selection = await result; switch (selection.ToString()) { case "Order": this.order = new Model.Order(); this.order.AskToUseSavedSenderInfo = true; // await context.PostAsync("We are currently processing your sandwich. We will message you the status."); var orderForm = new FormDialog <TrialBot.Model.Order>(this.order, TrialBot.Model.Order.BuildForm, FormOptions.PromptInStart); context.Call(orderForm, this.AfterOrderForm); break; case "Products": case "Hotels Order": this.HodelOrder = new Model.OrderDetails(); //this.HodelOrder.AskToUseSavedSenderInfo = true; // await context.PostAsync("We are currently processing your sandwich. We will message you the status."); var sHodelOrder = new FormDialog <TrialBot.Model.OrderDetails>(this.HodelOrder, TrialBot.Model.OrderDetails.BuildForm, FormOptions.PromptInStart); context.Call(sHodelOrder, this.AfterOrderForm); break; } } catch (Exception ex) { // await this.StartOverAsync(context, Resources.RootDialog_TooManyAttempts); } }
public static bool CloseOrder(double currentPrice, Model.Order order, Constants.TrendPhase trendPhase, Candle currentCandle, Candle previousCandle) { bool closeOrder = false; if (order != null) { if (trendPhase == Constants.TrendPhase.LONG) { if (currentCandle.Color == Constants.CandelColour.RED && previousCandle.Color == Constants.CandelColour.GREEN && order != null) { closeOrder = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(DateTime.Now + " CLOSE ORDER :" + currentPrice); LogWriter.WriteLog(DateTime.Now + " CLOSE ORDER :" + currentPrice); Console.ResetColor(); } } else if (trendPhase == Constants.TrendPhase.SHORT) { if (currentCandle.Color == Constants.CandelColour.GREEN && previousCandle.Color == Constants.CandelColour.RED && order != null) { closeOrder = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(DateTime.Now + " CLOSE ORDER :" + currentPrice); LogWriter.WriteLog(DateTime.Now + " CLOSE ORDER :" + currentPrice); Console.ResetColor(); } } } return(closeOrder); }
public async Task <Model.Order> CreateOrder(Model.Order order) { var storedOrderData = _dbContext.Orders.Add(order.ToDataContract()); await _dbContext.SaveChangesAsync(); return(storedOrderData.Entity.ToModel()); }
public async Task <CommandResult <IdentifierResponse> > Handle(AddOrderCommand request, CancellationToken cancellationToken) { var deliveryAddress = new Address { Street = request.DeliveryAddress.Street, Floor = request.DeliveryAddress.Floor, Interphone = request.DeliveryAddress.Interphone, District = request.DeliveryAddress.District }; var pickUpAddress = new Address { Street = request.PickUpAddress.Street, Floor = request.PickUpAddress.Floor, Interphone = request.PickUpAddress.Interphone, District = request.PickUpAddress.District }; var order = new Model.Order { Items = request.Items, DeliveryAddress = deliveryAddress, PickUpAddress = pickUpAddress, Phone = request.Phone, Note = request.Note, DeliveryNote = request.DeliveryNote }; order.DateCreated = DateTime.Now; if (request.FileInBytes != null) { order.File = new File { FileInBytes = Encoding.ASCII.GetBytes(request.FileInBytes), Name = request.FileName }; } _orderRepository.Add(order); await _unitOfWork.SaveChangesAsync(); if (request.UserId != null) { order.UserId = request.UserId.ToString(); } var success = await _unitOfWork.SaveChangesAsync(); return(await Task.FromResult(CommandResult <IdentifierResponse> .Success(new IdentifierResponse() { Id = order.Id, Success = success }))); }
private void deleteOrderFile(HttpContext context) { //检查是否允许匿名上传 if (!new ManagePage().IsAdminLogin()) { context.Response.Write("{\"status\": 0, \"msg\": \"禁止匿名非法删除!\"}"); return; } BLL.Order bll = new BLL.Order(); Model.manager manager = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 int id = DTRequest.GetQueryInt("id"); Model.Files file = bll.GetFileModel(id); Model.Order order = bll.GetModel(file.f_oid); if (order.o_lockStatus == 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已锁定,不能再删除!\"}"); context.Response.End(); } if (bll.deleteOrderFile(file, manager)) { context.Response.Write("{\"status\": 1, \"msg\": \"删除成功!\"}"); context.Response.End(); } context.Response.Write("{\"status\": 0, \"msg\": \"删除失败!\"}"); context.Response.End(); }
public void WhenOrderIsMappedToDto_And_ThereAreNoDeliveries_Should_ReturnZero() { var order = new Model.Order { OrderDetails = new[] { new OrderDetail { OrderDetailId = 1, ProductTypeId = DataConstants.ProductTypes.Slim, Qty = 10 }, new OrderDetail { OrderDetailId = 1, ProductTypeId = DataConstants.ProductTypes.Round, Qty = 5 } } }; var orderDto = Mapper.Map <OrderDto>(order); Assert.AreEqual(0, orderDto.SlimQtyDelivered); Assert.AreEqual(0, orderDto.RoundQtyDelivered); }
private void SelectOrder(object sender, TappedRoutedEventArgs e) { ListView lv = (ListView)sender; Model.Order o = (Model.Order)lv.SelectedItem; (this.DataContext as OrdersNotCompletedViewModel).Order = o; }
public async Task Insert(Model.Order order) { await Task.Run(() => { _orderRepository.Insert(order); _orderRepository.Save(); }); }
private void ShowInfo(int _id) { BLL.Order bll = new BLL.Order(); Model.Order model = bll.GetModel(_id); txtAcceptOrderTime.Text = model.AcceptOrderTime.ToString("yyyy-MM-dd"); txtArrivedTime.Text = model.ArrivedTime.ToString("yyyy-MM-dd"); txtQuantity.Text = model.Quantity.ToString(); chkIsCharteredCar.Checked = model.IsCharteredCar == 1; if (!string.IsNullOrEmpty(model.Haulway)) { ddlHaulway.Items.FindByText(model.Haulway).Selected = true; } txtLoadingCapacityRunning.Text = model.LoadingCapacityRunning.ToString(); txtNoLoadingCapacityRunning.Text = model.NoLoadingCapacityRunning.ToString(); if (!string.IsNullOrEmpty(model.Formula)) { ddlFormula.Items.FindByText(model.Formula).Selected = true; } txtUnitPrice.Text = model.UnitPrice.ToString(); txtTotalPrice.Text = model.TotalPrice.ToString(); if (!string.IsNullOrEmpty(model.Shipper)) { ddlShipper.Items.FindByText(model.Shipper).Selected = true; } txtShipperLinkMan.Text = model.ShipperLinkMan; txtShipperLinkTel.Text = model.ShipperLinkTel; if (!string.IsNullOrEmpty(model.Receiver)) { ddlReceiver.Items.FindByText(model.Receiver).Selected = true; } txtReceiverLinkMan.Text = model.ReceiverLinkMan; txtReceiverLinkTel.Text = model.ReceiverLinkTel; txtContractNumber.Text = model.ContractNumber; txtBillNumber.Text = model.BillNumber; txtWeighbridgeNumber.Text = model.WeighbridgeNumber; if (!string.IsNullOrEmpty(model.LoadingAddress)) { ddlLoadingAddress.Items.FindByText(model.LoadingAddress).Selected = true; } if (!string.IsNullOrEmpty(model.UnloadingAddress)) { ddlUnloadingAddress.Items.FindByText(model.UnloadingAddress).Selected = true; } if (!string.IsNullOrEmpty(model.SettleAccountsWay)) { ddlSettleAccountsWay.Items.FindByText(model.SettleAccountsWay).Selected = true; } if (!string.IsNullOrEmpty(model.Goods)) { ddlGoods.Items.FindByText(model.Goods).Selected = true; } txtUnit.Text = model.Unit; txtRemarks.Text = model.Remarks; }
/// <summary> /// Ctor /// </summary> public EditOrder(Model.Order editOrder, IStorable <Model.Order> orderStorage) { _editOrder = editOrder; _orderStorage = orderStorage; InitializeComponent(); SetToTextbox(); }
private Model.Order GetOrderModel(IDomainEvent <Guid> e) { if (_order == null) { _order = _sqlClient.Queryable <Model.Order>().Where(x => x.Id == (Guid)e.AggregateRootKey).Single(); } return(_order ?? (_order = new Model.Order())); }
public void AddPayment(Model.Payment payment) { Model.Order Order = GetOrderByOrderId(payment.OrderId); if (Order == null) { throw new System.Exception("Ordem não localizada com esse Id"); } Order.Payments.Add(payment); }
/// <summary> /// 获得数据列表 /// </summary> public List<Model.Order> DataTableToList(DataTable dt) { List<Model.Order> modelList = new List<Model.Order>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Model.Order model; for (int n = 0; n < rowsCount; n++) { model = new Model.Order(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Code = dt.Rows[n]["Code"].ToString(); if (dt.Rows[n]["AcceptOrderTime"].ToString() != "") { model.AcceptOrderTime = DateTime.Parse(dt.Rows[n]["AcceptOrderTime"].ToString()); } if (dt.Rows[n]["ArrivedTime"].ToString() != "") { model.ArrivedTime = DateTime.Parse(dt.Rows[n]["ArrivedTime"].ToString()); } model.Shipper = dt.Rows[n]["Shipper"].ToString(); model.ShipperLinkMan = dt.Rows[n]["ShipperLinkMan"].ToString(); model.ShipperLinkTel = dt.Rows[n]["ShipperLinkTel"].ToString(); model.Receiver = dt.Rows[n]["Receiver"].ToString(); model.ReceiverLinkMan = dt.Rows[n]["ReceiverLinkMan"].ToString(); model.ReceiverLinkTel = dt.Rows[n]["ReceiverLinkTel"].ToString(); model.ContractNumber = dt.Rows[n]["ContractNumber"].ToString(); model.LoadingAddress = dt.Rows[n]["LoadingAddress"].ToString(); model.UnloadingAddress = dt.Rows[n]["UnloadingAddress"].ToString(); model.Goods = dt.Rows[n]["Goods"].ToString(); model.Unit = dt.Rows[n]["Unit"].ToString(); if (dt.Rows[n]["IsCharteredCar"].ToString() != "") { model.IsCharteredCar = int.Parse(dt.Rows[n]["IsCharteredCar"].ToString()); } if (dt.Rows[n]["Quantity"].ToString() != "") { model.Quantity = decimal.Parse(dt.Rows[n]["Quantity"].ToString()); } if (dt.Rows[n]["DispatchedCount"].ToString() != "") { model.DispatchedCount = decimal.Parse(dt.Rows[n]["DispatchedCount"].ToString()); } model.Haulway = dt.Rows[n]["Haulway"].ToString(); if (dt.Rows[n]["LoadingCapacityRunning"].ToString() != "") { model.LoadingCapacityRunning = decimal.Parse(dt.Rows[n]["LoadingCapacityRunning"].ToString()); } if (dt.Rows[n]["NoLoadingCapacityRunning"].ToString() != "") { model.NoLoadingCapacityRunning = decimal.Parse(dt.Rows[n]["NoLoadingCapacityRunning"].ToString()); } model.BillNumber = dt.Rows[n]["BillNumber"].ToString(); model.WeighbridgeNumber = dt.Rows[n]["WeighbridgeNumber"].ToString(); model.Formula = dt.Rows[n]["Formula"].ToString(); if (dt.Rows[n]["UnitPrice"].ToString() != "") { model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString()); } if (dt.Rows[n]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString()); } model.SettleAccountsWay = dt.Rows[n]["SettleAccountsWay"].ToString(); if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } model.Remarks = dt.Rows[n]["Remarks"].ToString(); modelList.Add(model); } } return modelList; }
private bool DoAdd() { bool result = false; Model.Order model = new Model.Order(); BLL.Order bll = new BLL.Order(); model.Code = "No" + DateTime.Now.ToString("yyyyMMddhhmmss"); model.AcceptOrderTime = Convert.ToDateTime(txtAcceptOrderTime.Text.Trim()); model.ArrivedTime = Convert.ToDateTime(txtArrivedTime.Text.Trim()); model.Shipper = ddlShipper.SelectedItem.Text; model.ShipperLinkMan = txtShipperLinkMan.Text.Trim(); model.ShipperLinkTel = txtShipperLinkTel.Text.Trim(); model.Receiver = ddlReceiver.SelectedItem.Text; model.ReceiverLinkMan = txtReceiverLinkMan.Text.Trim(); model.ReceiverLinkTel = txtReceiverLinkTel.Text.Trim(); model.ContractNumber = txtContractNumber.Text.Trim(); model.LoadingAddress = ddlLoadingAddress.SelectedItem.Text; model.UnloadingAddress = ddlUnloadingAddress.SelectedItem.Text; model.Goods = ddlGoods.SelectedItem.Text; model.Unit = txtUnit.Text.Trim(); model.IsCharteredCar = chkIsCharteredCar.Checked ? 1 : 0; model.Quantity = Convert.ToDecimal(txtQuantity.Text.Trim()); model.DispatchedCount = 0.00M; model.Haulway = ddlHaulway.SelectedItem.Text; model.LoadingCapacityRunning = Convert.ToDecimal(txtLoadingCapacityRunning.Text.Trim()); model.NoLoadingCapacityRunning = Convert.ToDecimal(txtNoLoadingCapacityRunning.Text.Trim()); model.BillNumber = txtBillNumber.Text.Trim(); model.WeighbridgeNumber = txtWeighbridgeNumber.Text.Trim(); model.Formula = ddlFormula.SelectedItem.Text; model.UnitPrice = Convert.ToDecimal(txtUnitPrice.Text.Trim()); model.TotalPrice = Convert.ToDecimal(txtTotalPrice.Text.Trim()); model.SettleAccountsWay = ddlSettleAccountsWay.SelectedValue; model.Status = 0; model.Remarks = txtRemarks.Text.Trim(); if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加订单:" + model.Code); //记录日志 result = true; } return result; }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Order GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id, Code, AcceptOrderTime, ArrivedTime, Shipper, ShipperLinkMan, ShipperLinkTel, Receiver, ReceiverLinkMan, ReceiverLinkTel, ContractNumber, LoadingAddress, UnloadingAddress, Goods, Unit, IsCharteredCar, Quantity, DispatchedCount, Haulway, LoadingCapacityRunning, NoLoadingCapacityRunning, BillNumber, WeighbridgeNumber, Formula, UnitPrice, TotalPrice, SettleAccountsWay, Status, Remarks "); strSql.Append(" from mtms_Order "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int,4) }; parameters[0].Value = Id; Model.Order model = new Model.Order(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.Code = ds.Tables[0].Rows[0]["Code"].ToString(); if (ds.Tables[0].Rows[0]["AcceptOrderTime"].ToString() != "") { model.AcceptOrderTime = DateTime.Parse(ds.Tables[0].Rows[0]["AcceptOrderTime"].ToString()); } if (ds.Tables[0].Rows[0]["ArrivedTime"].ToString() != "") { model.ArrivedTime = DateTime.Parse(ds.Tables[0].Rows[0]["ArrivedTime"].ToString()); } model.Shipper = ds.Tables[0].Rows[0]["Shipper"].ToString(); model.ShipperLinkMan = ds.Tables[0].Rows[0]["ShipperLinkMan"].ToString(); model.ShipperLinkTel = ds.Tables[0].Rows[0]["ShipperLinkTel"].ToString(); model.Receiver = ds.Tables[0].Rows[0]["Receiver"].ToString(); model.ReceiverLinkMan = ds.Tables[0].Rows[0]["ReceiverLinkMan"].ToString(); model.ReceiverLinkTel = ds.Tables[0].Rows[0]["ReceiverLinkTel"].ToString(); model.ContractNumber = ds.Tables[0].Rows[0]["ContractNumber"].ToString(); model.LoadingAddress = ds.Tables[0].Rows[0]["LoadingAddress"].ToString(); model.UnloadingAddress = ds.Tables[0].Rows[0]["UnloadingAddress"].ToString(); model.Goods = ds.Tables[0].Rows[0]["Goods"].ToString(); model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString(); if (ds.Tables[0].Rows[0]["IsCharteredCar"].ToString() != "") { model.IsCharteredCar = int.Parse(ds.Tables[0].Rows[0]["IsCharteredCar"].ToString()); } if (ds.Tables[0].Rows[0]["Quantity"].ToString() != "") { model.Quantity = decimal.Parse(ds.Tables[0].Rows[0]["Quantity"].ToString()); } if (ds.Tables[0].Rows[0]["DispatchedCount"].ToString() != "") { model.DispatchedCount = decimal.Parse(ds.Tables[0].Rows[0]["DispatchedCount"].ToString()); } model.Haulway = ds.Tables[0].Rows[0]["Haulway"].ToString(); if (ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString() != "") { model.LoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString()); } if (ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString() != "") { model.NoLoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString()); } model.BillNumber = ds.Tables[0].Rows[0]["BillNumber"].ToString(); model.WeighbridgeNumber = ds.Tables[0].Rows[0]["WeighbridgeNumber"].ToString(); model.Formula = ds.Tables[0].Rows[0]["Formula"].ToString(); if (ds.Tables[0].Rows[0]["UnitPrice"].ToString() != "") { model.UnitPrice = decimal.Parse(ds.Tables[0].Rows[0]["UnitPrice"].ToString()); } if (ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString()); } model.SettleAccountsWay = ds.Tables[0].Rows[0]["SettleAccountsWay"].ToString(); if (ds.Tables[0].Rows[0]["Status"].ToString() != "") { model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString()); } model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString(); return model; } else { return null; } }
public Model.Order RecordOrder(int id) { try { DataTable dt; dt = new DataTable(); dt = this.db.execQuery("Sp_OrderSelById", new object[] { id }); Model.Order rm = new Model.Order(); if (dt.Rows.Count > 0) { rm.order_id = Convert.ToInt16(dt.Rows[0]["order_id"].ToString()); rm.supplier_id = Convert.ToInt16(dt.Rows[0]["supplier_id"].ToString()); rm.order_date = dt.Rows[0]["order_date"].ToString(); } return rm; } catch (Exception ex) { throw ex; } }
private void ButtonOrderActionAdd_Click(object sender, EventArgs e) { var newOrderA = new Model.Order(); newOrderA = LoadOrder(newOrderA); newOrderA.dateMade = DateTime.Now; theGateContext.Orders.Add(newOrderA); theGateContext.SaveChanges(); Response.Redirect("OrderDetails.aspx?id=" + newOrderA.orderID); }
private bool DoAdd() { bool result = false; Model.Order model = new Model.Order(); BLL.Order bll = new BLL.Order(); model.TransportOrderId = Convert.ToInt32(ddlTransportOrder.SelectedValue); model.Code = string.Format("No{0}", DateTime.Now.ToString("yyyyMMddhhmmss")); model.AcceptOrderTime = Convert.ToDateTime(txtAcceptOrderTime.Text.Trim()); model.ArrivedTime = Convert.ToDateTime(txtArrivedTime.Text.Trim()); model.ContractNumber = txtContractNumber.Text.Trim(); model.BillNumber = txtBillNumber.Text.Trim(); model.WeighbridgeNumber = txtWeighbridgeNumber.Text.Trim(); model.IsCharteredCar = chkIsCharteredCar.Checked ? 1 : 0; model.Quantity = Convert.ToDecimal(txtQuantity.Text.Trim()); model.IsWeightNote = chkIsWeightNote.Checked; model.IsAllotted = chkIsAllotted.Checked; model.UnitPrice = Convert.ToDecimal(txtUnitPrice.Text.Trim()); model.Weight = Convert.ToDecimal(txtWeight.Text.Trim()); model.Freight = Convert.ToDecimal(txtFreight.Text.Trim()); model.PaidFreight = Convert.ToDecimal(txtPaidFreight.Text.Trim()); model.UnpaidFreight = Convert.ToDecimal(txtUnpaidFreight.Text.Trim()); model.HandlingCharge = Convert.ToDecimal(txtHandlingCharge.Text.Trim()); model.LoadingAddress = ddlLoadingAddress.SelectedItem.Text; model.UnloadingAddress = ddlUnloadingAddress.SelectedItem.Text; model.ShipperId = Convert.ToInt32(ddlShipper.SelectedValue); model.ReceiverId = Convert.ToInt32(ddlReceiver.SelectedValue); model.Haulway = ddlHaulway.SelectedItem.Text; model.LoadingCapacityRunning = Convert.ToDecimal(txtLoadingCapacityRunning.Text.Trim()); model.NoLoadingCapacityRunning = Convert.ToDecimal(txtNoLoadingCapacityRunning.Text.Trim()); model.GoodsId = Convert.ToInt32(ddlGoods.SelectedValue); model.Status = 0; model.Remarks = txtRemarks.Text.Trim(); model.CreateDateTime = DateTime.Now; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加订单:" + model.Code); //记录日志 result = true; } return result; }