public int Insert(M_User_BindPro model) { if (DBCenter.IsExist(TbName, "UserID=" + model.UserID)) { return(0); } return(DBCenter.Insert(model)); }
protected void Page_Load(object sender, EventArgs e) { M_UserInfo mu = GetLogin(); if (!IsPostBack) { ProModel model = new ProModel() { ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"]) }; model.Pronum = model.Pronum < 1 ? 1 : model.Pronum; if (model.ProID > 0)//将商品加入购物车 { M_Product proMod = proBll.GetproductByid(model.ProID); if (proMod == null || proMod.ID < 1) { function.WriteErrMsg("商品不存在"); } if (proMod.ProClass == (int)M_Product.ClassType.IDC) { Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID); } OrderCommon.ProductCheck(proMod); #region 特选商品逻辑 [delete] if (proMod.Largess == 1) { B_User_BindPro ubpBll = new B_User_BindPro(); M_User_BindPro ubpMod = null; if (mu.IsNull) { return; } ubpMod = ubpBll.SelModelByUid(mu.UserID); if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ",")) { Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return; } } #endregion //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = model.ProID; cartMod.Pronum = model.Pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.ProAttr = DataConvert.CStr(Request["attr"]); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); //ImportExtField(id, Request.Form["ext_hid"]);//模型字段 Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); } MyBind(); } }
public int Insert(M_User_BindPro model) { //不允许重复,自动读取值 if (DBCenter.IsExist(TbName, "UserID=" + model.UserID)) { M_User_BindPro existMod = SelModelByUid(model.UserID); model.ID = existMod.ID; UpdateByID(model); return(model.ID); } return(DBCenter.Insert(model)); }
//根据传参将商品加入购物车后跳转(支持按商品ID,套装ID购买) private void AddToCart(M_UserInfo mu, M_Product proMod, int pronum) { if (pronum < 1) { pronum = 1; } if (proMod == null || proMod.ID < 1) { return; } //商品不存在 if (proMod.ProClass == (int)M_Product.ClassType.IDC) { Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID); } OrderCommon.ProductCheck(proMod); #region 特选商品逻辑 [delete] if (proMod.Largess == 1) { B_User_BindPro ubpBll = new B_User_BindPro(); M_User_BindPro ubpMod = null; if (mu.IsNull) { return; } ubpMod = ubpBll.SelModelByUid(mu.UserID); if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ",")) { Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return; } } #endregion //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = proMod.ID; cartMod.Pronum = pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.ProAttr = DataConvert.CStr(Request["attr"]); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); }
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"); }
//会员特选商品逻辑 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 }
public bool UpdateByID(M_User_BindPro model) { return(DBCenter.UpdateByID(model, model.ID)); }
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>"); } } }