Пример #1
0
        public void Product_Add()
        {
            if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "product"))
            {
                return;
            }
            DataTable table  = new DataTable();
            M_Product proMod = FillProductModel(ref table, proBll.GetproductByid(Mid));

            if (Mid < 1)
            {
                proMod.ID = proBll.Add(table, proMod);
                IsAddStock(proMod, DataConvert.CLng(Request.Form["Stock"]));
                //多区域价格
                SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", Request.Form["ProGuid"]) };
                SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp);
            }
            else
            {
                proBll.Update(table, proMod);
            }
            IsUserProduct(proMod, Request.Form["uprouids_old_hid"], Request.Form["uprouids_hid"]);
            IsNeedVerBak(proMod);
            IsHaveMaterial(proMod);
            IsHavePresent(proMod);
            Response.Redirect(CustomerPageAction.customPath + "Shop/ProductShow.aspx?ID=" + proMod.ID);
        }
Пример #2
0
        public void Product_Add()
        {
            DataTable table  = new DataTable();
            M_Product proMod = FillProductModel(ref table, proBll.GetproductByid(Mid));

            if (Mid < 1)
            {
                proMod.ID = proBll.Add(table, proMod);
                IsAddStock(proMod, DataConvert.CLng(Request.Form["Stock"]));
                //多区域价格
                //SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", Request.Form["ProGuid"]) };
                //SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp);
            }
            else
            {
                proBll.Update(table, proMod);
            }
            function.WriteSuccessMsg("操作成功", "ProductList?NodeID=" + proMod.Nodeid); return;
        }
Пример #3
0
        public IActionResult Product_Add()
        {
            //不支持版本备份,不支持会员特选
            DataTable table  = new DataTable();
            M_Product proMod = FillProductModel(ref table, proBll.GetproductByid(Mid));

            if (Mid < 1)
            {
                proMod.ID = proBll.Add(table, proMod);
                IsAddStock(proMod, DataConvert.CLng(RequestEx["Stock"]));
                //多区域价格
                SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", RequestEx["ProGuid"]) };
                SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp);
            }
            else
            {
                proBll.Update(table, proMod);
            }
            IsHavePresent(proMod);
            return(WriteOK("操作成功", "ProductList"));
        }
Пример #4
0
    //保存
    protected void EBtnSubmit_Click(object sender, EventArgs e)
    {
        #region 团购
        if (Request.Form["ProClass"].Equals("4"))
        {
            if (ColonelStartTimetxt.Text.Trim() == "")
            {
                function.WriteErrMsg("请输入团购开始时间");
            }
            if (ColonelendTimetxt.Text.Trim() == "")
            {
                function.WriteErrMsg("请输入团购结束时间");
            }
            if (txtColoneDeposit.Text.Trim() == "")
            {
                function.WriteErrMsg("请输入团购订金");
            }
        }
        #endregion
        string       adminname = buser.GetLogin().UserName;
        DataTable    dt        = bfield.GetModelFieldList(ModelID);
        DataTable    table     = new Call().GetDTFromPage(dt, Page, ViewState);
        M_CommonData CCate     = new M_CommonData();
        M_Product    proMod    = new M_Product();
        if (ProID > 0)
        {
            proMod = bll.GetproductByid(ProID);
        }
        CCate.Status       = istrue_Chk.Checked ? 99 : 0;
        CCate.NodeID       = NodeID;
        CCate.ModelID      = ModelID;
        CCate.TableName    = bmode.GetModelById(ModelID).TableName;
        CCate.Title        = Proname.Text;
        CCate.Inputer      = adminname;
        CCate.PdfLink      = "";
        CCate.FirstNodeID  = bnode.SelFirstNodeID(NodeID);
        CCate.EliteLevel   = DataConverter.CLng(Dengji.SelectedValue) > 3 ? 1 : 0;
        CCate.InfoID       = "";
        CCate.SpecialID    = "";
        CCate.Template     = ModeTemplate_hid.Value;
        CCate.DefaultSkins = 0;
        /*--------------proMod------------*/
        proMod.Istrue     = 1;
        proMod.Class      = 0;
        proMod.Nodeid     = NodeID;
        proMod.ModelID    = ModelID;
        proMod.Categoryid = DataConverter.CLng(Categoryid.Value);
        proMod.AddUser    = string.IsNullOrEmpty(txtCountHits.Text) ? adminname : txtCountHits.Text;
        if (string.IsNullOrEmpty(proMod.ProCode))
        {
            proMod.ProCode = GetProCode();
        }
        proMod.BarCode      = BarCode.Text.Trim();
        proMod.Proname      = Proname.Text.Trim();
        proMod.Kayword      = Kayword.Text;
        proMod.ProUnit      = ProUnit.Text;
        proMod.AllClickNum  = DataConverter.CLng(Request.Form["AllClickNum"]);
        proMod.Weight       = DataConverter.CLng(Weight.Text);
        proMod.ServerPeriod = DataConverter.CLng(ServerPeriod.Text);
        proMod.ServerType   = DataConverter.CLng(ServerType.SelectedValue);
        proMod.ExpRemind    = Convert.ToInt32(expRemindDP.SelectedValue);
        proMod.ProClass     = DataConverter.CLng(Request.Form["ProClass"]);
        #region 团购
        if (proMod.ProClass == 4)
        {
            if (!string.IsNullOrEmpty(hfBeginTime.Value.Trim()) && !string.IsNullOrEmpty(hfEndTime.Value))
            {
                proMod.ColonelTime = hfBeginTime.Value + "|" + hfEndTime.Value;
            }
            else
            {
                proMod.ColonelTime = ColonelStartTimetxt.Text + "|" + ColonelendTimetxt.Text;
                proMod.Sold        = 0;
            }
        }
        #endregion
        proMod.ColoneDeposit = DataConverter.CDouble(txtColoneDeposit.Text);
        proMod.Properties    = 0;
        proMod.PointVal      = DataConverter.CLng(txtPoint.Text);
        proMod.Sales         = Sales_Chk.Checked ? 1 : 2;
        proMod.Proinfo       = Proinfo.Text;
        proMod.Procontent    = Procontent.Value;
        proMod.Clearimg      = txt_Clearimg.Text;
        proMod.Thumbnails    = txt_Thumbnails.Text;
        proMod.Producer      = Producer.Text;
        proMod.Brand         = Brand.Text;
        proMod.Wholesaleone  = Wholesaleone.Checked ? 1 : 0;
        proMod.Quota         = DataConverter.CLng(Quota.Text);
        proMod.DownQuota     = DataConverter.CLng(DownQuota.Text);
        proMod.Stock         = (DataConverter.CLng(Stock.Text) == 0) ? DataConverter.CLng(Stock.Text) : DataConverter.CLng(Stock.Text);
        proMod.StockDown     = DataConverter.CLng(StockDown.Text);
        proMod.JisuanFs      = DataConverter.CLng(JisuanFs.SelectedValue);
        proMod.Rate          = DataConverter.CDouble(Rate.Text);
        proMod.Rateset       = DataConverter.CLng(Rateset.SelectedValue);
        proMod.Dengji        = DataConverter.CLng(Dengji.SelectedValue);
        proMod.ShiPrice      = DataConverter.CDouble(ShiPrice.Text);
        proMod.LinPrice      = DataConverter.CDouble(LinPrice.Text);
        proMod.LinPrice_Json = JsonHelper.AddVal("purse,sicon,point".Split(','), LinPrice_Purse_T.Text, LinPrice_Sicon_T.Text, LinPrice_Point_T.Text);
        proMod.Preset        = (OtherProject.SelectedValue == null) ? "" : OtherProject.SelectedValue; //促销
        proMod.Integral      = DataConverter.CLng(Integral.Text);
        proMod.Propeid       = DataConverter.CLng(Propeid.Text);
        proMod.Recommend     = DataConverter.CLng(txtRecommend.Text);
        proMod.Recommend     = proMod.Recommend < 1 ? 0 : proMod.Recommend;//不允许负数
        proMod.Largesspirx   = DataConverter.CLng(Largesspirx.Text);
        proMod.AllClickNum   = DataConverter.CLng(txtCountHits.Text);
        proMod.UpdateTime    = DataConverter.CDate(UpdateTime.Text);
        proMod.ModeTemplate  = ModeTemplate_hid.Value;
        proMod.FirstNodeID   = CCate.FirstNodeID;
        proMod.bookDay       = DataConverter.CLng(txtBookDay.Text);
        proMod.BookPrice     = DataConverter.CDouble(txtBookPrice.Text);
        proMod.FestlPrice    = DataConverter.CDouble(txtDayPrice.Text);
        proMod.FestPeriod    = CheckInDate.Text + "|" + CheckOutDate.Text;
        proMod.UserType      = DataConverter.CLng(Request.Form["ctl00$Content$UserPrice_Rad"]);
        proMod.ParentID      = ParentID > 0 ? ParentID : proMod.ParentID;
        proMod.FarePrice     = FareTlp_Rad.SelectedValue;
        if (UserPrice0_Rad.Checked)
        {
            proMod.UserPrice = userPrice.Text;
        }
        else if (UserPrice1_Rad.Checked)
        {
            for (int i = 0; i < repGroup.Items.Count; i++)
            {
                string gid    = (repGroup.Items[i].FindControl("groupID") as HiddenField).Value;
                string gprice = (repGroup.Items[i].FindControl("GroupPrice") as TextBox).Text;
                proMod.UserPrice += gid + "|" + gprice + ",";
            }
        }
        proMod.AddUser     = adminname;
        proMod.DownCar     = 0;
        proMod.ProjectType = DataConverter.CLng(ProjectType.SelectedValue);
        switch (proMod.ProjectType)
        {
            #region 促销
        case 1:
            proMod.ProjectPronum = 0;
            proMod.ProjectMoney  = 0;
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = "";
            proMod.PesentNameid  = 0;
            break;

        case 2:
            proMod.ProjectPronum = DataConverter.CLng(ProjectPronum2.Text);
            proMod.ProjectMoney  = 0;
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = "";
            proMod.PesentNameid  = 0;
            break;

        case 3:
            proMod.ProjectPronum = DataConverter.CLng(ProjectPronum3.Text);
            proMod.ProjectMoney  = 0;
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = Productsname3.Text;
            proMod.PesentNameid  = DataConverter.CLng(HiddenField3.Value);
            break;

        case 4:
            proMod.ProjectPronum = DataConverter.CLng(ProjectPronum4.Text);
            proMod.ProjectMoney  = 0;
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = "";
            proMod.PesentNameid  = 0;
            break;

        case 5:
            proMod.ProjectPronum = DataConverter.CLng(ProjectPronum5.Text);
            proMod.ProjectMoney  = 0;
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = Productsname5.Text;
            proMod.PesentNameid  = DataConverter.CLng(HiddenField5.Value);
            break;

        case 6:
            proMod.ProjectPronum = 0;
            proMod.ProjectMoney  = DataConverter.CDouble(ProjectMoney6.Text);
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = Productsname6.Text;
            proMod.PesentNameid  = DataConverter.CLng(HiddenField6.Value);
            break;

        case 7:
            proMod.ProjectPronum = 0;
            proMod.ProjectMoney  = DataConverter.CDouble(ProjectMoney7.Text);
            proMod.IntegralNum   = DataConverter.CLng(IntegralNum.Text);
            proMod.PesentNames   = Productsname7.Text;
            proMod.PesentNameid  = DataConverter.CLng(HiddenField7.Value);
            break;
            #endregion
        }
        proMod.UpdateTime     = DateTime.Now;
        proMod.TableName      = bmode.GetModelById(ModelID).TableName;
        proMod.Istrue         = istrue_Chk.Checked ? 1 : 0;
        proMod.Isgood         = 0;
        proMod.MakeHtml       = 0;
        proMod.Ishot          = ishot.Checked ? 1 : 0;
        proMod.Isnew          = isnew.Checked ? 1 : 0;
        proMod.Isbest         = isbest.Checked ? 1 : 0;
        proMod.Allowed        = Allowed.Checked ? 1 : 0;
        proMod.GuessXML       = Request.Form["GuessXML"];
        proMod.Wholesalesinfo = ChildPro_Hid.Value;
        //捆绑商品
        if (!string.IsNullOrEmpty(Bind_Hid.Value))
        {
            //获取绑定商品
            DataTable binddt = JsonHelper.JsonToDT(Bind_Hid.Value);
            proMod.BindIDS = "";
            foreach (DataRow dr in binddt.Rows)
            {
                proMod.BindIDS += dr["ID"] + ",";
            }
            proMod.BindIDS = proMod.BindIDS.TrimEnd(',');
        }
        if (ClickType.Value == "update")
        {
            bll.Update(table, proMod, CCate);
            Response.Redirect("ContentShow.aspx?id=" + ProID + "&ModelId=" + ModelID + "&NodeId=" + NodeID);
        }
        else
        {
            if (ClickType.Value.Equals("addasnew"))
            {
                //添加为新商品
                proMod.ProCode = GetProCode();
                proMod.AddTime = DataConverter.CDate(UpdateTime.Text);
            }
            proMod.Priority = 0;
            proMod.Nodeid   = NodeID;
            proMod.UserID   = buser.GetLogin().UserID;
            proMod.ID       = bll.Add(table, proMod, CCate);
            M_Stock SDatac = new M_Stock()
            {
                proid     = proMod.ID,
                stocktype = 0,
                proname   = proMod.Proname,
                adduser   = adminname,
                addtime   = DateTime.Now,
                content   = "添加商品:" + Proname.Text + "入库"
            };
            Sll.AddStock(SDatac);
            Response.Redirect("ContentShow.aspx?id=" + proMod.ID + "&ModelId=" + ModelID + "&NodeId=" + NodeID);
        }
    }
        //保存
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string       adminname = badmin.GetAdminLogin().AdminName;
            DataTable    dt        = fieldBll.GetModelFieldList(ModelID);
            DataTable    gpdt      = gpBll.GetGroupList();
            DataTable    table     = new Call().GetDTFromPage(dt, Page, ViewState);
            M_CommonData CCate     = new M_CommonData();
            M_Product    proMod    = new M_Product();

            if (ProID > 0)
            {
                proMod = proBll.GetproductByid(ProID);
            }
            CCate.Status       = istrue_chk.Checked ? 99 : 0;
            CCate.NodeID       = NodeID;
            CCate.ModelID      = ModelID;
            CCate.TableName    = modBll.GetModelById(ModelID).TableName;
            CCate.Title        = Proname.Text;
            CCate.Inputer      = adminname;
            CCate.PdfLink      = "";
            CCate.FirstNodeID  = nodeBll.SelFirstNodeID(NodeID);
            CCate.EliteLevel   = DataConverter.CLng(Dengji.SelectedValue) > 3 ? 1 : 0;
            CCate.InfoID       = "";
            CCate.SpecialID    = "";
            CCate.Template     = ModeTemplate_hid.Value;
            CCate.DefaultSkins = 0;
            /*--------------proMod------------*/
            proMod.Class      = 0;
            proMod.Nodeid     = NodeID;
            proMod.ModelID    = ModelID;
            proMod.Properties = 0;
            proMod.Isgood     = 0;
            proMod.MakeHtml   = 0;
            proMod.AddUser    = adminname;
            if (string.IsNullOrEmpty(proMod.ProCode))
            {
                proMod.ProCode = B_Product.GetProCode();
            }
            proMod.BarCode = BarCode.Text.Trim();
            proMod.Proname = Proname.Text.Trim();
            proMod.Kayword = Request.Form["tabinput"];
            keyBll.AddKeyWord(proMod.Kayword, 1);
            proMod.ProUnit     = ProUnit.Text;
            proMod.AllClickNum = DataConverter.CLng(Request.Form["AllClickNum"]);
            proMod.Weight      = DataConverter.CLng(Weight.Text);
            proMod.ProClass    = DataConverter.CLng(ProClass_Hid.Value);
            proMod.IDCPrice    = IDC_Hid.Value;
            proMod.PointVal    = DataConverter.CLng(PointVal_T.Text);
            proMod.Proinfo     = Proinfo.Text;
            proMod.Procontent  = procontent.Value;
            proMod.Clearimg    = txt_Clearimg.Text;
            proMod.Thumbnails  = txt_Thumbnails.Text;
            proMod.Producer    = Producer.Text;
            proMod.Brand       = Brand.Text;
            //proMod.Quota = DataConverter.CLng(Quota.Text);
            //proMod.DownQuota = DataConverter.CLng(DownQuota.Text);
            proMod.StockDown     = DataConverter.CLng(StockDown.Text);
            proMod.JisuanFs      = DataConverter.CLng(Request.Form["JisuanFs"]);
            proMod.Rate          = DataConverter.CDouble(Rate.Text);
            proMod.Rateset       = DataConverter.CLng(Rateset.SelectedValue);
            proMod.Dengji        = DataConverter.CLng(Dengji.SelectedValue);
            proMod.ShiPrice      = DataConverter.CDouble(ShiPrice.Text);
            proMod.LinPrice      = DataConverter.CDouble(LinPrice.Text);
            proMod.LinPrice_Json = JsonHelper.AddVal("purse,sicon,point".Split(','), LinPrice_Purse_T.Text, LinPrice_Sicon_T.Text, LinPrice_Point_T.Text);
            proMod.Preset        = (OtherProject.SelectedValue == null) ? "" : OtherProject.SelectedValue; //促销
            //proMod.Integral = DataConverter.CLng(Integral.Text);
            proMod.Propeid   = DataConverter.CLng(Propeid.Text);
            proMod.Recommend = DataConverter.CLng(Recommend_T.Text);
            proMod.Recommend = proMod.Recommend < 1 ? 0 : proMod.Recommend;//不允许负数
            //proMod.Largesspirx = DataConverter.CLng(Largesspirx.Text);
            proMod.Largess     = Largess.Checked?1:0;
            proMod.AllClickNum = DataConverter.CLng(AllClickNum_T.Text);
            //更新时间,若没有指定则为当前时间
            proMod.UpdateTime   = DataConverter.CDate(UpdateTime.Text);
            proMod.AddTime      = DataConverter.CDate(AddTime.Text);
            proMod.ModeTemplate = ModeTemplate_hid.Value;
            proMod.FirstNodeID  = CCate.FirstNodeID;
            proMod.bookDay      = DataConverter.CLng(BookDay_T.Text);
            proMod.BookPrice    = DataConverter.CDouble(BookPrice_T.Text);
            proMod.FarePrice    = FareTlp_Rad.SelectedValue;
            proMod.UserType     = DataConverter.CLng(Request.Form["UserPrice_Rad"]);
            proMod.Quota        = DataConvert.CLng(Request.Form["Quota_Rad"]);
            proMod.DownQuota    = DataConvert.CLng(Request.Form["DownQuota_Rad"]);
            switch (proMod.UserType)
            {
            case 1:
                proMod.UserPrice = Price_Member_T.Text.Trim();
                break;

            case 2:
                proMod.UserPrice = Request.Form["Price_Group_Hid"];
                break;
            }
            switch (proMod.Quota)
            {
            case 0:
                break;

            case 2:
                proMod.Quota_Json = Request.Form["Quota_Group_Hid"];
                break;
            }
            switch (proMod.DownQuota)
            {
            case 0:
                break;

            case 2:
                proMod.DownQuota_Json = Request.Form["DownQuota_Group_Hid"];
                break;
            }
            int ProjectTypeRad = 0;

            if (ProjectType2_Rad.Checked)
            {
                ProjectTypeRad = 2;
            }
            if (ProjectType3_Rad.Checked)
            {
                ProjectTypeRad = 3;
            }
            if (ProjectType4_Rad.Checked)
            {
                ProjectTypeRad = 4;
            }
            if (ProjectType5_Rad.Checked)
            {
                ProjectTypeRad = 5;
            }
            if (ProjectType6_Rad.Checked)
            {
                ProjectTypeRad = 6;
            }
            if (ProjectType7_Rad.Checked)
            {
                ProjectTypeRad = 7;
            }
            proMod.ProjectType = ProjectTypeRad;
            switch (proMod.ProjectType)
            {
                #region 促销
            case 1:
                proMod.ProjectPronum = 0;
                proMod.ProjectMoney  = 0;
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = "";
                proMod.PesentNameid = 0;
                break;

            case 2:
                proMod.ProjectPronum = DataConverter.CLng(ProjectPronum2.Text);
                proMod.ProjectMoney  = 0;
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = "";
                proMod.PesentNameid = 0;
                break;

            case 3:
                proMod.ProjectPronum = DataConverter.CLng(ProjectPronum3.Text);
                proMod.ProjectMoney  = 0;
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = Productsname3.Text;
                proMod.PesentNameid = DataConverter.CLng(HiddenField3.Value);
                break;

            case 4:
                proMod.ProjectPronum = DataConverter.CLng(ProjectPronum4.Text);
                proMod.ProjectMoney  = 0;
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = "";
                proMod.PesentNameid = 0;
                break;

            case 5:
                proMod.ProjectPronum = DataConverter.CLng(ProjectPronum5.Text);
                proMod.ProjectMoney  = 0;
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = Productsname5.Text;
                proMod.PesentNameid = DataConverter.CLng(HiddenField5.Value);
                break;

            case 6:
                proMod.ProjectPronum = 0;
                proMod.ProjectMoney  = DataConverter.CDouble(ProjectMoney6.Text);
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = Productsname6.Text;
                proMod.PesentNameid = DataConverter.CLng(HiddenField6.Value);
                break;

            case 7:
                proMod.ProjectPronum = 0;
                proMod.ProjectMoney  = DataConverter.CDouble(ProjectMoney7.Text);
                //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text);
                proMod.PesentNames  = Productsname7.Text;
                proMod.PesentNameid = DataConverter.CLng(HiddenField7.Value);
                break;
                #endregion
            }
            proMod.TableName      = modBll.GetModelById(ModelID).TableName;
            proMod.Sales          = Sales_Chk.Checked ? 1 : 2;
            proMod.Istrue         = istrue_chk.Checked ? 1 : 0;
            proMod.Ishot          = ishot_chk.Checked ? 1 : 0;
            proMod.Isnew          = isnew_chk.Checked ? 1 : 0;
            proMod.Isbest         = isbest_chk.Checked ? 1 : 0;
            proMod.Allowed        = Allowed.Checked ? 1 : 0;
            proMod.GuessXML       = Request.Form["GuessXML"];
            proMod.Wholesalesinfo = ChildPro_Hid.Value;
            proMod.DownCar        = DataConvert.CLng(DownCar_T.Text);
            //捆绑商品
            if (!string.IsNullOrEmpty(Bind_Hid.Value))
            {
                //获取绑定商品
                DataTable binddt = JsonHelper.JsonToDT(Bind_Hid.Value);
                proMod.BindIDS = "";
                foreach (DataRow dr in binddt.Rows)
                {
                    proMod.BindIDS += dr["ID"] + ",";
                }
                proMod.BindIDS = proMod.BindIDS.TrimEnd(',');
            }
            else
            {
                proMod.BindIDS = "";
            }
            string danju = proMod.UserShopID + DateTime.Now.ToString("yyyyMMddHHmmss");
            if (proMod.ID < 1 || ClickType.Value.Equals("addasnew"))
            {
                proMod.Priority   = 0;
                proMod.Nodeid     = NodeID;
                proMod.AddTime    = DateTime.Now;
                proMod.UpdateTime = DateTime.Now;
                proMod.ID         = proBll.Add(table, proMod, CCate);
                proMod.Stock      = DataConverter.CLng(Stock.Text);
                //多区域价格
                SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", ProGuid) };
                SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp);
                M_Stock stockMod = new M_Stock()
                {
                    proid   = proMod.ID,
                    proname = proMod.Proname,
                    adduser = adminname,
                    StoreID = proMod.UserShopID,
                };
                int proStock = DataConverter.CLng(Stock.Text);
                if (proStock > 0)
                {
                    stockMod.proid     = proMod.ID;
                    stockMod.stocktype = 0;
                    stockMod.Pronum    = proStock;
                    stockMod.danju     = "RK" + danju;
                    stockMod.content   = "添加商品:" + proMod.Proname + "入库";
                    stockBll.AddStock(stockMod);
                }
                Response.Redirect("ContentShow.aspx?id=" + proMod.ID + "&ModelId=" + proMod.ModelID + "&NodeId=" + proMod.Nodeid);
            }
            else
            {
                proBll.Update(table, proMod, CCate);
                //int stock = proStock - DataConverter.CLng(Stock_Hid.Value);
                //if (stock != 0)
                //{
                //    stockMod.stocktype = stock > 0 ? 0 : 1;
                //    stockMod.Pronum = Math.Abs(stock);
                //    stockMod.danju = (stockMod.stocktype > 0 ? "RK" : "CK") + danju;
                //    stockMod.content = stockMod.stocktype > 0 ? "添加商品:" + proMod.Proname + "入库" : "减少商品:" + proMod.Proname + "出库";
                //    stockBll.AddStock(stockMod);
                //}
                Response.Redirect("ContentShow.aspx?id=" + proMod.ID + "&ModelId=" + proMod.ModelID + "&NodeId=" + proMod.Nodeid);
            }
        }
Пример #6
0
    //保存
    protected void EBtnSubmit_Click(object sender, EventArgs e)
    {
        M_UserInfo   mu       = buser.GetLogin();
        M_Store_Info storeMod = storeBll.SelModelByUser(mu.UserID);
        DataTable    dt       = fieldBll.GetModelFieldList(ModelID);
        DataTable    gpdt     = gpBll.GetGroupList();
        DataTable    table    = new Call().GetDTFromPage(dt, Page, ViewState);
        M_Product    proMod   = new M_Product();

        if (ProID > 0)
        {
            proMod = proBll.GetproductByid(ProID);
        }
        /*--------------proMod------------*/
        proMod.Nodeid  = NodeID;
        proMod.ModelID = ModelID;
        proMod.ProCode = ProCode.Text;
        proMod.BarCode = BarCode.Text.Trim();
        proMod.Proname = Proname.Text.Trim();
        proMod.Kayword = Request.Form["tabinput"];
        keyBll.AddKeyWord(proMod.Kayword, 1);
        proMod.ProUnit     = ProUnit.Text;
        proMod.AllClickNum = DataConverter.CLng(Request.Form["AllClickNum"]);
        proMod.ProClass    = 1;
        proMod.Proinfo     = Proinfo.Text;
        proMod.Procontent  = procontent.Value;

        if (!string.IsNullOrEmpty(Request.Form["txt_pics"]))
        {
            try
            {
                DataTable imgdt = JsonConvert.DeserializeObject <DataTable>(Request.Form["txt_pics"]);
                if (imgdt.Rows.Count > 0)
                {
                    proMod.Thumbnails = proMod.Clearimg = DataConvert.CStr(imgdt.Rows[0]["url"]);
                }
            }
            catch (Exception) { }
        }
        //proMod.Quota = DataConverter.CLng(Quota.Text);
        //proMod.DownQuota = DataConverter.CLng(DownQuota.Text);
        proMod.ShiPrice    = DataConverter.CDouble(ShiPrice.Text);
        proMod.LinPrice    = DataConverter.CDouble(LinPrice.Text);
        proMod.Recommend   = DataConverter.CLng(Recommend_T.Text);
        proMod.AllClickNum = DataConverter.CLng(AllClickNum_T.Text);
        //更新时间,若没有指定则为当前时间
        proMod.UpdateTime  = DataConverter.CDate(UpdateTime.Text);
        proMod.AddTime     = DataConverter.CDate(AddTime.Text);
        proMod.FirstNodeID = nodeBll.SelFirstNodeID(NodeID);
        proMod.UserShopID  = storeMod.ID;
        proMod.UserType    = DataConverter.CLng(Request.Form["UserPrice_Rad"]);
        proMod.Quota       = DataConvert.CLng(Request.Form["Quota_Rad"]);
        proMod.DownQuota   = DataConvert.CLng(Request.Form["DownQuota_Rad"]);

        proMod.TableName = modBll.SelReturnModel(ModelID).TableName;
        proMod.Sales     = Sales_Chk.Checked ? 1 : 2;
        proMod.Istrue    = istrue_chk.Checked ? 1 : 0;
        proMod.Ishot     = ishot_chk.Checked ? 1 : 0;
        proMod.Isnew     = isnew_chk.Checked ? 1 : 0;
        proMod.Isbest    = isbest_chk.Checked ? 1 : 0;
        proMod.Allowed   = 1;
        proMod.GuessXML  = Request.Form["GuessXML"];
        proMod.BindIDS   = "";
        string danju = proMod.UserShopID + DateTime.Now.ToString("yyyyMMddHHmmss");

        if (proMod.ID < 1 || ClickType.Value.Equals("addasnew"))
        {
            proMod.AddUser    = mu.UserName;
            proMod.Nodeid     = NodeID;
            proMod.AddTime    = DateTime.Now;
            proMod.UpdateTime = DateTime.Now;
            proMod.ID         = proBll.Add(table, proMod);
        }
        else
        {
            proBll.Update(table, proMod);
        }
        Response.Redirect("ProductShow.aspx?ID=" + proMod.ID);
    }
Пример #7
0
        public void Product_Add()
        {
            int       NodeID    = DataConvert.CLng(Request["NodeID"]);
            int       ModelID   = DataConvert.CLng(Request["ModelID"]);
            string    adminname = mu.UserName;
            DataTable dt        = fieldBll.GetModelFieldList(ModelID);
            DataTable table;

            try
            {
                table = new Call().GetDTFromMVC(dt, Request);
            }
            catch (Exception e)
            {
                function.WriteErrMsg(e.Message); return;
            }
            M_CommonData CCate  = new M_CommonData();
            M_Product    proMod = new M_Product();

            if (Mid > 0)
            {
                proMod  = proBll.GetproductByid(Mid);
                NodeID  = proMod.Nodeid;
                ModelID = proMod.ModelID;
            }
            else
            {
                proMod.Nodeid  = NodeID;
                proMod.ModelID = ModelID;
                //------------------------
                CCate.NodeID      = proMod.Nodeid;
                CCate.ModelID     = proMod.ModelID;
                CCate.Inputer     = adminname;
                CCate.TableName   = modBll.GetModelById(ModelID).TableName;
                CCate.FirstNodeID = nodeBll.SelFirstNodeID(NodeID);
            }
            /*--------------proMod------------*/
            proMod.Istrue     = 1;
            proMod.Properties = 0;
            proMod.Class      = 0;
            proMod.Isgood     = 0;
            proMod.MakeHtml   = 0;
            proMod.DownCar    = 1;
            proMod.AddUser    = adminname;
            if (string.IsNullOrEmpty(proMod.ProCode))
            {
                proMod.ProCode = B_Product.GetProCode();
            }
            proMod.BarCode = Request.Form["BarCode"];
            proMod.Proname = Request.Form["Proname"];
            proMod.Kayword = Request.Form["tabinput"];
            keyBll.AddKeyWord(proMod.Kayword, 1);
            proMod.ProUnit       = Request.Form["ProUnit"];
            proMod.AllClickNum   = DataConverter.CLng(Request.Form["AllClickNum"]);
            proMod.Weight        = DataConverter.CLng(Request.Form["Weight"]);
            proMod.ProClass      = DataConverter.CLng(Request.Form["ProClass_Hid"]);
            proMod.IDCPrice      = Request.Form["IDC_Hid"];
            proMod.PointVal      = DataConverter.CLng(Request.Form["PointVal_T"]);
            proMod.Proinfo       = Request.Form["Proinfo"];
            proMod.Procontent    = Request.Form["procontent"];
            proMod.Clearimg      = Request.Form["txt_Clearimg"];
            proMod.Thumbnails    = Request.Form["txt_Thumbnails"];
            proMod.Producer      = Request.Form["Producer"];
            proMod.Brand         = Request.Form["Brand"];
            proMod.Quota         = DataConverter.CLng(Request.Form["Quota"]);
            proMod.DownQuota     = DataConverter.CLng(Request.Form["DownQuota"]);
            proMod.StockDown     = DataConverter.CLng(Request.Form["StockDown"]);
            proMod.JisuanFs      = DataConverter.CLng(Request.Form["JisuanFs"]);
            proMod.Rate          = DataConverter.CDouble(Request.Form["Rate"]);
            proMod.Rateset       = DataConverter.CLng(Request.Form["Rateset"]);
            proMod.Dengji        = DataConverter.CLng(Request.Form["Dengji"]);
            proMod.ShiPrice      = DataConverter.CDouble(Request.Form["ShiPrice"]);
            proMod.LinPrice      = DataConverter.CDouble(Request.Form["LinPrice"]);
            proMod.LinPrice_Json = JsonHelper.AddVal("purse,sicon,point".Split(','), Request.Form["LinPrice_Purse_T"], Request.Form["LinPrice_Sicon_T"], Request.Form["LinPrice_Point_T"]);
            proMod.Propeid       = DataConverter.CLng(Request.Form["Propeid"]);
            proMod.Recommend     = DataConverter.CLng(Request.Form["Recommend_T"]);
            proMod.Recommend     = proMod.Recommend < 1 ? 0 : proMod.Recommend;//不允许负数
            proMod.Largesspirx   = DataConverter.CLng(Request.Form["Largesspirx"]);
            proMod.AllClickNum   = DataConverter.CLng(Request.Form["AllClickNum_T"]);
            //更新时间,若没有指定则为当前时间
            proMod.UpdateTime = DataConverter.CDate(Request.Form["UpdateTime"]);
            proMod.AddTime    = DataConverter.CDate(Request.Form["AddTime"]);
            //proMod.ModeTemplate = ModeTemplate_hid.Value;
            proMod.FirstNodeID = CCate.FirstNodeID;
            proMod.bookDay     = DataConverter.CLng(Request.Form["BookDay_T"]);
            proMod.BookPrice   = DataConverter.CDouble(Request.Form["BookPrice_T"]);
            proMod.FarePrice   = Request.Form["FareTlp_Rad"];
            proMod.UserType    = DataConverter.CLng(Request.Form["UserPrice_Rad"]);
            //--------------------------------------
            CCate.Status     = 99;
            CCate.Title      = proMod.Proname;
            CCate.PdfLink    = "";
            CCate.EliteLevel = DataConverter.CLng(Request.Form["Dengji"]) > 3 ? 1 : 0;
            CCate.InfoID     = "";
            CCate.SpecialID  = "";
            //CCate.Template = ModeTemplate_hid.Value;
            CCate.DefaultSkins = 0;
            switch (proMod.UserType)
            {
            case 1:
                proMod.UserPrice = DataConvert.CDouble(Request["Price_Member_T"]).ToString("F2");
                break;

            case 2:
                DataTable updt = new DataTable();
                updt.Columns.Add(new DataColumn("gid", typeof(int)));
                updt.Columns.Add(new DataColumn("price", typeof(double)));
                string[] prices = Request.Form["Price_Group_T"].Split(',');
                string[] gids   = Request.Form["GroupID_Hid"].Split(',');
                for (int i = 0; i < gids.Length; i++)
                {
                    DataRow dr = updt.NewRow();
                    dr["gid"]   = Convert.ToInt32(gids[i]);
                    dr["price"] = DataConverter.CDouble(prices[i]);
                    updt.Rows.Add(dr);
                }
                proMod.UserPrice = JsonConvert.SerializeObject(updt);
                break;
            }
            proMod.TableName      = modBll.GetModelById(ModelID).TableName;
            proMod.Sales          = string.IsNullOrEmpty(Request.Form["Sales_Chk"]) ? 2 : 1;
            proMod.Ishot          = string.IsNullOrEmpty(Request.Form["ishot_chk"]) ? 0 : 1;
            proMod.Isnew          = string.IsNullOrEmpty(Request.Form["isnew_chk"]) ? 0 : 1;
            proMod.Isbest         = string.IsNullOrEmpty(Request.Form["isbest_chk"]) ? 0 : 1;
            proMod.Allowed        = string.IsNullOrEmpty(Request.Form["Allowed"]) ? 0 : 1;
            proMod.GuessXML       = Request.Form["GuessXML"];
            proMod.Wholesalesinfo = Request.Form["ChildPro_Hid"];
            //捆绑商品
            if (!string.IsNullOrEmpty(Request.Form["Bind_Hid"]))
            {
                //获取绑定商品
                DataTable binddt = JsonHelper.JsonToDT(Request.Form["Bind_Hid"]);
                proMod.BindIDS = "";
                foreach (DataRow dr in binddt.Rows)
                {
                    proMod.BindIDS += dr["ID"] + ",";
                }
                proMod.BindIDS = proMod.BindIDS.TrimEnd(',');
            }
            else
            {
                proMod.BindIDS = "";
            }
            string ClickType = Request.Form["ClickType"];
            string danju     = proMod.UserShopID + DateTime.Now.ToString("yyyyMMddHHmmss");

            {
                //店铺专用
                M_CommonData storeMod = conBll.SelMyStore_Ex(ref err);
                if (!string.IsNullOrEmpty(err))
                {
                    function.WriteErrMsg(err); return;
                }
                proMod.UserShopID = storeMod.GeneralID;
                proMod.UserID     = mu.UserID;
            }
            if (proMod.ID < 1 || ClickType.Equals("addasnew"))
            {
                proMod.Priority   = 0;
                proMod.Nodeid     = NodeID;
                proMod.AddTime    = DateTime.Now;
                proMod.UpdateTime = DateTime.Now;
                proMod.ID         = proBll.Add(table, proMod, CCate);
                //多区域价格
                SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", Request.Form["ProGuid"]) };
                SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp);
                M_Stock stockMod = new M_Stock()
                {
                    proid   = proMod.ID,
                    proname = proMod.Proname,
                    adduser = adminname,
                    StoreID = proMod.UserShopID,
                };
                int proStock = DataConverter.CLng(Request.Form["Stock"]);
                if (proStock > 0)
                {
                    stockMod.proid     = proMod.ID;
                    stockMod.stocktype = 0;
                    stockMod.Pronum    = proStock;
                    stockMod.danju     = "RK" + danju;
                    stockMod.content   = "添加商品:" + proMod.Proname + "入库";
                    stockBll.AddStock(stockMod);
                }
            }
            else
            {
                proBll.Update(table, proMod, CCate);
            }
            function.WriteSuccessMsg("操作成功", "ProductList"); return;
        }