コード例 #1
0
        public string CreateOrderGoodsDoc(string orderid, string taskid, EnumGoodsDocType type, int isover, string expressid, string expresscode, string details, string remark, string operateid, string agentid, string clientid)
        {
            var dal = new OrdersDAL();
            string id = Guid.NewGuid().ToString().ToLower();

            bool bl = dal.CreateOrderGoodsDoc(id, orderid,taskid, (int)type, isover, expressid, expresscode, details, remark, operateid, clientid);
            if (bl)
            {
                LogBusiness.AddActionLog(IntFactoryEnum.EnumSystemType.Client, IntFactoryEnum.EnumLogObjectType.OrderDoc, EnumLogType.Create, "", operateid, agentid, clientid);
                return id;
            }
            return "";
        }
コード例 #2
0
        public string CreateDHOrder(string orderid, int ordertype, decimal discount, decimal price, List<ProductDetail> details, string operateid, string agentid, string clientid, string yxOrderID="")
        {
            var dal = new OrdersDAL();
            string id = Guid.NewGuid().ToString().ToLower();

            if (ordertype == 2)
            {
                if (!UpdateOrderDiscount(orderid, discount, price, operateid, "", agentid, clientid))
                {
                    return "";
                }
            }

            SqlConnection conn = new SqlConnection(BaseDAL.ConnectionString);
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            SqlTransaction tran = conn.BeginTransaction();
            try
            {
                //打样单
                if (ordertype == (int)EnumOrderType.ProofOrder)
                {
                    bool bl = dal.CreateDHOrder(id, orderid, discount, price, operateid, clientid,yxOrderID, tran);
                    //产品添加成功添加子产品
                    if (bl)
                    {
                        foreach (var model in details)
                        {
                            if (!dal.AddOrderGoods(id, model.SaleAttr, model.AttrValue, model.SaleAttrValue, model.Quantity, model.Description, operateid, clientid, tran))
                            {
                                tran.Rollback();
                                conn.Dispose();
                                return "";
                            }
                        }
                        tran.Commit();
                        conn.Dispose();
                        //日志
                        LogBusiness.AddActionLog(IntFactoryEnum.EnumSystemType.Client, IntFactoryEnum.EnumLogObjectType.Orders, EnumLogType.Create, "", operateid, agentid, clientid);
                        
                        return id;
                    }
                }
                else
                {
                    foreach (var model in details)
                    {
                        if (!dal.AddOrderGoods(orderid, model.SaleAttr, model.AttrValue, model.SaleAttrValue, model.Quantity, model.Description, operateid, clientid, tran))
                        {
                            tran.Rollback();
                            conn.Dispose();
                            return "";
                        }
                    }
                    tran.Commit();
                    conn.Dispose();
                    return orderid;
                }
                
                return "";
            }
            catch (Exception ex)
            {
                tran.Rollback();
                conn.Dispose();
                return "";
            }
        }