当前位置: 首页>>代码示例>>C#>>正文


C# DataContext.AnnonContext类代码示例

本文整理汇总了C#中DataContext.AnnonContext的典型用法代码示例。如果您正苦于以下问题:C# AnnonContext类的具体用法?C# AnnonContext怎么用?C# AnnonContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnnonContext类属于DataContext命名空间,在下文中一共展示了AnnonContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: copyOrder

 /// <summary>
 /// 拷贝订单
 /// </summary>
 /// <param name="orderId"></param>
 /// <param name="newOrderId"></param>
 /// <returns></returns>
 public static int copyOrder(int orderId,int newOrderId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var catlogOrders = context.ContentOrders
                 .Where(s => s.OrderID == orderId);
             foreach (var catlog in catlogOrders)
             {
                 context.ContentOrders.Add(new ContentOrder
                 {
                     PropertyName = catlog.PropertyName,
                     OrderID=newOrderId,
                     Value = catlog.Value,
                     ModuleTag=catlog.ModuleTag,
                     ImageName=catlog.ImageName,
                     CoolingPower=catlog.CoolingPower,
                     Price=catlog.Price,
                     Guid=catlog.Guid,
                     Items=catlog.Items
                 });
             }
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:37,代码来源:ContentBLL.cs

示例2: copyCurrentToOrder

 /// <summary>
 /// 将临时表复制到订单表中,在最终需要到订单时保存时需要
 /// </summary>
 /// <param name="orderId"></param>
 /// <returns></returns>
 public static int copyCurrentToOrder(int orderId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             //先要删除对应orderId的订单
             deleteOrder(orderId);
             var contentCurrentValues = context.ContentCurrentValues
                 .Where(s => s.OrderID == orderId);
             //将临时表数据复制到订单中
             foreach (var ccv in contentCurrentValues)
             {
                 context.ContentOrders.Add(new ContentOrder
                     {
                         ModuleTag = ccv.ModuleTag,
                         PropertyName = ccv.PropertyName,
                         Value = ccv.Value,
                         ImageName = ccv.ImageName,
                         CoolingPower = ccv.CoolingPower,
                         OrderID = ccv.OrderID,
                         Guid=ccv.Guid,
                         Price=ccv.Price,
                         Items=ccv.Items
                     });
             }
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:39,代码来源:ContentBLL.cs

示例3: CopyOrderDetail

        //复制详细订单信息;
        public static int CopyOrderDetail(int OrderDtIfID,int newOrderID)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var od1 = context.orderDetailInfoes
                        .Where(s => s.orderDetailInfoID == OrderDtIfID)
                        .First();

                    orderDetailInfo od2 = new orderDetailInfo
                    {
                        OrderInfoId = od1.OrderInfoId,
                        OrderDetailNo = newOrderID,
                        Qty = od1.Qty,
                        custPrice = od1.custPrice,
                        listPrice = od1.listPrice,
                        RepPrice = od1.RepPrice,
                        tag = od1.tag,
                        ProDes = od1.ProDes,
                        OrderInfoType=od1.OrderInfoType,
                        OdDetlNum=ReturnLastNum()+1,
                        DeviceId=od1.DeviceId
                    };

                    context.orderDetailInfoes.Add(od2);
                    return context.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    return -1;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:35,代码来源:OrderDetailBLL.cs

示例4: copyOrder

        /// <summary>
        /// 拷贝订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static int copyOrder(int orderId)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    int newOrderId = 1;
                    var currentOrder = context.UnitOrders
                        .Select(s => s.OrderId);
                    if (currentOrder.Count() != 0)
                        newOrderId = currentOrder.Max() + 1;

                    var catlogOrders = context.UnitOrders
                        .Where(s => s.OrderId == orderId);
                    foreach (var catlog in catlogOrders)
                    {
                        context.UnitOrders.Add(new UnitOrder
                        {
                            PropertyName = catlog.PropertyName,
                            OrderId = newOrderId,
                            Value = catlog.Value
                        });
                    }
                     context.SaveChanges();
                     return newOrderId;
                }
                catch (Exception e)
                {
                    return -1;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:37,代码来源:UnitBLL.cs

示例5: getImageBlocksByNames

        /// <summary>
        /// 根据冷量和图块的名得到所有的满足条件的图块信息
        /// </summary>
        /// <param name="names"></param>
        /// <param name="coolingPower"></param>
        /// <returns></returns>
        public static List<ImageBlock> getImageBlocksByNames(List<PictureBoxInfo> pictureBoxInfos, int coolingPower)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    List<ImageBlock> imageBlocks = new List<ImageBlock>();
                    foreach (var pictureBoxInfo in pictureBoxInfos)
                    {
                        string name = null;
                        if (pictureBoxInfo.name == "virtualHRA")
                        {
                            name = "HRA";
                        }
                        else
                        {
                            name = pictureBoxInfo.name;
                        }

                        var imageBlock = context.ImageBlocks
                            .Where(s => s.ImageName == name
                            && s.CoolingPower == coolingPower)
                            .First();
                        imageBlocks.Add(imageBlock);
                    }
                    //这里的imageBlock(virtualHRA)的高度还是为HRA的高度要注意
                    return imageBlocks;
                }
                catch (Exception e)
                {
                    return null;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:40,代码来源:ImageBlockBLL.cs

示例6: CopyOrder

        //复制一条订单;
        public static int CopyOrder(int orderID)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var ois = context.ordersinfoes
                        .Where(s => s.ordersinfoID == orderID)
                        .First();

                    ordersinfo oi = new ordersinfo
                    {
                        OrderNo=ReturnLastNum()+1,
                        JobNum = ois.JobNum,
                        JobName = ois.JobName,
                        JobDes = ois.JobDes,
                        Site = ois.Site,
                        Customer = ois.Customer,
                        Activity = ois.Activity,
                        AAonCon = ois.AAonCon,
                    };
                    context.ordersinfoes.Add(oi);
                    return context.SaveChanges();
                }
                catch (Exception e)
                {
                    return -1;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:31,代码来源:OrderBLL.cs

示例7: copyCurrentToOrder

 /// <summary>
 /// 将临时表中的数据复制到订单中
 /// </summary>
 /// <param name="orderId"></param>
 /// <returns></returns>
 public static int copyCurrentToOrder(int orderId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             //先删除已有orderId的订单
             deleteOrder(orderId);
             var unitOrders = context.UnitCurrentValues
                 .Where(s => s.OrderId == orderId);
             //将临时表中的数据复制到订单表中
             foreach (var unitOrder in unitOrders)
             {
                 context.UnitOrders.Add(new UnitOrder
                 {
                     PropertyName = unitOrder.PropertyName,
                     Value = unitOrder.Value,
                     OrderId = unitOrder.OrderId,
                 });
             }
             ////删除临时表中的数据
             //foreach (var uo in unitOrders)
             //{
             //    context.UnitCurrentValues.Remove(uo);
             //}
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:38,代码来源:UnitBLL.cs

示例8: getFacility

        /// <summary>
        /// 
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="deviceId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        //public static List<Facility> getFacility(int orderId, int deviceId, string type)
        //{
        //    using (var context = new AnnonContext())
        //    {
        //        try
        //        {
        //            var facilityList = from x in context.CatalogOrders
        //                               join y in context.CatalogPropertyValues
        //                               on new { K1 = x.PropertyName, K2 = x.Value }
        //                               equals new { K1 = y.PropertyName, K2 = y.Value }
        //                               where x.OrderId == orderId && y.DeviceId == deviceId && x.Type == type
        //                               orderby x.SequenceNo
        //                               select new Facility
        //                               {
        //                                   PropertyName= y.PropertyName,
        //                                   Value= y.Value,
        //                                   PropertyParent= y.PropertyParent,
        //                                   ValueDescription= y.ValueDescription
        //                               };
        //            return facilityList.ToList();
        //        }
        //        catch (Exception e)
        //        {
        //            return null;
        //        }
        //    }
        //}
        public static List<Facility> getFacility(int orderId, int deviceId, string type)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var facilityList =
                        context.CatalogCurrentValues
                        .Where(s => s.DeviceId == deviceId
                            && s.OrderId == orderId
                            && s.Type == type)
                            .Select(y => new Facility
                            {
                                PropertyName = y.PropertyName,
                                Value = y.Value,
                                PropertyParent = y.PropertyParent,
                                ValueDescription = y.ValueDescription,
                                Price=y.Price
                            });

                    return facilityList.ToList();
                }
                catch (Exception e)
                {
                    return null;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:62,代码来源:FacilityBLL.cs

示例9: getAccessories

 /// <summary>
 /// 根据类型得到所有的附件
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static List<Accessory> getAccessories(string type)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var accessories = context.Accessories
                 .Where(s => s.Type.Equals(type));
             return accessories.ToList();
         }
         catch (Exception e)
         {
             return null;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:21,代码来源:AccessoryBLL.cs

示例10: getOderDetail

        public static DataTable getOderDetail()
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var orderDetailIds = context.CurrentDevices
                        .Select(s => s.OrderDetailID)
                        .Distinct();

                    DataTable dataTable = new DataTable("OderDetail");
                    dataTable.Columns.Add("OrderId",System.Type.GetType("System.String"));
                    dataTable.Columns.Add("DeviceType", System.Type.GetType("System.String"));
                    dataTable.Columns.Add("DeviceId", System.Type.GetType("System.String"));
                    dataTable.Columns.Add("OrderDetail", System.Type.GetType("System.String"));
                    dataTable.Columns.Add("SumPrice", System.Type.GetType("System.Decimal"));

                    foreach (var orderDetailId in orderDetailIds)
                    {
                        string orderStr = string.Empty;
                        decimal sumPrice = 0;
                        var ptyValueArray = context.CurrentDevices
                            .Where(s => s.OrderDetailID == orderDetailId)
                            .Distinct();
                        foreach (var ptyValue in ptyValueArray)
                        {
                            orderStr += ptyValue.PropertyValueId;
                            orderStr += ",";
                            sumPrice += PropertyBLL.getPriceByPtyIdandValue(ptyValue.PropertyID, ptyValue.PropertyValueId, 1);
                        }
                        orderStr = orderStr.Substring(0, orderStr.Length - 1);
                        DataRow dataRow=dataTable.NewRow();
                        dataRow["OrderId"]=orderDetailId;
                        dataRow["DeviceType"] = "设备";
                        dataRow["DeviceId"] = "1";
                        dataRow["OrderDetail"]=orderStr;
                        dataRow["SumPrice"] = sumPrice;
                        dataTable.Rows.Add(dataRow);
                    }
                    return dataTable;
                }
                catch (Exception e)
                {
                    return null;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:47,代码来源:DeviceBLL.cs

示例11: GetAllDevices

 /// <summary>
 /// 返回所有设备类型
 /// </summary>
 /// <returns></returns>
 public static List<Device> GetAllDevices()
 {
     using (var context = new AnnonContext())
     {
         try
         {
             //var devices = from u in context.Devices
             //              select u;
             var devices = context.Devices.ToList();
             return devices.ToList();
         }
         catch (Exception e)
         {
             return null;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:21,代码来源:DeviceBLL.cs

示例12: deleteOrder

 /// <summary>
 /// 删除制定订单
 /// </summary>
 /// <param name="accessoryId"></param>
 /// <returns></returns>
 public static int deleteOrder(int accessoryId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var accessoryOrder = context.AccessoryOrders
                 .Where(s => s.AccessoryOrderID == accessoryId)
                 .First();
             context.AccessoryOrders.Remove(accessoryOrder);
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:23,代码来源:AccessoryBLL.cs

示例13: DeleteOrder

 //删除订单信息;
 public static int DeleteOrder(int orderID)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var ois = context.ordersinfoes
                 .Where(s => s.ordersinfoID == orderID)
                 .ToList();
            context.ordersinfoes.Remove(ois.First());
            return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:19,代码来源:OrderBLL.cs

示例14: getDescription

 /// <summary>
 /// 
 /// </summary>
 /// <param name="orderDetailId"></param>
 /// <returns></returns>
 public static string getDescription(int orderDetailId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var orderDetailInfo = context.orderDetailInfoes
                 .Where(s => s.OrderDetailNo == orderDetailId)
                 .First()
                 .ProDes;
             return orderDetailInfo;
         }
         catch (Exception e)
         {
             return string.Empty;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:23,代码来源:FacilityBLL.cs

示例15: DeleteAllProperties

 /// <summary>
 /// 删除约束中的所有内容
 /// </summary>
 /// <returns></returns>
 public static int DeleteAllProperties()
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var properties = context.Properties;
             foreach (var property in properties)
             {
                 context.Properties.Remove(property);
             }
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:23,代码来源:PropertyBLL.cs


注:本文中的DataContext.AnnonContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。