protected void AddUPro_Btn_Click(object sender, EventArgs e)
        {
            string         ids    = UProIDS_Hid.Value;
            M_User_BindPro ubpMod = ubpBll.SelModelByUid(UserID);

            if (ubpMod == null)
            {
                ubpMod = new M_User_BindPro();
            }
            ubpMod.ProIDS = StrHelper.PureIDSForDB(ids);
            if (ubpMod.ID > 0)
            {
                ubpBll.UpdateByID(ubpMod);
            }
            else
            {
                M_UserInfo mu = buser.GetUserByUserID(UserID);
                ubpMod.UserID   = mu.UserID;
                ubpMod.UserName = mu.UserName;
                ubpBll.Insert(ubpMod);
            }
            Response.Redirect("UserInfo.aspx?ID=" + UserID + "&tabs=Tabs4");
        }
Ejemplo n.º 2
0
 //会员特选商品逻辑
 private void IsUserProduct(M_Product proMod, string olduids, string newuids)
 {
     #region 特选商品
     //有更改则执行特选商品
     string uids = StrHelper.IDS_GetChange(olduids, newuids);//uprouids_old_hid.Value, uprouids_hid.Value
     if (!string.IsNullOrEmpty(uids))
     {
         //1,目标表中可能无数据
         //2,只对变更部分操作
         //目的:会员可知道自己有哪些商品,商品处也可知道可有哪些特选
         string[] add    = uids.Split('|')[0].Split(',');
         string[] remove = uids.Split('|')[1].Split(',');
         foreach (string id in add)
         {
             int uid = DataConvert.CLng(id);
             if (uid < 1)
             {
                 continue;
             }
             M_User_BindPro bindMod = bindBll.SelModelByUid(uid);
             if (bindMod == null)
             {
                 bindMod = new M_User_BindPro()
                 {
                     UserID = uid
                 };
             }
             bindMod.ProIDS = StrHelper.AddToIDS(bindMod.ProIDS, proMod.ID.ToString());
             if (bindMod.ID > 0)
             {
                 bindBll.UpdateByID(bindMod);
             }
             else
             {
                 bindBll.Insert(bindMod);
             }
         }
         foreach (string id in remove)
         {
             int uid = DataConvert.CLng(id);
             if (uid < 1)
             {
                 continue;
             }
             M_User_BindPro bindMod = bindBll.SelModelByUid(uid);
             if (bindMod == null)
             {
                 bindMod = new M_User_BindPro()
                 {
                     UserID = uid
                 };
             }
             bindMod.ProIDS = StrHelper.RemoveToIDS(bindMod.ProIDS, proMod.ID.ToString());
             if (bindMod.ID > 0)
             {
                 bindBll.UpdateByID(bindMod);
             }
             else
             {
                 bindBll.Insert(bindMod);
             }
         }
     }
     #endregion
 }