/// <summary> /// 添加订单详情 /// </summary> /// <param name="o"></param> /// <returns></returns> public int AddOrderDesc(OrderDesc o) { o.OrderDescStartTime = DateTime.Now.ToString(); string sql = $"insert into OrderDesc values('{o.OrderDescName}','{o.OrderDescPhone}','{o.OrderDescPosstion}','{o.OrderDescStartTime}',{o.OrderDescMoney},{o.OrderInfoIdOut},'{o.OrderDescRemark}')"; return(DapperHelper.Cud(sql)); }
public List <OrderDesc> GetOrderListDesc() { try { var orderList = GetOrderList(); List <OrderDesc> orderDescs = new List <OrderDesc>(); CustomerManager customerManager = new CustomerManager(); foreach (Order order in orderList) { OrderDesc orderDesc = new OrderDesc(); orderDesc = OrderAccessor.FetchOrderListDesc(order.OrderID); /* * orderDesc.OrderID = order.OrderID; * orderDesc.StaffID = order.StaffID; * orderDesc.DateOrdered = order.DateOrdered; */ Customer customer = new Customer(); customer = customerManager.GetCustomerByID(order.CustomerID); orderDesc.StaffName = customer.LastName + ", " + customer.FirstName; orderDescs.Add(orderDesc); } if (orderList.Count > 0) { return(orderDescs); } else { throw new ApplicationException("There were no records found."); } } catch (Exception) { throw; } }
public static OrderDesc FetchOrderListDesc(int orderID) { OrderDesc order = new OrderDesc(); SqlConnection conn = DBConnection.GetDBConnection(); var query = @"sp_select_orderdesc_by_order"; SqlCommand cmd = new SqlCommand(query, conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@orderID", orderID); try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { order = new OrderDesc() { OrderID = reader.GetInt32(0), CustomerID = reader.GetInt32(1), DateOrdered = reader.GetDateTime(2), Quantity = reader.GetInt32(3), Title = reader.GetString(4) }; } } catch (Exception) { throw; } finally { conn.Close(); } return(order); }
/// <summary> /// 添加订单详情 /// </summary> /// <param name="o"></param> /// <returns></returns> public int AddOrderDesc(OrderDesc o) { return(dal.AddOrderDesc(o)); }
public int AddOrderDesc([FromForm] OrderDesc o) { return(BLLOrderInfo.AddOrderDesc(o)); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (Source.IsNullOrWhiteSpace()) { Source = Url.Action(DefaultSourceAction); } if (GridClass.IsNullOrWhiteSpace()) { GridClass = DefaultClass; } if (ModelType == null) { ModelType = ViewContext.ViewData.ModelMetadata.ModelType; if (OrderAsc.IsNullOrEmpty() && OrderDesc.IsNullOrEmpty() && typeof(EditorEntity).IsAssignableFrom(ModelType)) { OrderDesc = "LastUpdateDate"; } } var viewConfig = ServiceLocator.GetViewConfigure(ModelType); var localize = ServiceLocator.GetService <ILocalize>(); StringBuilder tableHeaderBuilder = new StringBuilder(); StringBuilder tableSearchBuilder = new StringBuilder(); if (viewConfig != null) { var primaryKey = viewConfig.MetaData.Properties.Select(m => m.Value).FirstOrDefault(m => m.CustomAttributes.Any(attr => attr.AttributeType == typeof(KeyAttribute))); if ((EditAble ?? true) && primaryKey != null) { string name = primaryKey.Name.FirstCharToLowerCase(); if (name.Length == 2) { name = name.ToLower(); } if (Edit.IsNullOrWhiteSpace()) { Edit = Url.Action(DefaultEditAction) + "/{" + name + "}"; } if (Delete.IsNullOrWhiteSpace()) { Delete = Url.Action(DefaultDeleteAction) + "/{" + name + "}"; } string manager = (EditTemplate ?? EditLinkTemplate).FormatWith(Edit); if (DeleteAble ?? true) { manager += " " + (DeleteTemplate ?? DeleteLinkTemplate).FormatWith(Delete); } tableHeaderBuilder.AppendFormat(TableHeadStructure, string.Empty, WebUtility.HtmlEncode(manager), string.Empty, ActionLable ?? localize.Get("操作"), string.Empty, Query.Operators.None, string.Empty, string.Empty); tableSearchBuilder.Append(TableSearchStructure); } var columns = viewConfig.GetViewPortDescriptors(true) .Where(m => m.IsShowInGrid) .Each(m => { var dropDown = m as DropDownListDescriptor; StringBuilder optionBuilder = new StringBuilder(); if (dropDown != null) { if (dropDown.OptionItems != null && dropDown.OptionItems.Any()) { foreach (var item in dropDown.OptionItems) { optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", item.Value, item.Key); } } else if (dropDown.SourceType == Constant.SourceType.ViewData) { var selectList = ViewContext.ViewData[dropDown.SourceKey] as SelectList; if (selectList != null) { foreach (var item in selectList) { optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", item.Text, item.Value); } } } } else if (m.DataType == typeof(bool) || m.DataType == typeof(bool?)) { optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", localize.Get("是"), "true"); optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", localize.Get("否"), "false"); } tableHeaderBuilder.AppendFormat(TableHeadStructure, m.Name.FirstCharToLowerCase(), WebUtility.HtmlEncode(m.GridColumnTemplate), OrderAsc == m.Name ? "asc" : OrderDesc == m.Name ? "desc" : "", m.DisplayName, optionBuilder.Length == 0 ? string.Empty : WebUtility.HtmlEncode($"[{optionBuilder.ToString().Trim(',')}]"), m.SearchOperator, m.DataType.Name, (m as TextBoxDescriptor)?.JavaScriptDateFormat); tableSearchBuilder.Append(TableSearchStructure); }); } output.TagName = "div"; //output.Attributes.Add("class", "container-fluid"); output.Content.SetHtmlContent(TableStructure.FormatWith(GridClass, Source, tableHeaderBuilder, tableSearchBuilder)); }