Пример #1
0
        /// <summary>
        /// 接口站点下单方法
        /// </summary>
        /// <param name="model">订单主表信息</param>
        /// <param name="modelList">订单明细集合</param>
        /// <returns>true:成功,false:失败</returns>
        public static bool Create(WebSiteSellOrderModel model, List<WebSiteSellOrderDetailModel> modelList)
        {
            bool res= Data.CustomAPI.CustomWebSite.WebSiteOrderDBHelper.Create(model, modelList);
            //如果下单成功  则短信通知


            return res;
           
        }
        /// <summary>
        /// 接口站点下单方法
        /// </summary>
        /// <param name="model">订单主表信息</param>
        /// <param name="modelList">订单明细集合</param>
        /// <returns>true:成功,false:失败</returns>
        public static bool Create(WebSiteSellOrderModel model, List<WebSiteSellOrderDetailModel> modelList)
        {
            /*用不保存SQL命令*/
            List<SqlCommand> CmdList = new List<SqlCommand>();

            #region 主表信息
            StringBuilder sbSql = new StringBuilder();
            sbSql.AppendLine(" INSERT INTO " + SYS_SCHEMANAME + ".WebStieSellOrder ");
            sbSql.AppendLine(" (OrderNo,CompanyCD,CustomID,Title,OrderDate,ConsignmentDate,Status,LoginID) VALUES ");
            sbSql.AppendLine(" (@OrderNo,@CompanyCD,@CustomID,@Title,@OrderDate,@ConsignmentDate,@Status,@LoginID )");

            SqlParameter[] Params = new SqlParameter[8];
            int index = 0;

            Params[index++] = SqlHelper.GetParameter("@OrderNo", model.OrderNo);
            Params[index++] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD);
            Params[index++] = SqlHelper.GetParameter("@CustomID", model.CustomID);
            Params[index++] = SqlHelper.GetParameter("@Title", model.Title);
            Params[index++] = SqlHelper.GetParameter("@OrderDate", model.OrderDate);
            Params[index++] = SqlHelper.GetParameter("@ConsignmentDate", model.ConsignmentDate);
            Params[index++] = SqlHelper.GetParameter("@Status", model.Status);
            Params[index++] = SqlHelper.GetParameter("@LoginID", model.LoginID);

            SqlCommand mainCmd = new SqlCommand(sbSql.ToString());
            mainCmd.Parameters.AddRange(Params);

            CmdList.Add(mainCmd);

            #endregion

            #region 明细信息
            foreach (WebSiteSellOrderDetailModel item in modelList)
            {

                SqlParameter[] DetailParams = null;
                SqlCommand cmd = new SqlCommand(GetDetailSql(item,ref  DetailParams));
                cmd.Parameters.AddRange(DetailParams);
                CmdList.Add(cmd);
            }
            #endregion

            return SqlHelper.ExecuteTransWithCollections(CmdList);

        }
        /// <summary>
        /// 修改订单方法
        /// </summary>
        /// <param name="model">站点订单主表信息</param>
        /// <param name="modelList">站点订单明细信息</param>
        /// <returns>true:成功,false:失败</returns>
        public static bool Edit(WebSiteSellOrderModel model, List<WebSiteSellOrderDetailModel> modelList)
        {
            /*保存SQL命令*/
            List<SqlCommand> CmdList = new List<SqlCommand>();

            #region 主表信息
            StringBuilder sbSql = new StringBuilder();
            sbSql.AppendLine(" UPDATE " + SYS_SCHEMANAME + ".WebStieSellOrder SET ");
            sbSql.AppendLine(" Title=@Title,OrderDate=@OrderDate,ConsignmentDate=@ConsignmentDate ,Status=@Status");
            sbSql.AppendLine(" WHERE ID=@ID ");

            SqlParameter[] Params = new SqlParameter[5];
            int index = 0;
            Params[index++] = SqlHelper.GetParameter("@Title", model.Title);
            Params[index++] = SqlHelper.GetParameter("@OrderDate", model.OrderDate);
            Params[index++] = SqlHelper.GetParameter("@ConsignmentDate", model.ConsignmentDate);
            Params[index++] = SqlHelper.GetParameter("@Status", model.Status);
            Params[index++] = SqlHelper.GetParameter("@ID", model.ID);

            SqlCommand MainCmd = new SqlCommand(sbSql.ToString());
            MainCmd.Parameters.AddRange(Params);
            CmdList.Add(MainCmd);
            #endregion

            #region 明细信息

            #region  清空以前的明细信息
            StringBuilder sbDel = new StringBuilder();
            sbDel.AppendLine(" DELETE " + SYS_SCHEMANAME + ".WebSiteSellOrderDetail WHERE OrderNo=@OrderNo AND CompanyCD=@CompanyCD  ");
            SqlParameter[] DelParams = new SqlParameter[2];
            DelParams[0] = SqlHelper.GetParameter("@OrderNo", model.OrderNo);
            DelParams[1] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD);

            SqlCommand delCmd = new SqlCommand(sbDel.ToString());
            delCmd.Parameters.AddRange(DelParams);
            #endregion

            #region 添加新的明细
            foreach (WebSiteSellOrderDetailModel item in modelList)
            {
                SqlParameter[] detailParams = null;
                SqlCommand detailCmd = new SqlCommand(GetDetailSql(item, ref detailParams));
                detailCmd.Parameters.AddRange(detailParams);
                CmdList.Add(detailCmd);
            }
            #endregion

            #endregion

            return SqlHelper.ExecuteTransWithCollections(CmdList);

        }
Пример #4
0
 /// <summary>
 /// 修改订单方法
 /// </summary>
 /// <param name="model">站点订单主表信息</param>
 /// <param name="modelList">站点订单明细信息</param>
 /// <returns>true:成功,false:失败</returns>
 public static bool Edit(WebSiteSellOrderModel model, List<WebSiteSellOrderDetailModel> modelList)
 {
     return Data.CustomAPI.CustomWebSite.WebSiteOrderDBHelper.Edit(model, modelList);
 }
Пример #5
0
 public bool CreateOrder(WebSiteSellOrderModel model, List<WebSiteSellOrderDetailModel> modelList)
 {
     return WebSiteOrderBus.Create(model, modelList);
 }