コード例 #1
0
ファイル: OrderDetailBLL.cs プロジェクト: Spritutu/ntxx
        //复制详细订单信息;
        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;
                }
            }
        }
コード例 #2
0
ファイル: OrderDetailBLL.cs プロジェクト: Spritutu/ntxx
        //插入详细订单信息;
        /// <summary>
        ///插入订单详情
        /// </summary>
        /// <param name="OrderNum">订单排序号,废弃</param>
        /// <param name="OrderID">对应订单ID</param>
        /// <param name="OrderDID">对应组图和选型的ID</param>
        /// <param name="proDes">详情描述</param>
        /// <param name="qty">详情数量</param>
        /// <param name="type">对应的订单详情类型,//1的时候选型,2的时候选图,8的时候附件</param>
        /// <param name="DeviceID">对应的设备类型ID,8为附件</param>
        /// <returns></returns>
        public static int InsertOD1(int OrderNum, int OrderID, int OrderDID, string proDes, string qty, int type, int DeviceID,decimal listprice=0)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    orderDetailInfo od = new orderDetailInfo();

                    od.OrderInfoId = OrderID;
                    od.OrderDetailNo = OrderDID;
                    od.ProDes = proDes;
                    od.OdDetlNum = OrderNum;
                    od.Qty = qty;
                    od.OrderInfoType = type;
                    od.DeviceId = DeviceID;

                    od.listPrice = (listprice*Convert.ToInt32(qty)).ToString();
                    od.RepPrice = (listprice * Convert.ToInt32(qty)).ToString();
                    od.custPrice = (listprice * Convert.ToInt32(qty)).ToString();

                    context.orderDetailInfoes.Add(od);
                    return context.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    return -1;
                }
            }
        }
コード例 #3
0
ファイル: OrderDetailBLL.cs プロジェクト: Spritutu/ntxx
        //插入详细订单信息;
        public static int InsertOD(int OrderNum,int OrderID, int OrderDID, string proDes,int DeviceDtlID,int type=2)
        {
            using (var context = new AnnonContext())
            {
                try
                {
                    var od1 = context.orderDetailInfoes
                        .Where(s=>s.OrderDetailNo==OrderDID);

                    if(od1!=null&&od1.Count()!=0)
                    {
                        od1.First().ProDes = proDes;
                    }
                    else
                    {
                        orderDetailInfo od = new orderDetailInfo();

                        od.OrderInfoId = OrderID;
                        od.OrderDetailNo = OrderDID;
                        od.OdDetlNum = OrderNum;
                        od.ProDes = proDes;
                        od.OrderInfoType = type;
                        od.DeviceId = DeviceDtlID;

                        context.orderDetailInfoes.Add(od);
                    }
                    return context.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    return -1;
                }
            }
        }