• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DataContext.AnnonContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DeleteAllCurrentDevices

 public static void DeleteAllCurrentDevices(int orderId, int deviceId)
 {
     using (var context = new AnnonContext())
     {
         try
         {
             var currentDevices = context.CurrentDevices
                 .Where(s => s.DeviceID == deviceId
                 && s.OrderDetailID == orderId);
             foreach (var currentDevice in currentDevices)
             {
                 context.CurrentDevices.Remove(currentDevice);
             }
             context.SaveChanges();
         }
         catch (Exception e)
         {
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:20,代码来源:DeviceBLL.cs


示例17: DeleteAll

        /// <summary>
        /// 删除数据库中所有的图块信息
        /// </summary>
        /// <returns></returns>
        public static int DeleteAll()
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var imageBlocks = context.ImageBlocks;
                    foreach (var imageBlock in imageBlocks)
                    {
                        context.ImageBlocks.Remove(imageBlock);
                    }
                    return context.SaveChanges();
                }
                catch (Exception e)
                {
                    return -1;
                }

            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:24,代码来源:ImageBlockBLL.cs


示例18: DeleteAllOrderDetail

        //删除所有详细订单信息;
        public static int DeleteAllOrderDetail()
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var od = context.orderDetailInfoes;

                    foreach (var odd in od)
                    {
                        context.orderDetailInfoes.Remove(odd);
                    }
                    return context.SaveChanges();

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


示例19: DeleteAllOrder

        //删除所有订单数据;
        public static int DeleteAllOrder()
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var ois = context.ordersinfoes;

                    foreach (var os in ois)
                    {
                        context.ordersinfoes.Remove(os);
                    }
                    //context.ordersinfoes.Remove(ois);
                    return context.SaveChanges();
                }
                catch (Exception e)
                {
                    return -1;
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:22,代码来源:OrderBLL.cs


示例20: copyCurrentToOrder

 /// <summary>
 /// 复制临时表到订单表
 /// </summary>
 /// <param name="orderId"></param>
 /// <param name="deviceId"></param>
 /// <returns></returns>
 public static int copyCurrentToOrder(int orderId, int deviceId)
 {
     //首先刷新下价格
     refreshPriceConstraint(orderId, deviceId);
     using (var context = new AnnonContext())
     {
         try
         {
             deleteOrder(orderId);
             var currentValues = context.CatalogCurrentValues
                 .Where(s => s.OrderId == orderId
                 && s.DeviceId == deviceId);
             foreach (var currentValue in currentValues)
             {
                 context.CatalogOrders.Add(new CatalogOrder
                 {
                     PropertyName=currentValue.PropertyName,
                     OrderId=currentValue.OrderId,
                     DeviceId=currentValue.DeviceId,
                     Value=currentValue.Value,
                     SequenceNo=currentValue.SequenceNo,
                     Type=currentValue.Type,
                     Price=currentValue.Price,
                     PropertyParent=currentValue.PropertyParent,
                     ValueDescription=currentValue.ValueDescription
                 });
             }
             //foreach (var currentValue in currentValues)
             //{
             //    context.CatalogCurrentValues.Remove(currentValue);
             //}
             return context.SaveChanges();
         }
         catch (Exception e)
         {
             return -1;
         }
     }
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:45,代码来源:CatalogBLL.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Generated.acceptor类代码示例发布时间:2022-05-24
下一篇:
C# DataAccessLayer.clsParameterCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap