Example #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.BD_DisPrice model)
 {
     return(dal.Update(model));
 }
Example #2
0
    /// <summary>
    /// 确定并生效按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        SqlTransaction Tran = null;
        object         obj  = Session["GoodsPrice"];

        if (obj != null)
        {
            try
            {
                Tran = DBUtility.SqlHelper.CreateStoreTranSaction();
                string title       = Common.NoHTML(this.txtDisTitle.Value.Trim());   //调价标题
                string disNameList = Common.NoHTML(this.txtDisID1.Name.ToString());  //选择的代理商名称列表
                string disIdList   = Common.NoHTML(this.txtDisID1.Disid.ToString()); //选择的代理商Id列表
                string remark      = Common.NoHTML(this.txtRemark.Value.Trim());     //备注
                if (Util.IsEmpty(title))
                {
                    JScript.AlertMethod(this.Page, "调价标题不能为空", JScript.IconOption.错误);
                    return;
                }
                if (Util.IsEmpty(disNameList))
                {
                    JScript.AlertMethod(this.Page, "请选择代理商", JScript.IconOption.错误);
                    return;
                }
                Hi.Model.BD_DisPrice model2 = new Hi.Model.BD_DisPrice();
                //model2.Title = title;
                model2.CompID = this.CompID;
                model2.DisIDs = disIdList;
                //model2.DisNames = disNameList;
                //model2.Remark = remark;
                //model2.State = 0;
                model2.IsEnabled    = true;
                model2.CreateUserID = this.UserID;
                model2.CreateDate   = DateTime.Now;
                model2.dr           = 0;
                model2.ts           = DateTime.Now;
                model2.modifyuser   = this.UserID;
                int disPriceId = new Hi.BLL.BD_DisPrice().Add(model2, Tran);
                int z          = 0;
                List <Hi.Model.BD_GoodsPrice>   llll  = new List <Hi.Model.BD_GoodsPrice>();   //修改
                List <Hi.Model.BD_GoodsPrice>   llll2 = new List <Hi.Model.BD_GoodsPrice>();   //新增
                List <Hi.Model.BD_DisPriceInfo> llll3 = new List <Hi.Model.BD_DisPriceInfo>(); //新增
                // string disIdList = this.hidDisId.Value.Trim();//隐藏的选择代理商列表
                List <Hi.Model.BD_GoodsInfo> ll = obj as List <Hi.Model.BD_GoodsInfo>;
                foreach (Hi.Model.BD_GoodsInfo item in ll)
                {
                    List <Hi.Model.BD_GoodsPrice> lll = new Hi.BLL.BD_GoodsPrice().GetList("", "isnull(dr,0)=0 and isenabled=1 and disid in(" + disIdList + ") and compid=" + this.CompID + " and  goodsinfoid=" + item.ID, "", Tran);
                    if (lll.Count > 0)
                    {
                        foreach (Hi.Model.BD_GoodsPrice item2 in lll)
                        {
                            item2.IsEnabled  = false;
                            item2.modifyuser = this.UserID;
                            item2.ts         = DateTime.Now;
                            item2.CompID     = this.CompID;
                            llll.Add(item2);
                            //new Hi.BLL.BD_GoodsPrice().Update(llll);
                        }
                    }
                    for (int i = 0; i < disIdList.Split(',').Length; i++)
                    {
                        Hi.Model.BD_GoodsPrice   model  = new Hi.Model.BD_GoodsPrice();
                        Hi.Model.BD_DisPriceInfo model3 = new Hi.Model.BD_DisPriceInfo();

                        //model.DisPriceID = 0;
                        model.DisID       = Convert.ToInt32(disIdList.Split(',')[i]);
                        model.CompID      = this.CompID;
                        model.GoodsInfoID = item.ID;
                        if (Request["txtPrice"] != null)
                        {
                            model.TinkerPrice = Convert.ToDecimal(Request["txtPrice"].Split(',')[z]);
                        }
                        model.IsEnabled    = true;
                        model.CreateUserID = this.UserID;
                        model.CreateDate   = DateTime.Now;
                        model.ts           = DateTime.Now;
                        model.modifyuser   = this.UserID;
                        llll2.Add(model);

                        model3.DisPriceID = disPriceId;
                        //model3.DisID = Convert.ToInt32(disIdList.Split(',')[i]);
                        model3.CompID      = this.CompID;
                        model3.GoodsInfoID = item.ID;
                        if (Request["txtPrice"] != null)
                        {
                            model3.TinkerPrice = Convert.ToDecimal(Request["txtPrice"].Split(',')[z]);
                        }
                        model3.IsEnabled    = true;
                        model3.CreateUserID = this.UserID;
                        model3.CreateDate   = DateTime.Now;
                        model3.ts           = DateTime.Now;
                        model3.modifyuser   = this.UserID;
                        llll3.Add(model3);
                    }
                    z++;
                }
                new Hi.BLL.BD_GoodsPrice().Update(llll, Tran);
                new Hi.BLL.BD_GoodsPrice().Add(llll2, Tran);
                new Hi.BLL.BD_DisPriceInfo().Add(llll3, Tran);
                Tran.Commit();
                Response.Redirect("DispriceList.aspx");
                //  JScript.AlertMsg(this, "价格调整成功",);
            }
            catch (Exception)
            {
                if (Tran != null)
                {
                    if (Tran.Connection != null)
                    {
                        Tran.Rollback();
                    }
                }
                JScript.AlertMethod(this, "价格调整失败", JScript.IconOption.错误, "function(){location.href='DispriceList.aspx';}");
                return;
            }
        }
        else
        {
            JScript.AlertMethod(this.Page, "选择的商品数据有误", JScript.IconOption.错误);
            return;
        }
    }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.BD_DisPrice model)
 {
     return(dal.Add(model));
 }