private void ShowInfo(int _id) { BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); txtTitle.Text = model.title; if (model.is_lock == 1) { rblIsLock.Checked = true; } if (model.is_default == 1) { rblIsDefault.Checked = true; } if (model.is_upgrade == 1) { rblIsUpgrade.Checked = true; } txtGrade.Text = model.grade.ToString(); txtUpgradeExp.Text = model.upgrade_exp.ToString(); txtAmount.Text = model.amount.ToString(); txtPoint.Text = model.point.ToString(); txtDiscount.Text = model.discount.ToString(); //充值活动 if (siteConfig.rechangestatus == 1) { dlrpter.Visible = true; } BuysingooShop.BLL.activity bllAct = new BuysingooShop.BLL.activity(); DataTable table = bllAct.GetList(0, "id=" + model.id, "id asc").Tables[0]; rptPrice.DataSource = table; rptPrice.DataBind(); }
private void RptBind(string _strWhere) { this.txtKeywords.Text = this.keywords; BLL.user_groups bll = new BLL.user_groups(); this.rptList.DataSource = bll.GetList(0, _strWhere, "grade asc,id asc"); this.rptList.DataBind(); }
private bool DoAdd() { bool result = false; Model.user_groups model = new Model.user_groups(); BLL.user_groups bll = new BLL.user_groups(); model.title = txtTitle.Text.Trim(); model.is_lock = 0; if (rblIsLock.Checked == true) { model.is_lock = 1; } model.is_default = 0; if (rblIsDefault.Checked == true) { model.is_default = 1; } model.is_upgrade = 0; if (rblIsUpgrade.Checked == true) { model.is_upgrade = 1; } model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户组:" + model.title); //记录日志 result = true; } return result; }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_group", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.user_groups bll = new BLL.user_groups(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户组成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("group_list.aspx", "keywords={0}", txtKeywords.Text.Trim()), "Success"); }
private void ShowInfo(int _id) { BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); var department = context.li_user_group_departments.FirstOrDefault(f => f.user_group_id == model.id); txtTitle.Text = model.title; if (department != null) { ddlDepartments.SelectedValue = department.department_id.ToString(); } if (model.is_lock == 1) { rblIsLock.Checked = true; } if (model.is_default == 1) { rblIsDefault.Checked = true; } /*if (model.is_upgrade == 1) * { * rblIsUpgrade.Checked = true; * } * txtGrade.Text = model.grade.ToString(); * txtUpgradeExp.Text = model.upgrade_exp.ToString(); * txtAmount.Text = model.amount.ToString(); * txtPoint.Text = model.point.ToString(); * txtDiscount.Text = model.discount.ToString();*/ }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_group", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.user_groups bll = new BLL.user_groups(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户组成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("group_list.aspx", "keywords={0}", txtKeywords.Text.Trim()), "Success"); }
/// <summary> /// 转换成List /// </summary> public static List <Model.cart_items> ToList(List <Model.cart_keys> ls, int group_id) { if (ls != null) { List <Model.cart_items> iList = new List <Model.cart_items>(); foreach (Model.cart_keys item in ls) { //查询文章的信息 Model.article articleModel = new BLL.article().GetModel(item.channel_id, item.article_id); if (articleModel == null || !articleModel.fields.ContainsKey("sell_price")) { continue; } //开始赋值 Model.cart_items modelt = new Model.cart_items(); modelt.channel_id = articleModel.channel_id; modelt.article_id = articleModel.id; if (articleModel.fields.ContainsKey("goods_no")) { modelt.goods_no = articleModel.fields["goods_no"]; } modelt.title = articleModel.title; modelt.img_url = articleModel.img_url; modelt.sell_price = ConvertTool.ToDecimal(articleModel.fields["sell_price"], 0); modelt.user_price = ConvertTool.ToDecimal(articleModel.fields["sell_price"], 0); if (articleModel.fields.ContainsKey("point")) { modelt.point = ConvertTool.ToInt(articleModel.fields["point"], 0); } if (articleModel.fields.ContainsKey("stock_quantity")) { modelt.stock_quantity = ConvertTool.ToInt(articleModel.fields["stock_quantity"], 0); } bool setStatus = false; //会员组价格赋值状态 if (group_id > 0 && articleModel.group_price != null) { Model.user_group_price userPriceModel = articleModel.group_price.Find(p => p.group_id == group_id); if (userPriceModel != null) { setStatus = true; //已赋值 modelt.user_price = userPriceModel.price; } } //如果未曾有会员组价格则使用折扣价格 if (group_id > 0 && !setStatus) { int discount = new BLL.user_groups().GetDiscount(group_id); if (discount > 0) { modelt.user_price = modelt.sell_price * discount / 100; } } modelt.quantity = item.quantity; //添加入列表 iList.Add(modelt); } return(iList); } return(null); }
public void ToFirstPay(Model.users model) { if (model.group_id == 5) { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功');window.location.href='index.aspx'</script>"); } else { if (model.group_id == 1) { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功');window.location.href='index.aspx'</script>"); } else { BLL.user_groups bllusergroup = new BLL.user_groups(); //string typeName = string.Empty; //typeName = bllusergroup.GetTitle(model.group_id); //string txt = "恭喜您註冊成功,您註冊的是" + typeName + "會員,若未交費,則您目前的會員級別仍為普通會員"; //if (model.group_id == 1) //{ // txt = "恭喜您註冊成功"; //} //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + txt + "');window.location.href='RegPay.aspx?paymenttype=" + DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlzhifu") + "'</script>"); ToPay(model.id); } } }
private bool DoAdd() { bool result = false; Model.user_groups model = new Model.user_groups(); BLL.user_groups bll = new BLL.user_groups(); model.title = txtTitle.Text.Trim(); model.is_lock = 0; if (rblIsLock.Checked == true) { model.is_lock = 1; } model.is_default = 0; if (rblIsDefault.Checked == true) { model.is_default = 1; } model.is_upgrade = 0; if (rblIsUpgrade.Checked == true) { model.is_upgrade = 1; } model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户组:" + model.title); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = false; Model.user_groups model = new Model.user_groups(); BLL.user_groups bll = new BLL.user_groups(); model.title = txtTitle.Text.Trim(); model.is_lock = 0; if (rblIsLock.Checked == true) { model.is_lock = 1; } model.is_default = 0; if (rblIsDefault.Checked == true) { model.is_default = 1; } model.is_upgrade = 0; if (rblIsUpgrade.Checked == true) { model.is_upgrade = 1; } model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); //充值活动 if (siteConfig.rechangestatus == 1) { dlrpter.Visible = true; List <Model.activity> list = new List <Model.activity>(); string[] itemfieldsArr = Request.Form.GetValues("itemfields"); string[] itemvaluesArr = Request.Form.GetValues("itemvalues"); if (itemfieldsArr != null && itemvaluesArr != null) { for (int i = 0; i < itemfieldsArr.Length; i++) { list.Add(new Model.activity { fields = itemfieldsArr[i], ID = model.id, value = itemvaluesArr[i] }); } } model.Acticity = list; } if (bll.Add(model) > 0) { AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加用户组:" + model.title); //记录日志 result = true; } return(result); }
private void GroupBind(string strWhere) { BLL.user_groups bll = new BLL.user_groups(); //DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); //if (ds.Tables[0].Rows.Count > 0) //{ // this.rptPrice.DataSource = ds; // this.rptPrice.DataBind(); //} }
private bool DoEdit(int _id) { bool result = false; BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.is_lock = 0; if (rblIsLock.Checked) { model.is_lock = 1; } model.is_default = 0; model.is_upgrade = 0; if (rblIsDefault.Checked) { model.is_default = 1; } /*if (rblIsUpgrade.Checked) * { * model.is_upgrade = 1; * } * model.grade = int.Parse(txtGrade.Text.Trim()); * model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); * model.amount = decimal.Parse(txtAmount.Text.Trim()); * model.point = int.Parse(txtPoint.Text.Trim()); * model.discount = int.Parse(txtDiscount.Text.Trim());*/ if (bll.Update(model)) { if (ddlDepartments.SelectedValue != "") { var selectedGroups = context.li_user_group_departments.Where(k => k.user_group_id == _id).ToList(); context.li_user_group_departments.DeleteAllOnSubmit(selectedGroups); var tr = new li_user_group_departments { user_group_id = _id, department_id = Convert.ToInt32(ddlDepartments.SelectedValue) }; context.li_user_group_departments.InsertOnSubmit(tr); } else { var selectedGroups = context.li_user_group_departments.Where(k => k.user_group_id == _id).ToList(); context.li_user_group_departments.DeleteAllOnSubmit(selectedGroups); } context.SubmitChanges(); AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户组:" + model.title); //记录日志 result = true; } return(result); }
private void TreeBind(string strWhere) { BLL.user_groups bll = new BLL.user_groups(); DataTable dt = bll.GetList(0, strWhere, "grade asc,id asc").Tables[0]; this.cblGroupId.Items.Clear(); foreach (DataRow dr in dt.Rows) { this.cblGroupId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString())); } }
private void TreeBind(string strWhere) { BLL.user_groups bll = new BLL.user_groups(); DataTable dt = bll.GetList(0, strWhere, "id desc").Tables[0]; this.ddlGroupId.Items.Clear(); this.ddlGroupId.Items.Add(new ListItem("所有会员组", "")); //this.ddlGroupId.Items.Add(new ListItem("新用户", "0")); foreach (DataRow dr in dt.Rows) { this.ddlGroupId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString())); } }
private void ShowInfo(int _id) { BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); txtTitle.Text = model.title; rblIsLock.SelectedValue = model.is_lock.ToString(); rblIsDefault.SelectedValue = model.is_default.ToString(); rblIsUpgrade.SelectedValue = model.is_upgrade.ToString(); txtGrade.Text = model.grade.ToString(); txtUpgradeExp.Text = model.upgrade_exp.ToString(); txtAmount.Text = model.amount.ToString(); txtPoint.Text = model.point.ToString(); txtDiscount.Text = model.discount.ToString(); }
//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_groups", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.user_groups bll = new BLL.user_groups(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("group_list.aspx", "keywords={0}", txtKeywords.Text.Trim()), "Success"); }
private void GroupBind(string strWhere) { //检查网站是否开启会员功能 if (siteConfig.memberstatus == 0) { return; } //检查该频道是否开启会员组价格 Model.channel model = new BLL.channel().GetModel(this.channel_id); if (model == null || model.is_group_price == 0) { return; } BLL.user_groups bll = new BLL.user_groups(); DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); }
public void UpUserPoint(decimal price) { int points = 0; int typeValue = 100; int UID = WEBUserCurrent.UserID; Model.users mod = new Model.users(); BLL.user_groups BLLGroup = new BLL.user_groups(); mod = User.GetModel(UID); if (mod != null) { switch (mod.group_id) { case 1: typeValue = BLLGroup.GetZheKou(mod.group_id); break; case 2: typeValue = BLLGroup.GetZheKou(mod.group_id); break; case 3: typeValue = BLLGroup.GetZheKou(mod.group_id); break; case 4: typeValue = BLLGroup.GetZheKou(mod.group_id); break; } double s = double.Parse(((price * typeValue) / 100).ToString()); string result = s.ToString("#0"); points = Utils.StringToNum(result); User.UpPoint(UID, points); BLL.point_log point = new BLL.point_log(); Model.point_log model = new Model.point_log(); model.user_id = UID; model.user_name = hideNo.Value; model.value = points; model.remark = "購物回饋點數"; model.add_time = DateTime.Now; model.type = 1;//2標誌點數是減少 int m = point.Add(model); } }
private void login() { BLL.users bll = new BLL.users(); var model = bll.GetModel(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername"), DESEncrypt.Encrypt(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtpassword")), 0); if (model != null) { HttpCookie ccookie1 = new HttpCookie("WEBUSERID", model.id.ToString()); HttpCookie ccookie2 = new HttpCookie("WEBUserNamecook", model.user_name.ToString()); HttpCookie ccookie3 = new HttpCookie("WEBRealNamecook", model.nick_name.ToString()); HttpCookie ccookie4 = new HttpCookie("WEBUserTypecook", model.group_id.ToString()); Response.Cookies.Add(ccookie1); Response.Cookies.Add(ccookie2); Response.Cookies.Add(ccookie3); Response.Cookies.Add(ccookie4); if (model.group_id == 5) { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功');window.location.href='userSJ.aspx'</script>"); } else { if (DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlGroup") == "1") { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功');window.location.href='userinfo.aspx'</script>"); } else { BLL.user_groups bllusergroup = new BLL.user_groups(); string typeName = string.Empty; if (!string.IsNullOrEmpty(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlGroup"))) { typeName = bllusergroup.GetTitle(Utils.StringToNum(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlGroup"))); } string txt = "恭喜您註冊成功,您註冊的是" + typeName + "會員,若未交費,則您目前的會員級別仍為普通會員"; if (DTRequest.GetFormString("ddlGroup") == "1") { txt = "恭喜您註冊成功"; } //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + txt + "');window.location.href='RegPay.aspx?paymenttype=" + DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlzhifu") + "'</script>"); ToPay(1); } } } }
private void Bindinfo() { var usermodel = daluser.GetModel(WEBUserCurrent.UserID); lblUsername.Text = usermodel.user_name; txtpassword.Attributes.Add("Value", DESEncrypt.Decrypt(usermodel.password)); txtpassword2.Attributes.Add("Value", DESEncrypt.Decrypt(usermodel.password)); txtName.Value = usermodel.nick_name; txtemall.Value = usermodel.email; txtAddress.Value = usermodel.address; txtphone.Value = usermodel.telphone; txtMobile.Value = usermodel.mobile; txtQQ.Value = usermodel.qq; txtsafe_question.Value = usermodel.safe_question; txtsafe_answer.Value = usermodel.safe_answer; ViewState["Image"] = usermodel.avatar; txtsafe_question.Value = usermodel.safe_question; txtsafe_answer.Value = usermodel.safe_answer; lblPoint.Text = usermodel.point.ToString(); BLL.user_groups bllusergroup = new BLL.user_groups(); string typeName = "普通會員"; if (!string.IsNullOrEmpty(usermodel.group_id.ToString())) { typeName = bllusergroup.GetTitle(usermodel.group_id); } lblGroupName.Text = typeName + "會員"; if (usermodel.group_id == 1) { Session["Type"] = 0; UpUserGroup.Text = "您是" + new DAL.user_groups().GetTitle(usermodel.group_id) + "會員,點擊" + "<a href=\"shengji.aspx?giD=" + usermodel.group_id + "\" target=\"_blank\">升級</a>"; } if (usermodel.group_id != 1 && usermodel.group_id != 5) { if (usermodel.endtime.AddDays(2).AddDays(-30) == DateTime.Now) { Session["Type"] = 1; UpUserGroup.Text = "您是" + new DAL.user_groups().GetTitle(usermodel.group_id) + "會員,將在30天後到期,點擊" + "<a href=\"shengji.aspx?giD=" + usermodel.group_id + "\" target=\"_blank\">續費</a>"; } } }
private bool DoAdd() { bool result = true; Model.user_groups model = new Model.user_groups(); BLL.user_groups bll = new BLL.user_groups(); model.title = txtTitle.Text.Trim(); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.is_default = int.Parse(rblIsDefault.SelectedValue); model.is_upgrade = int.Parse(rblIsUpgrade.SelectedValue); model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); if (bll.Add(model) < 1) { result = false; } return result; }
private void GroupBind(string strWhere) { //检查网站是否开启会员功能 if (sysConfig.memberstatus == 0) { return; } //检查该频道是否开启会员组价格 if (channelModel.is_spec == 0) { return; } BLL.user_groups bll = new BLL.user_groups(); DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); if (ds.Tables[0].Rows.Count > 0) { this.rptPrice.DataSource = ds; this.rptPrice.DataBind(); } }
private bool DoAdd() { bool result = true; Model.user_groups model = new Model.user_groups(); BLL.user_groups bll = new BLL.user_groups(); model.title = txtTitle.Text.Trim(); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.is_default = int.Parse(rblIsDefault.SelectedValue); model.is_upgrade = int.Parse(rblIsUpgrade.SelectedValue); model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); if (bll.Add(model) < 1) { result = false; } return(result); }
private void GroupBind(string strWhere) { //檢查網站是否開啟會員功能 if (siteConfig.memberstatus == 0) { return; } //檢查該頻道是否開啟會員組價格 Model.channel model = new BLL.channel().GetModel(this.channel_id); if (model == null || model.is_spec == 0) { return; } BLL.user_groups bll = new BLL.user_groups(); DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); if (ds.Tables[0].Rows.Count > 0) { this.rptPrice.DataSource = ds; this.rptPrice.DataBind(); } }
private void ShowInfo(int _id) { BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); txtTitle.Text = model.title; if (model.is_lock == 1) { rblIsLock.Checked = true; } if (model.is_default == 1) { rblIsDefault.Checked = true; } if (model.is_upgrade == 1) { rblIsUpgrade.Checked = true; } txtGrade.Text = model.grade.ToString(); txtUpgradeExp.Text = model.upgrade_exp.ToString(); txtAmount.Text = model.amount.ToString(); txtPoint.Text = model.point.ToString(); txtDiscount.Text = model.discount.ToString(); }
private bool DoEdit(int _id) { bool result = false; BLL.user_groups bll = new BLL.user_groups(); Model.user_groups model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.call_index = txtCallIndex.Text.Trim(); model.is_lock = 0; if (rblIsLock.Checked == true) { model.is_lock = 1; } model.is_default = 0; if (rblIsDefault.Checked == true) { model.is_default = 1; } model.is_upgrade = 0; if (rblIsUpgrade.Checked == true) { model.is_upgrade = 1; } model.grade = int.Parse(txtGrade.Text.Trim()); model.upgrade_exp = int.Parse(txtUpgradeExp.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.point = int.Parse(txtPoint.Text.Trim()); model.discount = int.Parse(txtDiscount.Text.Trim()); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户组:" + model.title); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(_id); //绑定商品列表 this.rptList.DataSource = model.order_goods; this.rptList.DataBind(); //获得会员信息 if (model.user_id > 0) { Model.users user_info = new BLL.users().GetModel(model.user_id); if (user_info != null) { Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id); if (group_info != null) { dlUserInfo.Visible = true; lbUserName.Text = user_info.user_name; lbUserGroup.Text = group_info.title; lbUserDiscount.Text = group_info.discount.ToString() + " %"; // lbUserAmount.Text = user_info.amount.ToString(); // lbUserPoint.Text = user_info.point.ToString(); } } } //根据订单状态,显示各类操作按钮 switch (model.status) { case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认 if (model.payment_status > 0) { //确认付款、取消订单、修改收货按钮显示 btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else { //确认订单、取消订单、修改收货按钮显示 btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改积分总计按钮显示 btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = true; break; case 2: //如果订单为已确认状态,则进入送货状态 if (model.express_status == 1) { //确认送货、取消订单、修改收货信息按钮显示 btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else if (model.express_status == 2) { //完成订单、取消订单按钮可见 btnComplete.Visible = btnCancel.Visible = true; } //修改订单备注按钮可见 btnEditRemark.Visible = true; break; case 3: //作废订单、修改订单备注按钮可见 btnInvalid.Visible = btnEditRemark.Visible = true; break; } }
private void GroupBind(string strWhere) { //检查网站是否开启会员功能 if (siteConfig.memberstatus == 0) { return; } //检查该频道是否开启会员组价格 Model.channel model = new BLL.channel().GetModel(this.channel_id); if (model == null || model.is_group_price == 0) { return; } BLL.user_groups bll = new BLL.user_groups(); DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); if (ds.Tables[0].Rows.Count > 0) { this.rptPrice.DataSource = ds; this.rptPrice.DataBind(); } }
/// <summary> /// 转换成List /// </summary> public static List <Model.cart_items> ToList(List <Model.cart_keys> ls, int group_id) { if (ls != null) { List <Model.cart_items> iList = new List <Model.cart_items>(); foreach (Model.cart_keys item in ls) { //查询文章的信息 Model.article articleModel = new BLL.article().GetModel(item.article_id); if (articleModel == null || !articleModel.fields.ContainsKey("sell_price")) { continue; } //查询商品信息 Model.article_goods goodsModel = articleModel.goods.Find(p => p.id == item.goods_id); if (articleModel.goods != null && articleModel.goods.Count > 0 && goodsModel == null) { continue; } //开始赋值 Model.cart_items modelt = new Model.cart_items(); modelt.article_id = articleModel.id; if (articleModel.fields.ContainsKey("goods_no")) { modelt.goods_no = articleModel.fields["goods_no"]; } modelt.title = articleModel.title; modelt.img_url = articleModel.img_url; modelt.seller_id = articleModel.user_id; //供应商id modelt.seller_name = articleModel.user_name; //供应商name modelt.sell_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); modelt.user_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); if (articleModel.fields.ContainsKey("point")) { modelt.point = Utils.StrToInt(articleModel.fields["point"], 0); } if (articleModel.fields.ContainsKey("stock_quantity")) { modelt.stock_quantity = Utils.StrToInt(articleModel.fields["stock_quantity"], 0); } bool setStatus = false; //会员组价格赋值状态 if (goodsModel != null) { modelt.stock_quantity = goodsModel.stock_quantity; //库存 modelt.sell_price = goodsModel.sell_price; //商品价格 modelt.user_price = goodsModel.sell_price; //会员组价格 modelt.goods_id = goodsModel.id; modelt.goods_no = goodsModel.goods_no; modelt.spec_text = goodsModel.spec_text; //会员组价格 if (group_id > 0 && goodsModel.group_prices != null) { Model.user_group_price userPriceModel = goodsModel.group_prices.Find(p => p.group_id == group_id); if (userPriceModel != null) { setStatus = true; //已赋值 modelt.user_price = userPriceModel.price; } } } //如果未曾有会员组价格则使用折扣价格 if (group_id > 0 && !setStatus) { int discount = new BLL.user_groups().GetDiscount(group_id); if (discount > 0) { modelt.user_price = modelt.sell_price * discount / 100; } } modelt.quantity = item.quantity; modelt.use_date = item.use_date;//add by 赵成龙 //添加入列表 iList.Add(modelt); } return(iList); } return(null); }
private void user_register(HttpContext context) { string code = DTRequest.GetFormString("txtCode").Trim(); string invitecode = DTRequest.GetFormString("txtInviteCode").Trim(); string username = Utils.ToHtml(DTRequest.GetFormString("txtUserName").Trim()); string password = DTRequest.GetFormString("txtPassword").Trim(); string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim()); string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim()); string userip = DTRequest.GetIP(); #region 检查各项并提示 //检查是否开启会员功能 if (siteConfig.memberstatus == 0) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,会员功能已关闭,无法注册!\"}"); return; } if (userConfig.regstatus == 0) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,系统暂不允许注册新用户!\"}"); return; } //校检验证码,如果注册使用手机短信则只需验证手机验证码,否则使用网页验证码 if (userConfig.regstatus == 2) //手机验证码 { string result = verify_sms_code(context, code); if (result != "success") { context.Response.Write(result); return; } } else //网页验证码 { string result = verify_code(context, code); if (result != "success") { context.Response.Write(result); return; } } //检查用户输入信息是否为空 if (username == "" || password == "") { context.Response.Write("{\"status\":0, \"msg\":\"错误:用户名和密码不能为空!\"}"); return; } if (userConfig.regemailditto == 0 && email == "") { context.Response.Write("{\"status\":0, \"msg\":\"错误:电子邮箱不能为空!\"}"); return; } if (userConfig.mobilelogin == 1 && mobile == "") { context.Response.Write("{\"status\":0, \"msg\":\"错误:手机号码不能为空!\"}"); return; } //检查用户名 BLL.users bll = new BLL.users(); Model.users model = new Model.users(); if (bll.Exists(username)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户名已经存在!\"}"); return; } //检查同一IP注册时隔 if (userConfig.regctrl > 0) { if (bll.Exists(userip, userConfig.regctrl)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,同IP在" + userConfig.regctrl + "小时内禁止重复注册!\"}"); return; } } //不允许同一Email注册不同用户 if (userConfig.regemailditto == 0 || userConfig.emaillogin == 1) { if (bll.ExistsEmail(email)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该邮箱已被注册!\"}"); return; } } //不允许同一手机号码注册不同用户 if (userConfig.mobilelogin == 1) { if (bll.ExistsMobile(mobile)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被注册!\"}"); return; } } //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系网站管理员!\"}"); return; } //检查是否通过邀请码注册 if (userConfig.regstatus == 2) { string result1 = verify_invite_reg(username, invitecode); if (result1 != "success") { context.Response.Write(result1); return; } } #endregion //保存注册信息 model.group_id = modelGroup.id; model.user_name = username; model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串 model.password = DESEncrypt.Encrypt(password, model.salt); model.email = email; model.mobile = mobile; model.reg_ip = userip; model.reg_time = DateTime.Now; //设置对应的状态 switch (userConfig.regverify) { case 0: model.status = 0; //正常 break; case 3: model.status = 2; //人工审核 break; default: model.status = 1; //待验证 break; } int newId = bll.Add(model); if (newId < 1) { context.Response.Write("{\"status\":0, \"msg\":\"系统故障,请联系网站管理员!\"}"); return; } model = bll.GetModel(newId); //赠送积分金额 if (modelGroup.point > 0) { new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false); } if (modelGroup.amount > 0) { new BLL.user_amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1); } #region 判断是否发送欢迎消息 if (userConfig.regmsgstatus == 1) //站内短消息 { new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } else if (userConfig.regmsgstatus == 2) //发送邮件 { //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg"); if (mailModel != null) { //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); //发送邮件 DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, model.email, mailTitle, mailContent); } } else if (userConfig.regmsgstatus == 3 && mobile != "") //发送短信 { Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容 if (smsModel != null) { //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{weburl}", siteConfig.weburl); msgContent = msgContent.Replace("{webtel}", siteConfig.webtel); msgContent = msgContent.Replace("{username}", model.user_name); //发送短信 string tipMsg = string.Empty; new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); } } #endregion //需要Email验证 if (userConfig.regverify == 1) { string result2 = verify_email(model); if (result2 != "success") { context.Response.Write(result2); return; } context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msg\":\"注册成功,请进入邮箱验证激活账户!\"}"); } //手机短信验证 else if (userConfig.regverify == 2) { string result3 = verify_mobile(model); if (result3 != "success") { context.Response.Write(result3); return; } context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendsms&username="******"\", \"msg\":\"注册成功,请查收短信验证激活账户!\"}"); } //需要人工审核 else if (userConfig.regverify == 3) { context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msg\":\"注册成功,请等待审核通过!\"}"); } else { context.Session[DTKeys.SESSION_USER_INFO] = model; context.Session.Timeout = 45; //防止Session提前过期 Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name); Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password); //写入登录日志 new BLL.user_login_log().Add(model.id, model.user_name, "会员登录"); context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=succeed&username="******"\", \"msg\":\"注册成功,欢迎成为本站会员!\"}"); } return; }
public bool UpdatePaied(string order_no, string strValue) { using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { StringBuilder strSql1 = new StringBuilder(); strSql1.Append("update " + siteConfig.sysdatabaseprefix + "orders set " + strValue); strSql1.Append(" where order_no='@orderno';"); SqlParameter[] parameters1 = { new SqlParameter("@orderno", SqlDbType.NVarChar, 50) }; parameters1[0].Value = order_no; DbHelperSQL.GetSingle(conn, trans, strSql1.ToString(), parameters1); //带事务 var model = GetModel(order_no); var user = new users().GetModel(model.user_name); foreach (var g in model.order_goods) { var abll = new article(); if (abll.IsCard(g.article_id)) { StringBuilder strSql = new StringBuilder(); var article = abll.GetModel(g.article_id); string callindex = article.fields["cardcategorycallindex"]; var cardcategory = new BLL.CardCategory().GetModel(callindex); var ug = new BLL.user_groups().GetModel(cardcategory.UserGroupCallIndex); strSql.Append("insert into " + siteConfig.edudatabaseprefix + "Card("); strSql.Append("CardCategoryId,Code,CreateDate,StartDate,EndDate"); strSql.Append(") values ("); strSql.Append("@CardCategoryId,@Code,@CreateDate,@StartDate,@EndDate"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@CardCategoryId", SqlDbType.Int, 4), new SqlParameter("@Code", SqlDbType.VarChar, 50), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@StartDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime) }; var startTime = DateTime.Now; var endTime = DateTime.Now.AddDays((double)cardcategory.Duration); parameters[0].Value = cardcategory.CardCategoryId; parameters[1].Value = Utils.GetCheckCode(7);; parameters[2].Value = startTime; parameters[3].Value = startTime; parameters[4].Value = endTime; object obj = DbHelperSQL.GetSingle(conn, trans, strSql.ToString(), parameters); //带事务 int id = Convert.ToInt32(obj); StringBuilder strSqlUC = new StringBuilder(); strSqlUC.Append("insert into " + siteConfig.edudatabaseprefix + "UserCard("); strSqlUC.Append("CardId,UserId,CardCategoryId"); strSqlUC.Append(") values ("); strSqlUC.Append("@CardId,@UserId,@CardCategoryId"); strSqlUC.Append(") "); strSqlUC.Append(";select @@IDENTITY"); SqlParameter[] parametersUC = { new SqlParameter("@CardId", SqlDbType.Int, 4), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@CardCategoryId", SqlDbType.Int, 4) }; parametersUC[0].Value = id; parametersUC[1].Value = model.user_id; parametersUC[2].Value = cardcategory.CardCategoryId; DbHelperSQL.GetSingle(conn, trans, strSqlUC.ToString(), parametersUC); StringBuilder strSqlUU = new StringBuilder(); strSqlUU.Append("update " + siteConfig.sysdatabaseprefix + "users set "); strSqlUU.Append(" group_id=@group_id,"); strSqlUU.Append(" group_start_time=@group_start_time,"); strSqlUU.Append(" group_end_time=@group_end_time "); strSqlUU.Append(" where id=@id"); SqlParameter[] parametersUU = { new SqlParameter("@group_id", SqlDbType.Int, 4), new SqlParameter("@group_start_time", SqlDbType.DateTime), new SqlParameter("@group_end_time", SqlDbType.DateTime), new SqlParameter("@id", SqlDbType.Int, 4) }; parametersUU[0].Value = ug.id; parametersUU[1].Value = startTime; parametersUU[2].Value = endTime; parametersUU[3].Value = user.id; DbHelperSQL.GetSingle(conn, trans, strSqlUU.ToString(), parametersUU); } } trans.Commit(); } catch (Exception ex) { trans.Rollback(); return(false); } } } return(true); }
private void user_oauth_register(HttpContext context) { //检查URL参数 if (context.Session["oauth_name"] == null) { context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:授权参数不正确!\"}"); return; } //获取授权信息 string result = Vincent._DTcms.Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx"); if (result.Contains("error")) { context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:请检查URL是否正确!\"}"); return; } //反序列化JSON Dictionary <string, object> dic = JsonMapper.ToObject <Dictionary <string, object> >(result); if (dic["ret"].ToString() != "0") { context.Response.Write("{\"status\": 0, \"msg\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}"); return; } string password = Vincent._DTcms.DTRequest.GetFormString("txtPassword").Trim(); string email = Vincent._DTcms.Utils.ToHtml(Vincent._DTcms.DTRequest.GetFormString("txtEmail").Trim()); string mobile = Vincent._DTcms.Utils.ToHtml(Vincent._DTcms.DTRequest.GetFormString("txtMobile").Trim()); string userip = Vincent._DTcms.DTRequest.GetIP(); BLL.users bll = new BLL.users(); Model.users model = new Model.users(); //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系管理员!\"}"); return; } //保存注册信息 model.group_id = modelGroup.id; model.user_name = bll.GetRandomName(10); //随机用户名 model.salt = Vincent._DTcms.Utils.GetCheckCode(6); //获得6位的salt加密字符串 model.password = _DESEncrypt.Encrypt(password, model.salt); model.email = email; model.mobile = mobile; if (!string.IsNullOrEmpty(dic["nick"].ToString())) { model.nick_name = dic["nick"].ToString(); } if (dic["avatar"].ToString().StartsWith("http://")) { model.avatar = dic["avatar"].ToString(); } if (!string.IsNullOrEmpty(dic["sex"].ToString())) { model.sex = dic["sex"].ToString(); } if (!string.IsNullOrEmpty(dic["birthday"].ToString())) { model.birthday = Vincent._DTcms.Utils.StrToDateTime(dic["birthday"].ToString()); } model.reg_ip = userip; model.reg_time = DateTime.Now; model.status = 0; //设置为正常状态 int newId = bll.Add(model); if (newId < 1) { context.Response.Write("{\"status\":0, \"msg\":\"注册失败,请联系网站管理员!\"}"); return; } model = bll.GetModel(newId); //赠送积分金额 if (modelGroup.point > 0) { new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false); } if (modelGroup.amount > 0) { new BLL.user_amount_log().Add(model.id, model.user_name, Vincent._DTcms.DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1); } //判断是否发送欢迎消息 if (userConfig.regmsgstatus == 1) //站内短消息 { new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } else if (userConfig.regmsgstatus == 2) //发送邮件 { //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg"); if (mailModel != null) { //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); //发送邮件 _Email.SendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, model.email, mailTitle, mailContent); } } else if (userConfig.regmsgstatus == 3 && mobile != "") //发送短信 { Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容 if (smsModel != null) { //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{weburl}", siteConfig.weburl); msgContent = msgContent.Replace("{webtel}", siteConfig.webtel); msgContent = msgContent.Replace("{username}", model.user_name); //发送短信 string tipMsg = string.Empty; new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); } } //绑定到对应的授权类型 Model.user_oauth oauthModel = new Model.user_oauth(); oauthModel.oauth_name = dic["oauth_name"].ToString(); oauthModel.user_id = model.id; oauthModel.user_name = model.user_name; oauthModel.oauth_access_token = dic["oauth_access_token"].ToString(); oauthModel.oauth_openid = dic["oauth_openid"].ToString(); new BLL.user_oauth().Add(oauthModel); context.Session[Vincent._DTcms.DTKeys.SESSION_USER_INFO] = model; context.Session.Timeout = 45; //记住登录状态,防止Session提前过期 Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_NAME_REMEMBER, "BuysingooShop", model.user_name); Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_PWD_REMEMBER, "BuysingooShop", model.password); //写入登录日志 new BLL.user_login_log().Add(model.id, model.user_name, "会员登录"); //返回URL context.Response.Write("{\"status\":1, \"msg\":\"会员登录成功!\"}"); return; }
private void ShowInfo(int _id) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(_id); //绑定商品列表 this.rptList.DataSource = model.order_goods; this.rptList.DataBind(); //获得会员信息 if (model.user_id > 0) { Model.users user_info = new BLL.users().GetModel(model.user_id); if (user_info != null) { Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id); if (group_info != null) { dlUserInfo.Visible = true; lbUserName.Text = user_info.user_name; lbUserGroup.Text = group_info.title; lbUserDiscount.Text = group_info.discount.ToString() + " %"; lbUserAmount.Text = user_info.amount.ToString(); lbUserPoint.Text = user_info.point.ToString(); } } } //根据订单状态,显示各类操作按钮 switch (model.status) { case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认 if (model.payment_status > 0) { //确认付款、取消订单、修改收货按钮显示 btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else { //确认订单、取消订单、修改收货按钮显示 btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改积分总计按钮显示 btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = true; break; case 2: //如果订单为已确认状态,则进入发货状态 if (model.express_status == 1) { //确认发货、取消订单、修改收货信息按钮显示 btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else if (model.express_status == 2) { //完成订单、取消订单按钮可见 btnComplete.Visible = btnCancel.Visible = true; } //修改订单备注按钮可见 btnEditRemark.Visible = true; break; case 3: //作废订单、修改订单备注按钮可见 btnInvalid.Visible = btnEditRemark.Visible = true; break; } }
private void GroupBind(string strWhere) { BLL.user_groups bll = new BLL.user_groups(); DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); if (ds.Tables[0].Rows.Count > 0) { this.rptPrice.DataSource = ds; this.rptPrice.DataBind(); } }
private void RptBind(string _strWhere, string _orderby) { BLL.user_groups bll = new BLL.user_groups(); this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby); this.rptList.DataBind(); }
private void user_oauth_register(HttpContext context) { //检查URL参数 if (context.Session["oauth_name"] == null) { context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}"); return; } //获取授权信息 string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx"); if (result.Contains("error")) { context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}"); return; } //反序列化JSON Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result); if (dic["ret"].ToString() != "0") { context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}"); return; } string password = DTRequest.GetFormString("txtPassword").Trim(); string email = DTRequest.GetFormString("txtEmail").Trim(); string userip = DTRequest.GetIP(); //检查用户名 BLL.users bll = new BLL.users(); Model.users model = new Model.users(); //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}"); return; } //保存注册信息 model.group_id = modelGroup.id; model.user_name = bll.GetRandomName(10); model.password = DESEncrypt.Encrypt(password); model.email = email; if (!string.IsNullOrEmpty(dic["nick"].ToString())) { model.nick_name = dic["nick"].ToString(); } if (dic["avatar"].ToString().StartsWith("http://")) { model.avatar = dic["avatar"].ToString(); } if (!string.IsNullOrEmpty(dic["sex"].ToString())) { model.sex = dic["sex"].ToString(); } if (!string.IsNullOrEmpty(dic["birthday"].ToString())) { model.birthday = DateTime.Parse(dic["birthday"].ToString()); } model.reg_ip = userip; model.reg_time = DateTime.Now; model.is_lock = 0; //设置为对应状态 int newId = bll.Add(model); if (newId < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}"); return; } model = bll.GetModel(newId); //赠送积分金额 if (modelGroup.point > 0) { new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分"); } if (modelGroup.amount > 0) { new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1); } //判断是否发送站内短消息 if (userConfig.regmsgstatus == 1) { new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } //绑定到对应的授权类型 Model.user_oauth oauthModel = new Model.user_oauth(); oauthModel.oauth_name = dic["oauth_name"].ToString(); oauthModel.user_id = model.id; oauthModel.user_name = model.user_name; oauthModel.oauth_access_token = dic["oauth_access_token"].ToString(); oauthModel.oauth_openid = dic["oauth_openid"].ToString(); new BLL.user_oauth().Add(oauthModel); context.Session[DTKeys.SESSION_USER_INFO] = model; context.Session.Timeout = 45; //记住登录状态,防止Session提前过期 Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name); Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password); //写入登录日志 new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP()); //返回URL context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}"); return; }
private void ShowInfo(int _id) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(_id); //绑定商品列表 this.rptList.DataSource = model.order_goods; this.rptList.DataBind(); //获得会员信息 if (model.user_id > 0) { Model.users user_info = new BLL.users().GetModel(model.user_id); if (user_info != null) { Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id); if (group_info != null) { dlUserInfo.Visible = true; lbUserName.Text = user_info.user_name; lbUserGroup.Text = group_info.title; lbUserDiscount.Text = group_info.discount.ToString() + " %"; lbUserAmount.Text = user_info.amount.ToString(); lbUserPoint.Text = user_info.point.ToString(); } } } //根据订单状态,显示各类操作按钮 switch (model.status) { case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认 if (model.payment_status > 0) { //确认付款、取消订单、修改收货按钮显示 btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else { //确认订单、取消订单、修改收货按钮显示 btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改发票税金按钮显示 btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnEditInvoiceTaxes.Visible = true; break; case 2: //如果订单为已确认状态,则进入发货状态 if (model.express_status == 1) { //确认发货、取消订单、修改收货信息按钮显示 btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else if (model.express_status == 2) { //完成订单、取消订单按钮可见 btnComplete.Visible = btnCancel.Visible = true; } //修改订单备注按钮可见 btnEditRemark.Visible = true; break; case 3: //作废订单、修改订单备注按钮可见 btnInvalid.Visible = btnEditRemark.Visible = true; break; } //根据订单状态和物流单号跟踪物流信息 if (model.express_status == 2 && model.express_no.Trim().Length > 0) { Model.express modelt = new BLL.express().GetModel(model.express_id); Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig(); if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "") { string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder; string detail = Utils.HttpGet(@apiurl); if (detail != null) { litExpressDetail.Text = Utils.ToHtml(detail); } } } }
private void get_good_info(HttpContext context) { int good_id = DTRequest.GetQueryInt("good_id"); BLL.article bll_article = new BLL.article(); Model.article model_article = bll_article.GetModel(good_id); if (model_article == null) { context.Response.Write("NotFind"); return; } string str_header = ""; string str_body = ""; //会员组 BLL.user_groups bll_groups = new BLL.user_groups(); DataTable dt_groups = bll_groups.GetList(0, "", "grade asc,id desc").Tables[0]; string str_groups_header = ""; string str_groups_body = ""; BLL.standard_price bll_standard_price = new BLL.standard_price(); DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + good_id).Tables[0]; if (dt_standard_price != null && dt_standard_price.Rows.Count > 0) { //有规格价格 foreach (DataRow dr in dt_standard_price.Rows) { decimal sell_price = Convert.ToDecimal(model_article.fields["sell_price"]); string str_standard = ""; string str_standard_value = ""; sell_price = Convert.ToDecimal(dr["sell_price"]); if (dr["standards"] != null && !string.IsNullOrEmpty(dr["standards"].ToString())) { string[] standard_arr = dr["standards"].ToString().Split(',');//规格名 string[] standard_value_arr = dr["standard_values"].ToString().Split(',');//规格值 string[] standard_value_id_arr = dr["standard_value_ids"].ToString().Split(',');//规格值ID for (int i = 0; i < standard_arr.Length; i++) { str_standard += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + standard_arr[i] + "</td>"; if (i < standard_value_arr.Length) { str_standard_value += "<td style='padding-right: 20px;'>" + standard_value_arr[i] + "</td>"; foreach (DataRow dr_group in dt_groups.Rows) { BLL.standard_group_price bll_standard_group_price = new BLL.standard_group_price(); DataTable dt_standard_group_price = bll_standard_group_price.GetList("good_id=" + model_article.id + " and group_id=" + Convert.ToInt32(dr_group["id"]) + " and standard_price_id=" + standard_value_id_arr[i]).Tables[0]; if (dt_standard_group_price != null && dt_standard_group_price.Rows.Count > 0) { str_groups_body += "<td style='padding-right: 20px;'>" + Convert.ToDecimal(dt_standard_group_price.Rows[0]["group_price"]) + "</td>"; } } } else { str_standard_value += "<td style='padding-right: 20px;'> </td>"; } } } str_header = "<table>" + "<thead><tr>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>名称</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>售价</td>" + str_standard + str_groups_header + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>数量</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>操作</td>" + "</tr></thead>"; str_body += "<tbody><tr>" + "<td style='padding-right: 20px;'>" + model_article.title + "</td>" + "<td style='padding-right: 20px;'>" + sell_price + "</td>" + str_groups_body + str_standard_value + "<td style='padding-right: 20px;'><input type='text' class='input small' id='quantity_" + model_article.id + "_" + dr["id"].ToString() + "'></td>" + "<td style='padding-right: 20px;'><a href='javascript:;' onclick='into_meal(" + model_article.id + "," + dr["id"].ToString() + ",this)'>选择</a></td>" + "</tr></tbody>" + "<table>"; } } else { //无规格价格 if (dt_groups != null && dt_groups.Rows.Count > 0) { for (int i = 0; i < dt_groups.Rows.Count; i++) { str_groups_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt_groups.Rows[i]["title"].ToString() + "</td>"; str_groups_body += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + bll_article.GetGroupPrice(model_article.id, Convert.ToInt32(dt_groups.Rows[i]["id"])) + "</td>"; } } str_header = "<table>" + "<thead><tr>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>名称</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>售价</td>" + str_groups_header + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>数量</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>操作</td>" + "</tr></thead>"; str_body += "<tbody><tr>" + "<td style='padding-right: 20px;'>" + model_article.title + "</td>" + "<td style='padding-right: 20px;'>" + model_article.fields["sell_price"] + "</td>" + str_groups_body + "<td style='padding-right: 20px;'><input type='text' class='input small' id='quantity_" + model_article.id + "_0'></td>" + "<td style='padding-right: 20px;'><a href='javascript:;' onclick='into_meal(" + model_article.id + ",0,this)'>选择</a></td>" + "</tr></tbody>" + "<table>"; } context.Response.Write(str_header + str_body); return; }
private void user_register(HttpContext context) { string code = DTRequest.GetFormString("txtCode").Trim(); string invitecode = DTRequest.GetFormString("txtInviteCode").Trim(); string username = DTRequest.GetFormString("txtUserName").Trim(); string password = DTRequest.GetFormString("txtPassword").Trim(); string email = DTRequest.GetFormString("txtEmail").Trim(); string userip = DTRequest.GetIP(); #region 检查各项并提示 //检查是否开启会员功能 if (siteConfig.memberstatus == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,会员功能已被关闭,无法注册新会员!\"}"); return; } if (userConfig.regstatus == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统暂不允许注册新用户!\"}"); return; } //校检验证码 string result = verify_code(context, code); if (result != "success") { context.Response.Write(result); return; } //检查用户输入信息是否为空 if (username == "" || password == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"用户名和密码不能为空!\"}"); return; } if (email == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"电子邮箱不能为空!\"}"); return; } //检查用户名 BLL.users bll = new BLL.users(); Model.users model = new Model.users(); if (bll.Exists(username)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户名已经存在!\"}"); return; } //检查同一IP注册时隔 if (userConfig.regctrl > 0) { if (bll.Exists(userip, userConfig.regctrl)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,同一IP在" + userConfig.regctrl + "小时内不能注册多个用户!\"}"); return; } } //不允许同一Email注册不同用户 if (userConfig.regemailditto == 0) { if (bll.ExistsEmail(email)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"Email不允许重复注册,如果你忘记用户名,请找回密码!\"}"); return; } } //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}"); return; } //检查是否通过邀请码注册 if (userConfig.regstatus == 2) { string result1 = verify_invite_reg(username, invitecode); if (result1 != "success") { context.Response.Write(result1); return; } } #endregion //保存注册信息 model.group_id = modelGroup.id; model.user_name = username; model.password = DESEncrypt.Encrypt(password); model.email = email; model.reg_ip = userip; model.reg_time = DateTime.Now; model.is_lock = userConfig.regverify; //设置为对应状态 int newId = bll.Add(model); if (newId < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}"); return; } model = bll.GetModel(newId); //赠送积分金额 if (modelGroup.point > 0) { new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分"); } if (modelGroup.amount > 0) { new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1); } //判断是否发送站内短消息 if (userConfig.regmsgstatus == 1) { new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } //需要Email验证 if (userConfig.regverify == 1) { string result2 = verify_email(model); if (result2 != "success") { context.Response.Write(result2); return; } context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msgbox\":\"注册成功,请进入邮箱验证激活账户!\"}"); } //需要人工审核 else if (userConfig.regverify == 2) { context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msgbox\":\"注册成功,请等待审核通过!\"}"); } else { context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=succeed&username="******"\", \"msgbox\":\"恭喜您,注册成功啦!\"}"); } return; }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtLinkUrl.Text = model.link_url; //不是相册图片就绑定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("thumb_")) { txtImgUrl.Text = model.img_url; } txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtZhaiyao.Text = model.zhaiyao; txtContent.Value = model.content; txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); rblStatus.SelectedValue = model.status.ToString(); txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss"); if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_put == 1) { isPut.Items[0].Selected = false; isPut.Items[1].Selected = true; } else { isPut.Items[1].Selected = false; isPut.Items[0].Selected = true; } //扩展字段赋值 List<Model.article_attribute_field> ls1 = new BLL.article_attribute_field().GetModelList(this.channel_id, ""); foreach (Model.article_attribute_field modelt1 in ls1) { switch (modelt1.control_type) { case "single-text": //单行文本 TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox; if (txtControl != null && model.fields.ContainsKey(modelt1.name)) { if (modelt1.is_password == 1) { txtControl.Attributes.Add("value", model.fields[modelt1.name]); } else { txtControl.Text = model.fields[modelt1.name]; } } break; case "multi-text": //多行文本 goto case "single-text"; case "editor": //编辑器 HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea; if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name)) { txtAreaControl.Value = model.fields[modelt1.name]; } break; case "images": //图片上传 goto case "single-text"; case "number": //数字 goto case "single-text"; case "checkbox": //复选框 CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox; if (cbControl != null && model.fields.ContainsKey(modelt1.name)) { if (model.fields[modelt1.name] == "1") { cbControl.Checked = true; } else { cbControl.Checked = false; } } break; case "multi-radio": //多项单选 RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList; if (rblControl != null && model.fields.ContainsKey(modelt1.name)) { rblControl.SelectedValue = model.fields[modelt1.name]; } break; case "multi-checkbox": //多项多选 CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList; if (cblControl != null && model.fields.ContainsKey(modelt1.name)) { string[] valArr = model.fields[modelt1.name].Split(','); for (int i = 0; i < cblControl.Items.Count; i++) { cblControl.Items[i].Selected = false; //先取消默认的选中 foreach (string str in valArr) { if (cblControl.Items[i].Value == str) { cblControl.Items[i].Selected = true; } } } } break; } } //绑定图片相册 if (filename.StartsWith("thumb_")) { hidFocusPhoto.Value = model.img_url; //封面图片 } rptAlbumList.DataSource = model.albums; rptAlbumList.DataBind(); //绑定内容附件 rptAttachList.DataSource = model.attach; rptAttachList.DataBind(); //赋值用户组价格 if (model.group_price != null) { for (int i = 0; i < this.rptPrice.Items.Count; i++) { int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); foreach (Model.user_group_price modelt in model.group_price) { if (hideId == modelt.group_id) { ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); } } } } #region 商品相关 if (channel_name == "goods") { //规格价格 BLL.standard bll_standard = new BLL.standard(); BLL.standard_price bll_price = new BLL.standard_price(); Model.article_category model_category = new BLL.article_category().GetModel(model.category_id); string str1 = ""; if (model_category != null) { DataTable dt = bll_standard.GetList(0, "'" + model_category.class_list + "' like '%,'+convert(varchar(50),category_id)+',%'", "id asc").Tables[0]; if (dt != null) { foreach (DataRow dr in dt.Rows) { string is_checked = ""; DataTable dt_price1 = bll_price.GetList(0, "good_id=" + _id, "id asc").Tables[0]; if (dt_price1 != null && dt_price1.Rows.Count > 0) { foreach (DataRow dr1 in dt_price1.Rows) { string[] standard_ids = dr1["standard_ids"].ToString().Trim().Split(','); foreach (string str in standard_ids) { if (!string.IsNullOrEmpty(str)) { if (Convert.ToInt32(dr["id"]) == Convert.ToInt32(str)) { is_checked = " checked=\"checked\" "; } } } } } str1 += "<label><input type=\"checkbox\" value=\"" + dr["id"].ToString() + "\" name=\"ck_standard\" " + is_checked + " onclick=\"change_standard('ck_standard')\" />" + dr["title"].ToString() + "</label> "; } dd_standard_title.InnerHtml = str1; } } DataTable dt_price = bll_price.GetList(0, "good_id=" + _id, "id asc").Tables[0]; if (dt_price != null && dt_price.Rows.Count > 0) { //规格 //string str_standard = ""; //string[] str_standardid_arr = dt_price.Rows[0]["standard_ids"].ToString().Split(','); string[] str_standardtitle_arr = dt_price.Rows[0]["standards"].ToString().Split(','); //for (int i = 0; i < str_standardid_arr.Length; i++) //{ // str_standard += "<label><input type=\"checkbox\" checked=\"checked\" value=\"" + str_standardid_arr[i].ToString() + "\" name=\"ck_standard\" onclick=\"change_standard('ck_standard')\" />" + str_standardtitle_arr[i].ToString() + "</label> "; //} //dd_standard_title.InnerHtml = str_standard; //规格值 规格价格 //头部 //会员组 BLL.user_groups bll_groups = new BLL.user_groups(); DataTable dt_groups = bll_groups.GetList(0, "", "grade asc,id desc").Tables[0]; string str_groups_header = ""; if (dt_groups != null && dt_groups.Rows.Count > 0) { for (int i = 0; i < dt_groups.Rows.Count; i++) { str_groups_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt_groups.Rows[i]["title"].ToString() + "</td>"; } } string rest_header = ""; rest_header += "<tr><td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>商品编号</td>"; for (int i = 0; i < str_standardtitle_arr.Length; i++) { rest_header += "<td style='font-weight:bold;color:#33B5E5; padding-right:10px;'>" + str_standardtitle_arr[i] + "</td>"; } rest_header += "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>库存</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>市场价</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>销售价</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>活动价</td>" + str_groups_header + "</tr>"; string rest_body = ""; foreach (DataRow dr in dt_price.Rows) { string[] str_arr_value = dr["standard_values"].ToString().Split(','); rest_body += "<tr><td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;width: 100px;' type='text' class='input normal small' name='good_no_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["good_no"].ToString() + "'/></td>"; foreach (string str in str_arr_value) { rest_body += "<td style='padding-right: 20px;'>" + str + "</td>"; } rest_body += "<td style='padding-right: 20px;'><input type='checkbox' value='" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' name='ck_standard_value' checked='checked' style='display:none;'/>"; rest_body += "<input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='stock_quantity_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["stock_quantity"].ToString() + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='market_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["market_price"].ToString() + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='sell_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["sell_price"].ToString() + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='action_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["action_price"].ToString() + "'/></td>"; for (int i = 0; i < dt_groups.Rows.Count; i++) { BLL.standard_group_price bll_standard_group_price = new BLL.standard_group_price(); Model.standard_group_price model_standard_group_price = bll_standard_group_price.GetModel(_id, Convert.ToInt32(dt_groups.Rows[i]["id"]), Convert.ToDecimal(dr["id"])); if (model_standard_group_price != null) { rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='user_price_" + dt_groups.Rows[i]["id"].ToString() + "_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + model_standard_group_price.group_price + "'/></td>"; } else { foreach (Model.user_group_price modelt in model.group_price) { if (Convert.ToInt32(dt_groups.Rows[i]["id"]) == modelt.group_id) { rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='user_price_" + dt_groups.Rows[i]["id"].ToString() + "_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + modelt.price + "'/></td>"; } } } } rest_body += "</tr>"; } dd_standard_value.InnerHtml = "<table>" + rest_header + rest_body + "</table>"; } //单位 BLL.unit bll_unit = new BLL.unit(); DataTable dt_unit = bll_unit.GetList("good_id=" + _id).Tables[0]; string str_unit = ""; if (dt_unit != null && dt_unit.Rows.Count > 0) { foreach (DataRow dr in dt_unit.Rows) { string unit = dr["title"].ToString() + "_" + Convert.ToInt32(dr["quantity"]) + "_" + Convert.ToDecimal(dr["rate"]) + "_" + dr["content"].ToString(); str_unit += "<tr>"; str_unit += "<td style='padding-right: 20px;'>" + dr["title"].ToString() + "<input type=\"checkbox\" name=\"ck_unit\" value=\"" + unit + "\" checked=\"checked\" style=\"display:none;\">" + "</td>"; str_unit += "<td style='padding-right: 20px;'>" + Convert.ToInt32(dr["quantity"]) + "</td>"; str_unit += "<td style='padding-right: 20px;'>" + Convert.ToDecimal(dr["rate"]) + "</td>"; str_unit += "<td style='padding-right: 20px;'>" + dr["content"].ToString() + "</td>"; str_unit += "<td style='padding-right: 20px;'><a href=\"javascript:;\" onclick=\"del_unit(this)\">删除</a></td>"; str_unit += "</tr>"; } } tb_unit_value.InnerHtml = str_unit; //别名 BLL.alias bll_alias = new BLL.alias(); DataTable dt_alias = bll_alias.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0]; if (dt_alias != null && dt_alias.Rows.Count > 0) { foreach (DataRow dr in dt_alias.Rows) { ck_alias.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString())); } } BLL.alias_good bll_alias_good = new BLL.alias_good(); for (int i = 0; i < ck_alias.Items.Count; i++) { DataTable dt_have = bll_alias_good.GetList("alias_id=" + ck_alias.Items[i].Value + " and good_id=" + _id).Tables[0]; if (dt_have != null && dt_have.Rows.Count > 0) { ck_alias.Items[i].Selected = true; } } //属性 BLL.property bll_property = new BLL.property(); DataTable dt_property = bll_property.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0]; string str_result = ""; foreach (DataRow dr in dt_property.Rows) { str_result += "<dl>"; str_result += "<dt>" + dr["title"].ToString() + ":</dt>"; BLL.property_value bll_value = new BLL.property_value(); DataTable dt_property_value = bll_value.GetList("property_id=" + dr["id"].ToString()).Tables[0]; str_result += "<dd>"; if (dt_property_value != null && dt_property_value.Rows.Count > 0) { foreach (DataRow dr1 in dt_property_value.Rows) { BLL.property_good bll_property_good = new BLL.property_good(); DataTable dt_property_good = bll_property_good.GetList("good_id=" + model.id + " and property_value_id=" + dr1["id"].ToString()).Tables[0]; if (dt_property_good != null && dt_property_good.Rows.Count > 0) { str_result += "<label><input type=\"checkbox\" name=\"ck_property_value\" checked=\"checked\" value=\"" + dr1["id"].ToString() + "\" />" + dr1["value"].ToString() + "</label> "; } else { str_result += "<label><input type=\"checkbox\" name=\"ck_property_value\" value=\"" + dr1["id"].ToString() + "\" />" + dr1["value"].ToString() + "</label> "; } } } str_result += "</dd>"; str_result += "</dl>"; } div_property.InnerHtml = str_result; //标签 BLL.tag bll_tag = new BLL.tag(); DataTable dt_tag = bll_tag.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0]; if (dt_tag != null && dt_tag.Rows.Count > 0) { foreach (DataRow dr in dt_tag.Rows) { ck_tag.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString())); } } BLL.tag_good bll_tag_good = new BLL.tag_good(); for (int i = 0; i < ck_tag.Items.Count; i++) { DataTable dt_have = bll_tag_good.GetList("tag_id=" + ck_tag.Items[i].Value + " and good_id=" + _id).Tables[0]; if (dt_have != null && dt_have.Rows.Count > 0) { ck_tag.Items[i].Selected = true; } } } #endregion }
private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); decimal sell_price = 0; decimal standard_price = 0; decimal standard_group_price = 0; decimal action_price = 0; model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_put = 1; if (isPut.Items[0].Selected) { model.is_put = 0; } if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.channel_id); //扩展字段赋值 sell_price = Convert.ToDecimal(model.fields["sell_price"]); #region 保存相册==================== //检查是否有自定义图片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List<Model.article_albums> ls = new List<Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存附件==================== if (model.attach != null) { model.attach.Clear(); } string[] attachIdArr = Request.Form.GetValues("hid_attach_id"); string[] attachFileNameArr = Request.Form.GetValues("hid_attach_filename"); string[] attachFilePathArr = Request.Form.GetValues("hid_attach_filepath"); string[] attachFileSizeArr = Request.Form.GetValues("hid_attach_filesize"); string[] attachPointArr = Request.Form.GetValues("txt_attach_point"); if (attachIdArr != null && attachFileNameArr != null && attachFilePathArr != null && attachFileSizeArr != null && attachPointArr != null && attachIdArr.Length > 0 && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0 && attachPointArr.Length > 0) { List<Model.article_attach> ls = new List<Model.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int attachId = Utils.StrToInt(attachIdArr[i], 0); int fileSize = Utils.StrToInt(attachFileSizeArr[i], 0); string fileExt = Utils.GetFileExt(attachFilePathArr[i]); int _point = Utils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.article_attach { id = attachId, article_id = _id, file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, point = _point, }); } model.attach = ls; } #endregion #region 保存会员组价格============== List<Model.user_group_price> priceList = new List<Model.user_group_price>(); for (int i = 0; i < rptPrice.Items.Count; i++) { int hidPriceId = 0; if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) { hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); } int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); priceList.Add(new Model.user_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); } model.group_price = priceList; #endregion if (bll.Update(model)) { #region 商品相关 if (channel_name == "goods") { //规格价格 BLL.standard_price bll_price = new BLL.standard_price(); DataTable dt = bll_price.GetList(0, "good_id=" + _id, "id asc").Tables[0]; if (dt != null && dt.Rows.Count > 0) { if (!bll_price.Delete("good_id=" + _id)) { JscriptMsg("价格信息清除失败!", "", "Error"); return false; } } string standard_ids = DTRequest.GetFormString("ck_standard"); string standard_value_ids = DTRequest.GetFormString("ck_standard_value"); string str_standards = ""; BLL.standard bll_standard = new BLL.standard(); string[] str_standard_arr = standard_ids.Split(','); foreach (string str in str_standard_arr) { if (!string.IsNullOrEmpty(str)) { Model.standard model_standard = bll_standard.GetModel(Convert.ToInt32(str)); if (model_standard != null) { str_standards += model_standard.title + ","; } } } BLL.standard_value bll_value = new BLL.standard_value(); string[] str_standard_value_arr = standard_value_ids.Split(','); BLL.standard_group_price bll_standard_group_price = new BLL.standard_group_price(); DataTable dt_standard_group_price = bll_standard_group_price.GetList("good_id=" + _id).Tables[0]; if (dt_standard_group_price != null && dt_standard_group_price.Rows.Count > 0) { if (!bll_standard_group_price.Delete(_id)) { JscriptMsg("清除商品规格会员价格失败!", "", "Error"); return false; } } foreach (string str in str_standard_value_arr) { if (!string.IsNullOrEmpty(str)) { string str_title = ""; string[] str_arr = str.Split('_'); foreach (string s in str_arr) { if (!string.IsNullOrEmpty(s)) { Model.standard_value model_value = bll_value.GetModel(Convert.ToInt32(s)); if (model_value != null) { str_title += model_value.value + ","; } } } Model.standard_price model_price = new Model.standard_price(); model_price.good_id = _id; model_price.standard_ids = standard_ids; model_price.good_no = DTRequest.GetFormString("good_no_" + str); model_price.standards = str_standards.Substring(0, str_standards.Length - 1); model_price.standard_value_ids = str.Replace('_', ','); model_price.standard_values = str_title.Substring(0, str_title.Length - 1); model_price.stock_quantity = DTRequest.GetFormInt("stock_quantity_" + str, 0); model_price.market_price = DTRequest.GetFormDecimal("market_price_" + str, 0); model_price.sell_price=sell_price=standard_price = DTRequest.GetFormDecimal("sell_price_" + str, 0); model_price.action_price=action_price = DTRequest.GetFormDecimal("action_price_" + str, 0); model_price.user_price = DTRequest.GetFormDecimal("user_price_" + str, 0); model_price.add_time = DateTime.Now; decimal _standard_price_id = bll_price.Add(model_price); if (_standard_price_id <= 0) { JscriptMsg("更新价格信息失败!", "", "Error"); return false; } //规格会员组价格 BLL.user_groups bll_user_group = new BLL.user_groups(); DataTable dt_user_group = bll_user_group.GetList(0, "", "grade asc,id desc").Tables[0]; foreach (DataRow dr_user_group in dt_user_group.Rows) { Model.standard_group_price model_standard_group_price = new Model.standard_group_price(); model_standard_group_price.good_id = _id; model_standard_group_price.group_id = Convert.ToInt32(dr_user_group["id"]); model_standard_group_price.standard_price_id = _standard_price_id; model_standard_group_price.group_price=standard_group_price = DTRequest.GetFormDecimal("user_price_" + dr_user_group["id"] + "_" + str, 0); model_standard_group_price.add_time = DateTime.Now; if (bll_standard_group_price.Add(model_standard_group_price) <= 0) { JscriptMsg("规格会员价格更新失败!", "", "Error"); return false; } } } } //BLL.meal_good bll_meal_good = new BLL.meal_good(); //if (!bll_meal_good.UpdateMealGoodPrice(_id, sell_price, standard_price, standard_group_price, action_price)) //{ // JscriptMsg("套餐商品价格更新失败!", "", "Error"); // return false; //} //单位 BLL.unit bll_unit = new BLL.unit(); bll_unit.Delete(_id); string str_unit = DTRequest.GetFormString("ck_unit"); if (!string.IsNullOrEmpty(str_unit)) { string[] arr_unit = str_unit.Split(','); foreach (string s_unit in arr_unit) { if (!string.IsNullOrEmpty(s_unit)) { string[] unit = s_unit.Split('_'); Model.unit model_unit = new Model.unit(); model_unit.good_id = _id; model_unit.title = unit[0]; model_unit.quantity = Convert.ToInt32(unit[1]); model_unit.rate = Convert.ToDecimal(unit[2]); model_unit.content = unit[3]; model_unit.add_time = DateTime.Now; if (bll_unit.Add(model_unit) <= 0) { JscriptMsg("更新单位失败!", "", "Error"); return false; } } } } //别名 BLL.alias_good bll_alias_good = new BLL.alias_good(); //删除 bll_alias_good.Delete(_id); for (int i = 0; i < ck_alias.Items.Count; i++) { if (ck_alias.Items[i].Selected) { Model.alias_good model_alias_good = new Model.alias_good(); model_alias_good.alias_id = Convert.ToInt32(ck_alias.Items[i].Value); model_alias_good.good_id = _id; bll_alias_good.Add(model_alias_good); } } //属性 BLL.property_value bll_property_value = new BLL.property_value(); BLL.property_good bll_property_good = new BLL.property_good(); bll_property_good.Delete(_id); string str_property_value = DTRequest.GetFormString("ck_property_value"); if (!string.IsNullOrEmpty(str_property_value)) { string[] arr_property_value = str_property_value.Split(','); foreach (string str_1 in arr_property_value) { Model.property_good model_property_good = new Model.property_good(); model_property_good.good_id = _id; model_property_good.property_value_id = Convert.ToInt32(str_1); Model.property_value model_property_value = bll_property_value.GetModel(Convert.ToInt32(str_1)); if (model_property_value != null) { model_property_good.property_id = model_property_value.property_id; } bll_property_good.Add(model_property_good); } } //标签 BLL.tag_good bll_tag_good = new BLL.tag_good(); bll_tag_good.Delete(_id); for (int i = 0; i < ck_tag.Items.Count; i++) { if (ck_tag.Items[i].Selected) { Model.tag_good model_tag_good = new Model.tag_good(); model_tag_good.tag_id = Convert.ToInt32(ck_tag.Items[i].Value); model_tag_good.good_id = _id; bll_tag_good.Add(model_tag_good); } } } #endregion AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); //记录日志 result = true; } return result; }
private void user_oauth_register(HttpContext context) { //检查URL参数 if (context.Session["oauth_name"] == null) { context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:授权参数不正确!\"}"); return; } //获取授权信息 string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx"); if (result.Contains("error")) { context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:请检查URL是否正确!\"}"); return; } string password = DTRequest.GetFormString("txtPassword").Trim(); string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim()); string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim()); string userip = DTRequest.GetIP(); //反序列化JSON Dictionary<string, object> dic = JsonHelper.DataRowFromJSON(result); if (dic["ret"].ToString() != "0") { context.Response.Write("{\"status\": 0, \"msg\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}"); return; } BLL.users bll = new BLL.users(); Model.users model = new Model.users(); //如果开启手机登录要验证手机 if (userConfig.mobilelogin == 1 && !string.IsNullOrEmpty(mobile)) { if (bll.ExistsMobile(mobile)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被使用!\"}"); return; } } //如果开启邮箱登录要验证邮箱 if (userConfig.emaillogin == 1 && !string.IsNullOrEmpty(email)) { if (bll.ExistsEmail(email)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该电子邮箱已被使用!\"}"); return; } } //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系管理员!\"}"); return; } //保存注册信息 model.group_id = modelGroup.id; model.user_name = bll.GetRandomName(10); //随机用户名 model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串 model.password = DESEncrypt.Encrypt(password, model.salt); model.email = email; model.mobile = mobile; if (!string.IsNullOrEmpty(dic["nick"].ToString())) { model.nick_name = dic["nick"].ToString(); } if (dic["avatar"].ToString().StartsWith("http://")) { model.avatar = dic["avatar"].ToString(); } if (!string.IsNullOrEmpty(dic["sex"].ToString())) { model.sex = dic["sex"].ToString(); } if (!string.IsNullOrEmpty(dic["birthday"].ToString())) { model.birthday = Utils.StrToDateTime(dic["birthday"].ToString()); } model.reg_ip = userip; model.reg_time = DateTime.Now; model.status = 0; //设置为正常状态 model.id = bll.Add(model); //保存数据 if (model.id < 1) { context.Response.Write("{\"status\":0, \"msg\":\"注册失败,请联系网站管理员!\"}"); return; } //赠送积分金额 if (modelGroup.point > 0) { new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false); } if (modelGroup.amount > 0) { new BLL.user_amount_log().Add(model.id, model.user_name, modelGroup.amount, "注册赠送金额"); } //判断是否发送欢迎消息 if (userConfig.regmsgstatus == 1) //站内短消息 { new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } else if (userConfig.regmsgstatus == 2) //发送邮件 { //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg"); if (mailModel != null) { //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); //发送邮件 DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, model.email, mailTitle, mailContent); } } else if (userConfig.regmsgstatus == 3 && mobile != "") //发送短信 { Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容 if (smsModel != null) { //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{weburl}", siteConfig.weburl); msgContent = msgContent.Replace("{webtel}", siteConfig.webtel); msgContent = msgContent.Replace("{username}", model.user_name); //发送短信 string tipMsg = string.Empty; new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); } } //绑定到对应的授权类型 Model.user_oauth oauthModel = new Model.user_oauth(); oauthModel.oauth_name = dic["oauth_name"].ToString(); oauthModel.user_id = model.id; oauthModel.user_name = model.user_name; oauthModel.oauth_access_token = dic["oauth_access_token"].ToString(); oauthModel.oauth_openid = dic["oauth_openid"].ToString(); new BLL.user_oauth().Add(oauthModel); context.Session[DTKeys.SESSION_USER_INFO] = model; context.Session.Timeout = 45; //记住登录状态,防止Session提前过期 Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name); Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password); //写入登录日志 new BLL.user_login_log().Add(model.id, model.user_name, "会员登录"); //返回URL context.Response.Write("{\"status\":1, \"msg\":\"会员登录成功!\"}"); return; }
private void user_register(HttpContext context) { string site = DTRequest.GetQueryString("site").Trim(); //当前站点 string code = DTRequest.GetFormString("txtCode").Trim(); string username = Utils.ToHtml(DTRequest.GetFormString("txtUserName").Trim()); string password = DTRequest.GetFormString("txtPassword").Trim(); string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim()); string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim()); string userip = DTRequest.GetIP(); #region 验证各种参数信息 //检查站点目录是否正确 if (string.IsNullOrEmpty(site)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}"); return; } //检查是否开启会员功能 if (siteConfig.memberstatus == 0) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,会员功能已关闭,无法注册!\"}"); return; } if (userConfig.regstatus == 0) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,系统暂不允许注册新用户!\"}"); return; } //检查用户输入信息是否为空 if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户名和密码不能为空!\"}"); return; } //如果开启手机注册则要验证手机 if (userConfig.regstatus == 2 && string.IsNullOrEmpty(mobile)) { context.Response.Write("{\"status\":0, \"msg\":\"错误:手机号码不能为空!\"}"); return; } //如果开启邮箱注册则要验证邮箱 if (userConfig.regstatus == 3 && string.IsNullOrEmpty(email)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,电子邮箱不能为空!\"}"); return; } //检查用户名 BLL.users bll = new BLL.users(); if (bll.Exists(username)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户名已经存在!\"}"); return; } //如果开启手机登录要验证手机 if (userConfig.mobilelogin == 1 && !string.IsNullOrEmpty(mobile)) { if (bll.ExistsMobile(mobile)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被使用!\"}"); return; } } //如果开启邮箱登录要验证邮箱 if (userConfig.emaillogin == 1 && !string.IsNullOrEmpty(email)) { if (bll.ExistsEmail(email)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,该电子邮箱已被使用!\"}"); return; } } //检查同一IP注册时隔 if (userConfig.regctrl > 0) { if (bll.Exists(userip, userConfig.regctrl)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,同IP在" + userConfig.regctrl + "小时内禁止重复注册!\"}"); return; } } //检查默认组别是否存在 Model.user_groups modelGroup = new BLL.user_groups().GetDefault(); if (modelGroup == null) { context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系网站管理员!\"}"); return; } //检查验证码是否正确 switch (userConfig.regstatus) { case 1: //验证网页验证码 string result1 = verify_code(context, code); if (result1 != "success") { context.Response.Write(result1); return; } break; case 2: //验证手机验证码 string result2 = verify_sms_code(context, code); if (result2 != "success") { context.Response.Write(result2); return; } break; case 4: //验证邀请码 string result4 = verify_invite_reg(username, code); if (result4 != "success") { context.Response.Write(result4); return; } break; } #endregion #region 保存用户注册信息 Model.users model = new Model.users(); model.group_id = modelGroup.id; model.user_name = username; model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串 model.password = DESEncrypt.Encrypt(password, model.salt); model.email = email; model.mobile = mobile; model.reg_ip = userip; model.reg_time = DateTime.Now; //设置用户状态 if (userConfig.regstatus == 3) { model.status = 1; //待验证 } else if (userConfig.regverify == 1) { model.status = 2; //待审核 } else { model.status = 0; //正常 } //开始写入数据库 model.id = bll.Add(model); if (model.id < 1) { context.Response.Write("{\"status\":0, \"msg\":\"系统故障,请联系网站管理员!\"}"); return; } //检查用户组是否需要赠送积分 if (modelGroup.point > 0) { new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false); } //检查用户组是否需要赠送金额 if (modelGroup.amount > 0) { new BLL.user_amount_log().Add(model.id, model.user_name, modelGroup.amount, "注册赠送金额"); } #endregion #region 是否发送欢迎消息 if (userConfig.regmsgstatus == 1) //站内短消息 { new BLL.user_message().Add(1, string.Empty, model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt); } else if (userConfig.regmsgstatus == 2 && !string.IsNullOrEmpty(email)) //发送邮件 { //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg"); if (mailModel != null) { //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); //发送邮件 DTMail.sendMail(siteConfig.emailsmtp,siteConfig.emailssl, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, model.email, mailTitle, mailContent); } } else if (userConfig.regmsgstatus == 3 && !string.IsNullOrEmpty(mobile)) //发送短信 { Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容 if (smsModel != null) { //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{weburl}", siteConfig.weburl); msgContent = msgContent.Replace("{webtel}", siteConfig.webtel); msgContent = msgContent.Replace("{username}", model.user_name); //发送短信 string tipMsg = string.Empty; new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); } } #endregion //需要Email验证 if (userConfig.regstatus == 3) { string result2 = send_verify_email(site, model); //发送验证邮件 if (result2 != "success") { context.Response.Write(result2); return; } context.Response.Write("{\"status\":1, \"msg\":\"注册成功,请进入邮箱验证激活账户!\", \"url\":\"" + new Web.UI.BasePage().getlink(site, new Web.UI.BasePage().linkurl("register", "?action=sendmail&username="******"\"}"); } //需要人工审核 else if (userConfig.regverify == 1) { context.Response.Write("{\"status\":1, \"msg\":\"注册成功,请等待审核通过!\", \"url\":\"" + new Web.UI.BasePage().getlink(site, new Web.UI.BasePage().linkurl("register", "?action=verify&username="******"\"}"); } else { context.Session[DTKeys.SESSION_USER_INFO] = model; context.Session.Timeout = 45; //防止Session提前过期 Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name); Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password); //写入登录日志 new BLL.user_login_log().Add(model.id, model.user_name, "会员登录"); context.Response.Write("{\"status\":1, \"msg\":\"注册成功,欢迎成为本站会员!\", \"url\":\"" + new Web.UI.BasePage().getlink(site, new Web.UI.BasePage().linkurl("usercenter", "index")) + "\"}"); } return; }
/// <summary> /// 转换成List /// </summary> public static List<Model.cart_items> ToList(List<Model.cart_keys> ls, int group_id) { if (ls != null) { List<Model.cart_items> iList = new List<Model.cart_items>(); foreach (Model.cart_keys item in ls) { //查询文章的信息 Model.article articleModel = new BLL.article().GetModel(item.article_id); if (articleModel == null || !articleModel.fields.ContainsKey("sell_price")) { continue; } //查询商品信息 Model.article_goods goodsModel = articleModel.goods.Find(p => p.id == item.goods_id); if (articleModel.goods != null && articleModel.goods.Count > 0 && goodsModel == null) { continue; } //开始赋值 Model.cart_items modelt = new Model.cart_items(); modelt.article_id = articleModel.id; if (articleModel.fields.ContainsKey("goods_no")) { modelt.goods_no = articleModel.fields["goods_no"]; } modelt.title = articleModel.title; modelt.img_url = articleModel.img_url; modelt.sell_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); modelt.user_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); if (articleModel.fields.ContainsKey("point")) { modelt.point = Utils.StrToInt(articleModel.fields["point"], 0); } if (articleModel.fields.ContainsKey("stock_quantity")) { modelt.stock_quantity = Utils.StrToInt(articleModel.fields["stock_quantity"], 0); } bool setStatus = false; //会员组价格赋值状态 if (goodsModel != null) { modelt.stock_quantity = goodsModel.stock_quantity; //库存 modelt.sell_price = goodsModel.sell_price; //商品价格 modelt.user_price = goodsModel.sell_price; //会员组价格 modelt.goods_id = goodsModel.id; modelt.goods_no = goodsModel.goods_no; modelt.spec_text = goodsModel.spec_text; //会员组价格 if (group_id > 0 && goodsModel.group_prices != null) { Model.user_group_price userPriceModel = goodsModel.group_prices.Find(p => p.group_id == group_id); if (userPriceModel != null) { setStatus = true; //已赋值 modelt.user_price = userPriceModel.price; } } } //如果未曾有会员组价格则使用折扣价格 if (group_id > 0 && !setStatus) { int discount = new BLL.user_groups().GetDiscount(group_id); if (discount > 0) { modelt.user_price = modelt.sell_price * discount / 100; } } modelt.quantity = item.quantity; //添加入列表 iList.Add(modelt); } return iList; } return null; }
private void change_standard(HttpContext context) { string standard_ids = DTRequest.GetQueryString("standard_ids"); int quntity = DTRequest.GetQueryInt("quntity"); decimal market_price = DTRequest.GetQueryDecimal("market_price", 0); decimal sell_price = DTRequest.GetQueryDecimal("sell_price", 0); string groups_price = DTRequest.GetQueryString("groups_price"); BLL.standard bll = new BLL.standard(); BLL.standard_price bll_standard_price = new BLL.standard_price(); string rest_header = ""; string rest_body = ""; string strSql = ""; string strorder = ""; //会员组 BLL.user_groups bll_groups = new BLL.user_groups(); DataTable dt_groups = bll_groups.GetList(0, "", "grade asc,id desc").Tables[0]; string str_groups_header = ""; if (dt_groups != null && dt_groups.Rows.Count > 0) { for (int i = 0; i < dt_groups.Rows.Count; i++) { str_groups_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt_groups.Rows[i]["title"].ToString() + "</td>"; } } string[] arr_group_price = groups_price.Split(',');//前台会员等级价格 //表头部分 DataTable dt = bll.GetList(0, "id in (" + standard_ids + ")", "id asc").Tables[0]; if (dt != null && dt.Rows.Count > 0) { rest_header += "<tr><td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>商品编号</td>"; for (int i = 0; i < dt.Rows.Count; i++) { rest_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt.Rows[i]["title"].ToString() + "</td>"; //规格值列表 strSql += "(select id as id_" + dt.Rows[i]["id"].ToString() + ",value as value_" + dt.Rows[i]["id"].ToString() + " from td_standard_value where standard_id=" + dt.Rows[i]["id"].ToString() + ") as t_" + dt.Rows[i]["id"].ToString() + ","; if (i == 0) { strorder = "id_" + dt.Rows[i]["id"].ToString() + " asc"; } } rest_header += "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>库存</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>市场价</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>销售价</td>" + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>活动价</td>" + str_groups_header + "</tr>"; DataTable dt_price = bll_standard_price.get_dcer_list(strSql.Substring(0, strSql.Length - 1), strorder).Tables[0]; rest_body += "<tr>"; foreach (DataRow dr in dt_price.Rows) { string str = ""; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;width: 100px;' type='text' class='input normal small' name='good_no_" + str.Substring(0, str.Length - 1) + "' value=''/></td>"; for (int i = 0; i < dr.ItemArray.Length; i += 2) { rest_body += "<td style='padding-right: 20px;'>" + dr[i + 1].ToString() + "</td>"; str += dr[i].ToString() + "_"; } rest_body += "<td style='padding-right: 20px;'><input type='checkbox' value='" + str.Substring(0, str.Length - 1) + "' name='ck_standard_value' checked='checked' style='display:none;'/>"; rest_body += "<input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='stock_quantity_" + str.Substring(0, str.Length - 1) + "' value='" + quntity + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='market_price_" + str.Substring(0, str.Length - 1) + "' value='" + market_price + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='sell_price_" + str.Substring(0, str.Length - 1) + "' value='" + sell_price + "'/></td>"; rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='action_price_" + str.Substring(0, str.Length - 1) + "' value='" + sell_price + "'/></td>"; for (int j = 0; j < dt_groups.Rows.Count; j++) { if (j < arr_group_price.Length) { //会员价格文本框NAME=user_price_用户组id_规格值 rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='user_price_" + dt_groups.Rows[j]["id"].ToString() + "_" + str.Substring(0, str.Length - 1) + "' value='" + arr_group_price[j] + "'/></td>"; } } rest_body += "</tr>"; } } context.Response.Write("{\"status\":\"y\",\"info\":\"" + "<table>" + rest_header + rest_body + "</table>" + "\"}"); return; ////DataTable dt = bll.GetList("standard_id=" + item.Value).Tables[0]; ////dt.TableName = "dt_" + item.Value; //strSql += "(select id as id_" + item.Value + ",value as value_" + item.Value + " from td_standard_value where standard_id=" + item.Value + ") as t_" + item.Value + ","; //if (sel_count == 0) //{ // strorder = "id_" + item.Value+" asc"; //} }
private void get_article_goods_info(HttpContext context) { int article_id = DTRequest.GetInt("article_id", 0); string spec_ids = DTRequest.GetString("ids"); if (article_id == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,传输参数不正确!\"}"); return; } if (string.IsNullOrEmpty(spec_ids)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,传输参数不正确!\"}"); return; } //查询商品信息 Model.article_goods goodsModel = new BLL.article_goods().GetModel(article_id, spec_ids); if (goodsModel == null) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,暂无查到商品信息!\"}"); return; } //查询是否登录,有则查询会员价格 Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel != null) { //查询会员组价格 Model.user_group_price userPriceModel = new BLL.user_group_price().GetModel(goodsModel.id, userModel.group_id); if (userPriceModel != null) { goodsModel.sell_price = userPriceModel.price; } else { //查询会员组折扣 Model.user_groups groupModel = new BLL.user_groups().GetModel(userModel.group_id); if (groupModel != null) { goodsModel.sell_price = goodsModel.sell_price * groupModel.discount / 100; } } } //以JSON格式输出商品信息 context.Response.Write("{\"status\": \"1\", \"id\": \"" + goodsModel.id + "\", \"article_id\": \"" + goodsModel.article_id + "\", \"goods_id\": \"" + goodsModel.id + "\", \"goods_no\": \"" + goodsModel.goods_no + "\", \"spec_ids\": \"" + goodsModel.spec_ids + "\", \"spec_text\": \"" + goodsModel.spec_text + "\", \"stock_quantity\": \"" + goodsModel.stock_quantity + "\", \"market_price\": \"" + goodsModel.market_price + "\", \"sell_price\": \"" + goodsModel.sell_price + "\"}"); }
private void ShowInfo(int _id) { BLL.orders bll = new BLL.orders(); model = bll.GetModel(_id); DataTable dt = bll.GetOrderList(0, " t1.order_no='" + _id + "'", " t1.id desc").Tables[0]; var refund_status = 0; if (dt.Rows[0]["refund_status"].ToString() != "" && dt.Rows[0]["refund_status"].ToString() != null) { refund_status = int.Parse(dt.Rows[0]["refund_status"].ToString()); } //绑定商品列表 this.rptList.DataSource = model.order_goods; this.rptList.DataBind(); //获得会员信息 if (model.user_id > 0) { Model.users user_info = new BLL.users().GetModel(model.user_id); if (user_info != null) { Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id); if (group_info != null) { dlUserInfo.Visible = true; lbUserName.Text = user_info.user_name; lbUserGroup.Text = group_info.title; lbUserDiscount.Text = group_info.discount.ToString() + " %"; lbUserAmount.Text = user_info.amount.ToString(); lbUserPoint.Text = user_info.point.ToString(); } } } //根据订单状态,显示各类操作按钮 switch (int.Parse(dt.Rows[0]["status"].ToString())) { case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认 if (int.Parse(dt.Rows[0]["payment_status"].ToString()) == 1) { //作废订单、修改商品总金额、修改配送费用、修改支付手续费、修改积分总计按钮、确认付款、取消订单 btnInvalid.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnPayment.Visible = btnEditRealAmount.Visible = btnCancel.Visible = true; } //作废订单、修改订单备注、取消订单、修改收货按钮显示显示 btnInvalid.Visible = btnEditRemark.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; break; case 2: //如果是DIY待确认状态 if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 0) { //作废订单、确认发货、修改订单备注按钮显示 btnInvalid.Visible = btnExpress.Visible = btnEditRemark.Visible = true; } else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 1) { //作废订单可见 btnInvalid.Visible = true; } else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 2) { //作废订单可见 btnInvalid.Visible = true; } else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 3) { //作废订单可见 btnInvalid.Visible = true; } else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 4) { //作废订单可见 btnInvalid.Visible = true; } else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 5) { //作废订单、确认发货、修改订单备注按钮显示 btnInvalid.Visible = btnExpress.Visible = btnEditRemark.Visible = true; } else if (model.express_status == 2) { //作废订单、完成订单可见 btnInvalid.Visible = btnComplete.Visible = true; } break; } }