Example #1
0
 public VM_Product(M_Product proMod, HttpRequest Request)
 {
     groupList   = JsonConvert.SerializeObject(DBCenter.SelWithField("ZL_Group", "GroupID,GroupName"));
     fareDT      = fareBll.Sel();
     this.proMod = proMod;
     if (proMod.ID > 0)
     {
         this.NodeID  = proMod.Nodeid;
         this.ModelID = proMod.ModelID;
         this.ProGuid = proMod.ID.ToString();
         //捆绑商品
         if (!string.IsNullOrEmpty(proMod.BindIDS))
         {
             DataTable dt = proBll.SelByIDS(proMod.BindIDS, "id,Thumbnails,Proname,LinPrice");
             bindList = JsonConvert.SerializeObject(dt);
         }
         //if (!string.IsNullOrEmpty(proMod.TableName))
         //{
         //    DataTable valueDT = proBll.Getmodetable(proMod.TableName.ToString(), proMod.ItemID);
         //    if (valueDT != null && valueDT.Rows.Count > 0)
         //    {
         //        modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT });
         //    }
         //}
     }
     else
     {
         this.NodeID         = DataConvert.CLng(Request.GetParam("NodeID"));
         this.ModelID        = DataConvert.CLng(Request.GetParam("ModelID"));
         this.ProGuid        = System.Guid.NewGuid().ToString();
         this.proMod.ProCode = B_Product.GetProCode();
         //modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.Admin });
     }
     nodeMod = nodeBll.SelReturnModel(NodeID);
 }
Example #2
0
 public VM_Product(M_Product proMod, HttpRequestBase Request)
 {
     groupList = JsonConvert.SerializeObject(DBCenter.SelWithField("ZL_Group", "GroupID,GroupName"));
     gpriceDT  = gpBll.GetGroupList();
     gpriceDT.Columns.Add(new DataColumn("gprice", typeof(string)));
     fareDT      = fareBll.Sel();
     this.proMod = proMod;
     if (proMod.ID > 0)
     {
         this.NodeID  = proMod.Nodeid;
         this.ModelID = proMod.ModelID;
         this.ProGuid = proMod.ID.ToString();
         //会员组价
         if (proMod.UserType == 2 && proMod.UserPrice.Contains("[") && !proMod.UserPrice.Equals("[]"))
         {
             DataTable upDT = JsonConvert.DeserializeObject <DataTable>(proMod.UserPrice);
             foreach (DataRow dr in upDT.Rows)
             {
                 DataRow[] drs = gpriceDT.Select("GroupID='" + dr["gid"] + "'");
                 if (drs.Length > 0)
                 {
                     drs[0]["gprice"] = DataConvert.CDouble(dr["price"]).ToString("F2");
                 }
             }
         }
         //捆绑商品
         if (!string.IsNullOrEmpty(proMod.BindIDS))
         {
             DataTable dt = proBll.SelByIDS(proMod.BindIDS, "id,Thumbnails,Proname,LinPrice");
             bindList = JsonConvert.SerializeObject(dt);
         }
         if (!string.IsNullOrEmpty(proMod.TableName))
         {
             DataTable valueDT = proBll.Getmodetable(proMod.TableName.ToString(), proMod.ItemID);
             if (valueDT != null && valueDT.Rows.Count > 0)
             {
                 modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig()
                 {
                     ValueDT = valueDT
                 });
             }
         }
     }
     else
     {
         this.NodeID         = DataConvert.CLng(Request.QueryString["NodeID"]);
         this.ModelID        = DataConvert.CLng(Request.QueryString["ModelID"]);
         this.ProGuid        = System.Guid.NewGuid().ToString();
         this.proMod.ProCode = B_Product.GetProCode();
         modelHtml           = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig()
         {
             Source = ModelConfig.SType.Admin
         });
     }
     nodeMod = nodeBll.SelReturnModel(NodeID);
 }
Example #3
0
        public ActionResult AddProduct()
        {
            VM_Product vm = new VM_Product();

            if (Mid < 1)
            {
                if (ModelID < 1)
                {
                    function.WriteErrMsg("没有指定要添加内容的模型ID!"); return(null);
                }
                if (NodeID < 1)
                {
                    function.WriteErrMsg("没有指定要添加内容的栏目节点ID!"); return(null);
                }
                vm.proMod = new M_Product()
                {
                    Stock = 10, Rateset = 1, Dengji = 3
                };
                vm.NodeID         = NodeID;
                vm.ModelID        = ModelID;
                vm.proMod.ProCode = B_Product.GetProCode();
            }
            else
            {
                vm.proMod  = proBll.GetproductByid(Mid);
                vm.NodeID  = vm.proMod.Nodeid;
                vm.ModelID = vm.proMod.ModelID;
                vm.ValueDT = proBll.GetContent(vm.proMod.TableName, vm.proMod.ItemID);
                if (!string.IsNullOrEmpty(vm.proMod.BindIDS))//捆绑商品
                {
                    DataTable dt = proBll.SelByIDS(vm.proMod.BindIDS, "id,Thumbnails,Proname,LinPrice");
                    vm.bindList = JsonConvert.SerializeObject(dt);
                }
                #region 特选商品
                {
                    string where = string.Format("(ProIDS LIKE '%,{0},%' OR ProIDS LIKE '{0},%' OR ProIDS LIKE '%,{0}')", vm.proMod.ID.ToString());
                    DataTable dt   = DBCenter.SelWithField("ZL_User_BindPro", "UserID", where);
                    string    uids = StrHelper.GetIDSFromDT(dt, "UserID");
                    ViewBag.prouids = uids;
                }
                #endregion
            }
            //------------------------------------------------------------------------------------------------
            vm.nodeMod = nodeBll.SelReturnModel(vm.NodeID);
            if (vm.nodeMod.IsNull)
            {
                function.WriteErrMsg("节点[" + NodeID + "]不存在"); return(null);
            }
            return(View(vm));
        }
Example #4
0
        public ActionResult AddProduct()
        {
            VM_Product vm = new VM_Product();

            if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "product"))
            {
                return(null);
            }
            if (Mid < 1)
            {
                if (ModelID < 1)
                {
                    function.WriteErrMsg("没有指定要添加内容的模型ID!"); return(null);
                }
                if (NodeID < 1)
                {
                    function.WriteErrMsg("没有指定要添加内容的栏目节点ID!"); return(null);
                }
                vm.proMod = new M_Product()
                {
                    Stock = 10, Rateset = 1, Dengji = 3
                };
                vm.NodeID         = NodeID;
                vm.ModelID        = ModelID;
                vm.proMod.ProCode = B_Product.GetProCode();
                vm.ProGuid        = Guid.NewGuid().ToString();
            }
            else
            {
                int VerID = DataConvert.CLng(Request.QueryString["Ver"]);
                if (VerID > 0)
                {
                    M_Content_VerBak verMod = verBll.SelReturnModel(VerID);
                    vm.proMod = JsonConvert.DeserializeObject <M_Product>(verMod.ContentBak);
                    if (vm.proMod.ID != Mid)
                    {
                        function.WriteErrMsg("加载的版本与商品不匹配"); return(null);
                    }
                    vm.ValueDT = JsonConvert.DeserializeObject <DataTable>(verMod.TableBak);
                }
                else
                {
                    vm.proMod  = proBll.GetproductByid(Mid);
                    vm.ValueDT = proBll.GetContent(vm.proMod.TableName, vm.proMod.ItemID);
                }
                vm.ProGuid = vm.proMod.ID.ToString();
                if (vm.proMod.Class == 2)
                {
                    Response.Redirect(CustomerPageAction.customPath + "Shop/Arrive/SuitProAdd.aspx?ID=" + vm.proMod.ID);
                }
                vm.NodeID  = vm.proMod.Nodeid;
                vm.ModelID = vm.proMod.ModelID;
                if (!string.IsNullOrEmpty(vm.proMod.BindIDS))//捆绑商品
                {
                    DataTable dt = proBll.SelByIDS(vm.proMod.BindIDS, "id,Thumbnails,Proname,LinPrice");
                    vm.bindList = JsonConvert.SerializeObject(dt);
                }
                //多区域价格
                vm.regionMod = regionBll.SelModelByGuid(vm.ProGuid);
                if (vm.regionMod == null)
                {
                    vm.regionMod = new M_Shop_RegionPrice();
                }
                #region 特选商品
                {
                    string where = string.Format("(ProIDS LIKE '%,{0},%' OR ProIDS LIKE '{0},%' OR ProIDS LIKE '%,{0}')", vm.proMod.ID.ToString());
                    DataTable dt   = DBCenter.SelWithField("ZL_User_BindPro", "UserID", where);
                    string    uids = StrHelper.GetIDSFromDT(dt, "UserID");
                    ViewBag.prouids = uids;
                }
                #endregion
            }
            //------------------------------------------------------------------------------------------------
            vm.nodeMod = nodeBll.SelReturnModel(vm.NodeID);
            if (vm.nodeMod.IsNull)
            {
                function.WriteErrMsg("节点[" + vm.NodeID + "]不存在"); return(null);
            }
            return(View(vm));
        }
Example #5
0
    public void MyBind()
    {
        M_Node nodeMod = bnode.SelReturnModel(NodeID);

        if (nodeMod.IsNull)
        {
            function.WriteErrMsg("节点[" + NodeID + "]不存在");
        }
        string bread1 = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>";

        UpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        ProCode.Text    = GetProCode();
        NodeName_L.Text = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>";
        OtherBind();//组,运费模板
        M_UserInfo mu = buser.GetLogin();

        if (Menu.Equals("edit"))
        {
            #region 修改
            M_Product pinfo = bll.GetproductByid(ProID);
            if (pinfo.UserID != mu.UserID)
            {
                function.WriteErrMsg("你无权修改此商品");
            }
            StoreID                   = pinfo.UserShopID > 0 ? -1 : 0;
            ModelID                   = pinfo.ModelID;
            NodeID                    = pinfo.Nodeid;
            txtCountHits.Text         = pinfo.AllClickNum.ToString();
            ClickType.Value           = "update";
            btnAdd.Visible            = true;
            istrue_Chk.Checked        = pinfo.Istrue == 1 ? true : false;
            Categoryid.Value          = pinfo.Categoryid.ToString();
            ProCode.Text              = pinfo.ProCode;
            BarCode.Text              = pinfo.BarCode.ToString();
            Proname.Text              = pinfo.Proname.ToString();
            Kayword.Text              = pinfo.Kayword.ToString();
            ProUnit.Text              = pinfo.ProUnit.ToString();
            Weight.Text               = pinfo.Weight.ToString();
            restate_hid.Value         = pinfo.GuessXML;
            Propeid.Text              = pinfo.Propeid.ToString();
            Largesspirx.Text          = pinfo.Largesspirx.ToString();
            Largess.Checked           = pinfo.Largess == 1 ? true : false;
            txtRecommend.Text         = pinfo.Recommend.ToString();
            ServerPeriod.Text         = pinfo.ServerPeriod.ToString();
            ServerType.SelectedValue  = pinfo.ServerType.ToString();
            ProClass.Value            = pinfo.ProClass.ToString();
            txtPoint.Text             = pinfo.PointVal.ToString();
            Proinfo.Text              = pinfo.Proinfo.ToString();
            Procontent.Value          = pinfo.Procontent.ToString();
            txt_Clearimg.Text         = pinfo.Clearimg.ToString();
            txt_Thumbnails.Text       = pinfo.Thumbnails.ToString();
            Quota.Text                = pinfo.Quota.ToString();
            DownQuota.Text            = pinfo.DownQuota.ToString();
            Stock.Text                = pinfo.Stock.ToString();
            StockDown.Text            = pinfo.StockDown.ToString();
            JisuanFs.Text             = pinfo.JisuanFs.ToString();
            Rate.Text                 = pinfo.Rate.ToString();
            Rateset.SelectedValue     = pinfo.Rateset.ToString();
            Dengji.Text               = pinfo.Dengji.ToString();
            ShiPrice.Text             = pinfo.ShiPrice.ToString();
            Brand.Text                = pinfo.Brand.ToString();
            Producer.Text             = pinfo.Producer.ToString();
            LinPrice.Text             = pinfo.LinPrice.ToString();
            LinPrice_Purse_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "purse").ToString("f2");
            LinPrice_Sicon_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "sicon").ToString("f2");
            LinPrice_Point_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "point").ToString("f2");
            Wholesaleone.Checked      = pinfo.Wholesaleone == 1 ? true : false;
            expRemindDP.SelectedValue = pinfo.ExpRemind.ToString();
            FareTlp_Rad.SelectedValue = pinfo.FarePrice;
            ChildPro_Hid.Value        = pinfo.Wholesalesinfo; //多价格
            if (!string.IsNullOrEmpty(pinfo.BindIDS))         //捆绑商品
            {
                DataTable dt = bll.SelByIDS(pinfo.BindIDS, "id,Thumbnails,Proname,LinPrice");
                Bind_Hid.Value = JsonConvert.SerializeObject(dt);
            }
            if (!string.IsNullOrEmpty(pinfo.Preset))
            {
                if (pinfo.Preset.IndexOf(",") > -1)
                {
                    string[] presetarr = pinfo.Preset.Split(new string[] { "," }, StringSplitOptions.None);
                    for (int s = 0; s < presetarr.Length; s++)
                    {
                        M_Promotions proinfo = pro.GetPromotionsByid(DataConverter.CLng(presetarr[s]));
                        if (proinfo == null)
                        {
                            continue;
                        }
                        OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                    }
                }
                else
                {
                    M_Promotions proinfo = pro.GetPromotionsByid(DataConverter.CLng(pinfo.Preset));
                    if (proinfo != null)
                    {
                        OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                    }
                }
            }

            if (OtherProject.Items.Count > 0)
            {
                for (int d = 0; d < OtherProject.Items.Count; d++)
                {
                    OtherProject.Items[d].Selected = true;
                }
            }
            switch (pinfo.UserType)
            {
            case 0:
                UserPrice0_Rad.Checked    = true;
                userPrice.Text            = pinfo.UserPrice;
                userP.Attributes["style"] = "";
                break;

            case 1:
                UserPrice1_Rad.Checked       = true;
                divGroup.Attributes["style"] = "";
                string[] prices = pinfo.UserPrice.Split(',');
                if (prices != null && prices.Length > 0)
                {
                    for (int i = 0; i < repGroup.Items.Count; i++)
                    {
                        string gid = (repGroup.Items[i].FindControl("groupID") as HiddenField).Value;
                        for (int j = 0; j < prices.Length; j++)
                        {
                            string[] price = prices[j].Split('|');
                            if (price != null && price.Length > 0 && price[0] == gid)
                            {
                                (repGroup.Items[i].FindControl("GroupPrice") as TextBox).Text = price[1];
                            }
                        }
                    }
                }
                break;

            case -1:
                UserPrice2_Rad.Checked = true;
                break;
            }
            txtBookPrice.Text = pinfo.BookPrice.ToString("f2");
            txtBookDay.Text   = pinfo.bookDay.ToString();
            txtDayPrice.Text  = pinfo.FestlPrice.ToString("f2");
            if (pinfo.FestPeriod.Split('|') != null && pinfo.FestPeriod.Split('|').Length > 1)
            {
                CheckInDate.Text  = pinfo.FestPeriod.Split('|')[0];
                CheckOutDate.Text = pinfo.FestPeriod.Split('|')[1];
                serverdate.Value  = CheckInDate.Text;
                CheckOut.Value    = CheckOutDate.Text;
            }
            Integral.Text          = pinfo.Integral.ToString();
            UpdateTime.Text        = pinfo.UpdateTime.ToString();
            ModeTemplate_hid.Value = pinfo.ModeTemplate.ToString();
            if (pinfo.ProClass == 4)  //团购
            {
                ColonelStartTimetxt.Text = pinfo.AddTime.ToString();
                txtColoneDeposit.Text    = pinfo.ColoneDeposit.ToString();
                if (!string.IsNullOrEmpty(pinfo.ColonelTime))
                {
                    string[] time = pinfo.ColonelTime.Split('|');
                    if (time != null && time.Length > 1)
                    {
                        ColonelStartTimetxt.Text = time[0];
                        ColonelendTimetxt.Text   = time[1];
                        //如果团购已经开始,且未结束,不允许修改
                        if (DataConverter.CDate(time[0]) <= DateTime.Now && DataConverter.CDate(time[1]) >= DateTime.Now)
                        {
                            ColonelStartTimetxt.Enabled = false;
                            ColonelendTimetxt.Enabled   = false;
                            hfBeginTime.Value           = time[0];
                            hfEndTime.Value             = time[1];
                        }
                    }
                }
            }
            //Wholesaleone.Checked = pinfo.Wholesaleone == 1 ? true : false;
            isnew.Checked     = pinfo.Isnew == 1;//是否新品,热,等
            ishot.Checked     = pinfo.Ishot == 1;
            isbest.Checked    = pinfo.Isbest == 1;
            Sales_Chk.Checked = pinfo.Sales == 1;
            Allowed.Checked   = pinfo.Allowed == 1;
            DataTable dr = bll.Getmodetable(pinfo.TableName.ToString(), DataConverter.CLng(pinfo.ItemID));
            if (dr != null && dr.Rows.Count > 0)
            {
                ModelHtml.Text = bfield.InputallHtml(ModelID, NodeID, new ModelConfig()
                {
                    ValueDT = dr
                });
            }
            ProjectType.Text = pinfo.ProjectType.ToString();
            IntegralNum.Text = pinfo.IntegralNum.ToString();
            switch (pinfo.ProjectType)
            {
            case 1:
                break;

            case 2:
                ProjectPronum2.Text = pinfo.ProjectPronum.ToString();
                break;

            case 3:
                ProjectPronum3.Text = pinfo.ProjectPronum.ToString();
                Productsname3.Text  = pinfo.PesentNames.ToString();
                HiddenField3.Value  = pinfo.PesentNameid.ToString();
                break;

            case 4:
                ProjectPronum4.Text = pinfo.ProjectPronum.ToString();
                break;

            case 5:
                ProjectPronum5.Text = pinfo.ProjectPronum.ToString();
                Productsname5.Text  = pinfo.PesentNames.ToString();
                HiddenField5.Value  = pinfo.PesentNameid.ToString();
                break;

            case 6:
                ProjectMoney7.Text = pinfo.ProjectMoney.ToString();
                Productsname6.Text = pinfo.PesentNames.ToString();
                HiddenField6.Value = pinfo.PesentNameid.ToString();
                break;

            case 7:
                ProjectMoney7.Text = pinfo.ProjectMoney.ToString();
                Productsname7.Text = pinfo.PesentNames.ToString();
                HiddenField7.Value = pinfo.PesentNameid.ToString();
                break;
            }
            #endregion
        }
        else
        {
            isnew.Checked     = true;
            Sales_Chk.Checked = true;
            ModelHtml.Text    = bfield.InputallHtml(ModelID, NodeID, new ModelConfig()
            {
                Source = ModelConfig.SType.Admin
            });
            btnAdd.Visible = false;
        }
    }
        public void MyBind()
        {
            M_Product pinfo = null;

            if (ProID > 0)
            {
                pinfo = proBll.GetproductByid(ProID); NodeID = pinfo.Nodeid;
            }
            //-------------------------------
            M_Node nodeMod = nodeBll.SelReturnModel(NodeID);

            if (nodeMod.IsNull)
            {
                function.WriteErrMsg("节点[" + NodeID + "]不存在");
            }
            string bread1 = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>", bread2 = "添加商品";

            NodeName_L.Text = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>";

            UpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            AddTime.Text    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            ProCode.Text    = B_Product.GetProCode();
            OtherBind(pinfo);//组,运费模板
            if (ProID > 0)
            {
                #region 修改
                StoreID            = pinfo.UserShopID > 0 ? -1 : 0;
                ModelID            = pinfo.ModelID;
                AllClickNum_T.Text = pinfo.AllClickNum.ToString();
                bread2             = "修改商品";
                ClickType.Value    = "update";
                btnAdd.Visible     = true;
                istrue_chk.Checked = pinfo.Istrue == 1 ? true : false;
                ProCode.Text       = pinfo.ProCode;
                BarCode.Text       = pinfo.BarCode.ToString();
                Proname.Text       = pinfo.Proname.ToString();
                Keywords.Text      = pinfo.Kayword.ToString();
                ProUnit.Text       = pinfo.ProUnit.ToString();
                Weight.Text        = pinfo.Weight.ToString();
                restate_hid.Value  = pinfo.GuessXML;
                Propeid.Text       = pinfo.Propeid.ToString();
                //Largesspirx.Text = pinfo.Largesspirx.ToString();
                Largess.Checked  = pinfo.Largess == 1 ? true : false;
                Recommend_T.Text = pinfo.Recommend.ToString();
                //ServerPeriod.Text = pinfo.ServerPeriod.ToString();
                //ServerType.SelectedValue = pinfo.ServerType.ToString();
                //expRemindDP.SelectedValue = pinfo.ExpRemind.ToString();
                ProClass_Hid.Value  = pinfo.ProClass.ToString();
                PointVal_T.Text     = pinfo.PointVal.ToString();
                Proinfo.Text        = pinfo.Proinfo.ToString();
                procontent.Value    = pinfo.Procontent.ToString();
                txt_Clearimg.Text   = pinfo.Clearimg.ToString();
                txt_Thumbnails.Text = pinfo.Thumbnails.ToString();
                //Quota.Text = pinfo.Quota.ToString();
                //DownQuota.Text = pinfo.DownQuota.ToString();
                Stock.Text         = pinfo.Stock.ToString();
                SetStock_B.Visible = true;
                StockDown.Text     = pinfo.StockDown.ToString();
                function.Script(this, "SetRadVal('JisuanFs','" + pinfo.JisuanFs + "');");
                Rate.Text                 = pinfo.Rate.ToString();
                Rateset.SelectedValue     = pinfo.Rateset.ToString();
                Dengji.Text               = pinfo.Dengji.ToString();
                ShiPrice.Text             = pinfo.ShiPrice.ToString();
                Brand.Text                = pinfo.Brand.ToString();
                Producer.Text             = pinfo.Producer.ToString();
                LinPrice.Text             = pinfo.LinPrice.ToString();
                LinPrice_Purse_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "purse").ToString("f2");
                LinPrice_Sicon_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "sicon").ToString("f2");
                LinPrice_Point_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "point").ToString("f2");
                FareTlp_Rad.SelectedValue = pinfo.FarePrice;
                ChildPro_Hid.Value        = pinfo.Wholesalesinfo; //多价格
                IDC_Hid.Value             = pinfo.IDCPrice;
                Stock.ReadOnly            = true;
                if (!string.IsNullOrEmpty(pinfo.BindIDS))//捆绑商品
                {
                    DataTable dt = proBll.SelByIDS(pinfo.BindIDS, "id,Thumbnails,Proname,LinPrice");
                    Bind_Hid.Value = JsonConvert.SerializeObject(dt);
                }
                if (!string.IsNullOrEmpty(pinfo.Preset))
                {
                    if (pinfo.Preset.IndexOf(",") > -1)
                    {
                        string[] presetarr = pinfo.Preset.Split(new string[] { "," }, StringSplitOptions.None);
                        for (int s = 0; s < presetarr.Length; s++)
                        {
                            M_Promotions proinfo = promoBll.GetPromotionsByid(DataConverter.CLng(presetarr[s]));
                            if (proinfo == null)
                            {
                                continue;
                            }
                            OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                        }
                    }
                    else
                    {
                        M_Promotions proinfo = promoBll.GetPromotionsByid(DataConverter.CLng(pinfo.Preset));
                        if (proinfo != null)
                        {
                            OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                        }
                    }
                }

                if (OtherProject.Items.Count > 0)
                {
                    for (int d = 0; d < OtherProject.Items.Count; d++)
                    {
                        OtherProject.Items[d].Selected = true;
                    }
                }
                //填充显示会员价
                switch (pinfo.UserType)
                {
                case 1:
                    Price_Member_T.Text = DataConverter.CDouble(pinfo.UserPrice).ToString("f2");
                    price_member_div.Attributes["style"] = "";
                    break;

                case 2:
                    price_group_div.Attributes["style"] = "";
                    break;

                default:
                    break;
                }
                function.Script(this, "SetRadVal('UserPrice_Rad','" + pinfo.UserType + "');");
                function.Script(this, "SetRadVal('DownQuota_Rad','" + pinfo.DownQuota + "');");
                function.Script(this, "SetRadVal('Quota_Rad','" + pinfo.Quota + "');");
                DownCar_T.Text   = pinfo.DownCar.ToString();
                BookPrice_T.Text = pinfo.BookPrice.ToString("f2");
                BookDay_T.Text   = pinfo.bookDay.ToString();
                //Integral.Text = pinfo.Integral.ToString();
                UpdateTime.Text        = pinfo.UpdateTime.ToString();
                AddTime.Text           = pinfo.AddTime.ToString();
                ModeTemplate_hid.Value = pinfo.ModeTemplate.ToString();
                isnew_chk.Checked      = pinfo.Isnew == 1;//是否新品,热,等
                ishot_chk.Checked      = pinfo.Ishot == 1;
                isbest_chk.Checked     = pinfo.Isbest == 1;
                Sales_Chk.Checked      = pinfo.Sales == 1;
                Allowed.Checked        = pinfo.Allowed == 1;
                DataTable valueDT = proBll.Getmodetable(pinfo.TableName.ToString(), pinfo.ItemID);
                if (valueDT != null && valueDT.Rows.Count > 0)
                {
                    ModelHtml.Text = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig()
                    {
                        ValueDT = valueDT
                    });
                }
                //IntegralNum.Text = pinfo.IntegralNum.ToString();
                switch (pinfo.ProjectType)
                {
                case 1:
                    break;

                case 2:
                    ProjectType2_Rad.Checked = true;
                    ProjectPronum2.Text      = pinfo.ProjectPronum.ToString();
                    break;

                case 3:
                    ProjectType3_Rad.Checked = true;
                    ProjectPronum3.Text      = pinfo.ProjectPronum.ToString();
                    Productsname3.Text       = pinfo.PesentNames.ToString();
                    HiddenField3.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 4:
                    ProjectType4_Rad.Checked = true;
                    ProjectPronum4.Text      = pinfo.ProjectPronum.ToString();
                    break;

                case 5:
                    ProjectType5_Rad.Checked = true;
                    ProjectPronum5.Text      = pinfo.ProjectPronum.ToString();
                    Productsname5.Text       = pinfo.PesentNames.ToString();
                    HiddenField5.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 6:
                    ProjectType6_Rad.Checked = true;
                    ProjectMoney7.Text       = pinfo.ProjectMoney.ToString();
                    Productsname6.Text       = pinfo.PesentNames.ToString();
                    HiddenField6.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 7:
                    ProjectType7_Rad.Checked = true;
                    ProjectMoney7.Text       = pinfo.ProjectMoney.ToString();
                    Productsname7.Text       = pinfo.PesentNames.ToString();
                    HiddenField7.Value       = pinfo.PesentNameid.ToString();
                    break;
                }
                #endregion
                #region 多区域价格
                ProGuid = pinfo.ID.ToString();
                M_Shop_RegionPrice regionMod = regionBll.SelModelByGuid(ProGuid);
                if (regionMod != null && !string.IsNullOrEmpty(regionMod.Info))
                {
                    function.Script(this, "region.fill(" + regionMod.Info + ");");
                }
                #endregion
            }
            else
            {
                isnew_chk.Checked = true;
                Sales_Chk.Checked = true;
                ModelHtml.Text    = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig()
                {
                    Source = ModelConfig.SType.Admin
                });
                btnAdd.Visible = false;
            }
            Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li><li><a href='ProductManage.aspx?NodeID='>" + bread1 + "</a></li><li class='active'>" + bread2 + "</li>"
                               + "<div class='pull-right hidden-xs'><span onclick=\"opentitle('../Content/EditNode.aspx?NodeID=" + NodeID + "','配置本节点');\" class='fa fa-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></div>");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <M_UserInfo> Dinfo = new List <M_UserInfo>();
                List <M_Uinfo>    Iinfo = new List <M_Uinfo>();
                mu = buser.SelReturnModel(UserID);
                if (mu.IsNull)
                {
                    function.WriteErrMsg("用户[" + UserID + "]不存在");
                }
                basemu = buser.GetUserBaseByuserid(UserID);
                //判断是否是认证用户
                ApproveFailure_B.Visible = (mu.State == 2);
                if (DataConvert.CLng(mu.ParentUserID) > 0)
                {
                    pmu = buser.SelReturnModel(Convert.ToInt32(mu.ParentUserID));
                }
                Dinfo.Add(mu);
                Iinfo.Add(basemu);
                UInfo_RPT.DataSource = Dinfo;
                UInfo_RPT.DataBind();
                BaseMU_RPT.DataSource = Iinfo;
                BaseMU_RPT.DataBind();
                #region 增加模型选项卡
                DataTable dtModelUser = bm.GetListUser();
                string    labstr      = "";
                int       tabnum      = 3;
                for (int i = 0; i < dtModelUser.Rows.Count; i++)
                {
                    string    tablename = dtModelUser.Rows[i]["TableName"].ToString();
                    DataTable info      = bmf.SelectTableName(tablename, "userid=" + UserID);
                    if (info != null && info.Rows.Count > 0)
                    {
                        int       modelid    = Convert.ToInt32(dtModelUser.Rows[i]["ModelId"].ToString());
                        DataTable modelfiled = bmf.GetModelFieldList(modelid);
                        labstr      += "<td id=\"TabTitle" + (tabnum) + ("\" class=\"tabtitle\" onclick=\"ShowTabss(" + (tabnum)) + ")\">\r";
                        labstr      += dtModelUser.Rows[i]["ModelName"].ToString() + "\r";
                        labstr      += ("</td>\r");
                        tabTitles   += ", \"TabTitle" + (tabnum) + "\"";
                        tabs        += ", \"Tabs" + (tabnum) + "\"";
                        ltlTab.Text += "<tbody id=\"Tabs" + (tabnum) + "\" style=\"display: none\">";
                        ltlTab.Text += "<tr>";
                        ltlTab.Text += "<td colspan=\"4\">";
                        ltlTab.Text += " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";

                        for (int k = 0; k < modelfiled.Rows.Count; k++)
                        {
                            if (k % 2 == 0)
                            {
                                ltlTab.Text += "<tr class=\"tdbg\">\r";
                            }
                            ltlTab.Text += "<td class=\"tdbgleft\" style=\"width: 15%; height: 22px\" align=\"right\">\r";
                            ltlTab.Text += modelfiled.Rows[k]["FieldAlias"].ToString() + "\r";
                            ltlTab.Text += "</td>\r";
                            ltlTab.Text += "<td style=\"width: 35%; height: 22px\" align=\"left\">\r";
                            ltlTab.Text += info.Rows[0][modelfiled.Rows[k]["FieldName"].ToString()].ToString() + "\r";
                            ltlTab.Text += "</td>\r";
                            if (k % 2 != 0)
                            {
                                ltlTab.Text += "</tr>\r";
                            }
                        }
                        ltlTab.Text += " </table>";
                        ltlTab.Text += " </td>";
                        ltlTab.Text += " </tr>";
                        ltlTab.Text += "</tbody>";
                        tabnum++;
                    }
                }
                #endregion
                tbSign.Text                = basemu.Sign;
                txtDeadLine.Text           = mu.DeadLine.ToString();//有效期截止时间
                txtCerificateDeadLine.Text = mu.CerificateDeadLine.ToString();
                Privancy.Text              = tbPrivacy.SelectedValue.ToString();
                Privancy.Text              = tbPrivacy.Items[basemu.Privating].Text;
                DataTable dtuser2 = buser.GetUserBaseByuserid(UserID.ToString());
                lblHtml.Text = bub.GetUpdateHtml(dtuser2);
                BindUserRole(mu);
                AuthorDT = null;
                //-----------------
                try
                {
                    DataTable gpdt = gpBll.Sel();
                    UserGroup_DP.DataSource = gpdt;
                    UserGroup_DP.DataBind();
                    UserGroup_DP.Items.Insert(0, new ListItem("未分组", "0"));
                    UserGroup_DP.SelectedValue = mu.GroupID.ToString();
                }
                catch { UserGroup_DP.Items[0].Text = "会员组[" + mu.GroupID + "]不存在"; }
                M_User_BindPro ubpMod = ubpBll.SelModelByUid(UserID);
                if (ubpMod != null && !string.IsNullOrEmpty(ubpMod.ProIDS))
                {
                    UPProDT = proBll.SelByIDS(StrHelper.PureIDSForDB(ubpMod.ProIDS));
                    string pids = "", nids = "";
                    foreach (DataRow dr in UPProDT.Rows)
                    {
                        pids += dr["ID"] + ",";
                    }
                    foreach (DataRow dr in UPProDT.Rows)
                    {
                        nids += dr["NodeID"] + ",";
                    }
                    nids = nids.TrimEnd(','); pids.TrimEnd(',');
                    DataTable nodedt = nodeBll.SelByIDS(nids);
                    UPRONode_RPT.DataSource = nodedt;
                    UPRONode_RPT.DataBind();
                    UProIDS_Hid.Value = StrHelper.IdsFormat(pids);
                }
                if (DataConvert.CStr(Request["show"]) == "diag")
                {
                    Call.HideBread(Master);
                }
                else
                {
                    Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='AdminManage.aspx'>用户管理</a></li><li><a href='UserManage.aspx'>会员管理</a></li><li class='active'><a href='" + Request.RawUrl + "'>会员信息</a> 当前用户:" + mu.UserName + "</li>");
                }
            }
        }
Example #8
0
        public void MyBind()
        {
            M_Node nodeMod = bnode.SelReturnModel(NodeID);

            if (nodeMod.IsNull)
            {
                function.WriteErrMsg("节点[" + NodeID + "]不存在");
            }
            string bread1 = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>", bread2 = "添加商品";

            UpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            ProCode.Text    = GetProCode();
            NodeName_L.Text = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>";
            OtherBind();//组,运费模板
            if (Menu.Equals("edit"))
            {
                #region 修改
                M_Product pinfo = bll.GetproductByid(ProID);
                StoreID                   = pinfo.UserShopID > 0 ? -1 : 0;
                ModelID                   = pinfo.ModelID;
                NodeID                    = pinfo.Nodeid;
                txtCountHits.Text         = pinfo.AllClickNum.ToString();
                bread2                    = "修改商品";
                ClickType.Value           = "update";
                btnAdd.Visible            = true;
                istrue_Chk.Checked        = pinfo.Istrue == 1 ? true : false;
                Categoryid.Value          = pinfo.Categoryid.ToString();
                ProCode.Text              = pinfo.ProCode;
                BarCode.Text              = pinfo.BarCode.ToString();
                Proname.Text              = pinfo.Proname.ToString();
                Kayword.Text              = pinfo.Kayword.ToString();
                ProUnit.Text              = pinfo.ProUnit.ToString();
                Weight.Text               = pinfo.Weight.ToString();
                restate_hid.Value         = pinfo.GuessXML;
                Propeid.Text              = pinfo.Propeid.ToString();
                Largesspirx.Text          = pinfo.Largesspirx.ToString();
                Largess.Checked           = pinfo.Largess == 1 ? true : false;
                txtRecommend.Text         = pinfo.Recommend.ToString();
                ServerPeriod.Text         = pinfo.ServerPeriod.ToString();
                ServerType.SelectedValue  = pinfo.ServerType.ToString();
                ProClass.Value            = pinfo.ProClass.ToString();
                txtPoint.Text             = pinfo.PointVal.ToString();
                Proinfo.Text              = pinfo.Proinfo.ToString();
                procontent.Value          = pinfo.Procontent.ToString();
                txt_Clearimg.Text         = pinfo.Clearimg.ToString();
                txt_Thumbnails.Text       = pinfo.Thumbnails.ToString();
                Quota.Text                = pinfo.Quota.ToString();
                DownQuota.Text            = pinfo.DownQuota.ToString();
                Stock.Text                = pinfo.Stock.ToString();
                StockDown.Text            = pinfo.StockDown.ToString();
                JisuanFs.Text             = pinfo.JisuanFs.ToString();
                Rate.Text                 = pinfo.Rate.ToString();
                Rateset.SelectedValue     = pinfo.Rateset.ToString();
                Dengji.Text               = pinfo.Dengji.ToString();
                ShiPrice.Text             = pinfo.ShiPrice.ToString();
                Brand.Text                = pinfo.Brand.ToString();
                Producer.Text             = pinfo.Producer.ToString();
                LinPrice.Text             = pinfo.LinPrice.ToString();
                LinPrice_Purse_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "purse").ToString("f2");
                LinPrice_Sicon_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "sicon").ToString("f2");
                LinPrice_Point_T.Text     = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "point").ToString("f2");
                Wholesaleone.Checked      = pinfo.Wholesaleone == 1 ? true : false;
                expRemindDP.SelectedValue = pinfo.ExpRemind.ToString();
                FareTlp_Rad.SelectedValue = pinfo.FarePrice;
                ChildPro_Hid.Value        = pinfo.Wholesalesinfo; //多价格
                if (!string.IsNullOrEmpty(pinfo.BindIDS))         //捆绑商品
                {
                    DataTable dt = bll.SelByIDS(pinfo.BindIDS, "id,Thumbnails,Proname,LinPrice");
                    Bind_Hid.Value = JsonConvert.SerializeObject(dt);
                }
                if (!string.IsNullOrEmpty(pinfo.Preset))
                {
                    if (pinfo.Preset.IndexOf(",") > -1)
                    {
                        string[] presetarr = pinfo.Preset.Split(new string[] { "," }, StringSplitOptions.None);
                        for (int s = 0; s < presetarr.Length; s++)
                        {
                            M_Promotions proinfo = pro.GetPromotionsByid(DataConverter.CLng(presetarr[s]));
                            if (proinfo == null)
                            {
                                continue;
                            }
                            OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                        }
                    }
                    else
                    {
                        M_Promotions proinfo = pro.GetPromotionsByid(DataConverter.CLng(pinfo.Preset));
                        if (proinfo != null)
                        {
                            OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString()));
                        }
                    }
                }

                if (OtherProject.Items.Count > 0)
                {
                    for (int d = 0; d < OtherProject.Items.Count; d++)
                    {
                        OtherProject.Items[d].Selected = true;
                    }
                }
                //填充显示会员价
                switch (pinfo.UserType)
                {
                case 1:
                    UserPrice1_Rad.Checked = true;
                    Price_Member_T.Text    = DataConverter.CDouble(pinfo.UserPrice).ToString("f2");
                    price_member_div.Attributes["style"] = "";
                    break;

                case 2:
                    UserPrice2_Rad.Checked = true;
                    price_group_div.Attributes["style"] = "";
                    if (pinfo.UserPrice.Contains("[") && !pinfo.UserPrice.Equals("[]"))
                    {
                        DataTable updt = JsonConvert.DeserializeObject <DataTable>(pinfo.UserPrice);
                        foreach (RepeaterItem item in Price_Group_RPT.Items)
                        {
                            string    gid = (item.FindControl("GroupID_Hid") as HiddenField).Value;
                            DataRow[] drs = updt.Select("gid='" + gid + "'");
                            if (drs.Length > 0)
                            {
                                var text = item.FindControl("Price_Group_T") as TextBox;
                                text.Text = DataConverter.CDouble(drs[0]["Price"]).ToString("f2");
                            }
                        }
                    }
                    break;

                default:
                    UserPrice0_Rad.Checked = true;
                    break;
                }
                txtBookPrice.Text = pinfo.BookPrice.ToString("f2");
                txtBookDay.Text   = pinfo.bookDay.ToString();
                txtDayPrice.Text  = pinfo.FestlPrice.ToString("f2");
                if (pinfo.FestPeriod.Split('|') != null && pinfo.FestPeriod.Split('|').Length > 1)
                {
                    CheckInDate.Text  = pinfo.FestPeriod.Split('|')[0];
                    CheckOutDate.Text = pinfo.FestPeriod.Split('|')[1];
                    serverdate.Value  = CheckInDate.Text;
                    CheckOut.Value    = CheckOutDate.Text;
                }
                //Integral.Text = pinfo.Integral.ToString();
                UpdateTime.Text        = pinfo.UpdateTime.ToString();
                ModeTemplate_hid.Value = pinfo.ModeTemplate.ToString();
                if (pinfo.ProClass == 4)  //团购
                {
                    ColonelStartTimetxt.Text = pinfo.AddTime.ToString();
                    txtColoneDeposit.Text    = pinfo.ColoneDeposit.ToString();
                    if (!string.IsNullOrEmpty(pinfo.ColonelTime))
                    {
                        string[] time = pinfo.ColonelTime.Split('|');
                        if (time != null && time.Length > 1)
                        {
                            ColonelStartTimetxt.Text = time[0];
                            ColonelendTimetxt.Text   = time[1];
                            //如果团购已经开始,且未结束,不允许修改
                            if (DataConverter.CDate(time[0]) <= DateTime.Now && DataConverter.CDate(time[1]) >= DateTime.Now)
                            {
                                ColonelStartTimetxt.Enabled = false;
                                ColonelendTimetxt.Enabled   = false;
                                hfBeginTime.Value           = time[0];
                                hfEndTime.Value             = time[1];
                            }
                        }
                    }
                }
                //Wholesaleone.Checked = pinfo.Wholesaleone == 1 ? true : false;
                isnew.Checked     = pinfo.Isnew == 1;//是否新品,热,等
                ishot.Checked     = pinfo.Ishot == 1;
                isbest.Checked    = pinfo.Isbest == 1;
                Sales_Chk.Checked = pinfo.Sales == 1;
                Allowed.Checked   = pinfo.Allowed == 1;
                DataTable valueDT = bll.Getmodetable(pinfo.TableName.ToString(), DataConverter.CLng(pinfo.ItemID));
                if (valueDT != null && valueDT.Rows.Count > 0)
                {
                    ModelHtml.Text = bfield.InputallHtml(ModelID, NodeID, new ModelConfig()
                    {
                        ValueDT = valueDT
                    });
                }
                //IntegralNum.Text = pinfo.IntegralNum.ToString();
                switch (pinfo.ProjectType)
                {
                case 1:
                    break;

                case 2:
                    ProjectType2_Rad.Checked = true;
                    ProjectPronum2.Text      = pinfo.ProjectPronum.ToString();
                    break;

                case 3:
                    ProjectType3_Rad.Checked = true;
                    ProjectPronum3.Text      = pinfo.ProjectPronum.ToString();
                    Productsname3.Text       = pinfo.PesentNames.ToString();
                    HiddenField3.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 4:
                    ProjectType4_Rad.Checked = true;
                    ProjectPronum4.Text      = pinfo.ProjectPronum.ToString();
                    break;

                case 5:
                    ProjectType5_Rad.Checked = true;
                    ProjectPronum5.Text      = pinfo.ProjectPronum.ToString();
                    Productsname5.Text       = pinfo.PesentNames.ToString();
                    HiddenField5.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 6:
                    ProjectType6_Rad.Checked = true;
                    ProjectMoney7.Text       = pinfo.ProjectMoney.ToString();
                    Productsname6.Text       = pinfo.PesentNames.ToString();
                    HiddenField6.Value       = pinfo.PesentNameid.ToString();
                    break;

                case 7:
                    ProjectType7_Rad.Checked = true;
                    ProjectMoney7.Text       = pinfo.ProjectMoney.ToString();
                    Productsname7.Text       = pinfo.PesentNames.ToString();
                    HiddenField7.Value       = pinfo.PesentNameid.ToString();
                    break;
                }
                #endregion
                #region 多区域价格
                ProGuid = pinfo.ID.ToString();
                M_Shop_RegionPrice regionMod = regionBll.SelModelByGuid(ProGuid);
                if (regionMod != null && !string.IsNullOrEmpty(regionMod.Info))
                {
                    function.Script(this, "region.fill(" + regionMod.Info + ");");
                }
                #endregion
            }
            else
            {
                isnew.Checked     = true;
                Sales_Chk.Checked = true;
                ModelHtml.Text    = bfield.InputallHtml(ModelID, NodeID, new ModelConfig()
                {
                    Source = ModelConfig.SType.Admin
                });
                btnAdd.Visible = false;
            }
            Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li><li><a href='ProductManage.aspx?NodeID='>" + bread1 + "</a></li><li class='active'>" + bread2 + "</li>"
                               + "<div class='pull-right hidden-xs'><span onclick=\"opentitle('../Content/EditNode.aspx?NodeID=" + NodeID + "','配置本节点');\" class='glyphicon glyphicon-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></div>");
        }