public bool DeleteCustomer(DataSet ds, string authKey) { bool ret = false; if (authKey == key) { if (ds != null && ds.Tables.Count > 0) { SOSOshop.BLL.MemberAccount ma = new SOSOshop.BLL.MemberAccount(); SOSOshop.BLL.DrugsBase_Enterprise debll = new SOSOshop.BLL.DrugsBase_Enterprise(); SOSOshop.BLL.MemberInfo mibll = new SOSOshop.BLL.MemberInfo(); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { object uid = mibll.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'"); if (uid != null) { mibll.Delete((int)uid); } } ret = true; } } return(ret); }
/// <summary> /// 添加会员信息 /// </summary> /// <param name="dr"></param> private void addMemberinfo(DataRow dr) { if (dr != null) { SOSOshop.Model.MemberInfo mi = new SOSOshop.Model.MemberInfo(); SOSOshop.BLL.MemberInfo mibll = new SOSOshop.BLL.MemberInfo(); SOSOshop.BLL.MemberPermission mpbll = new SOSOshop.BLL.MemberPermission(); SOSOshop.Model.MemberPermission mp = new SOSOshop.Model.MemberPermission(); object UID = mibll.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'"); if (!mibll.Exists((int)UID)) { mi.Address = dr["地址"].ToString(); mi.Code = dr["会员编号"].ToString(); mi.discount = 1; mi.Member_Type = 1; object r = mibll.ExecuteScalar("select ID from DrugsBase_Enterprise where name='" + dr["公司名称"].ToString() + "'"); mi.ParentId = (int)r; mi.TrueName = dr["联系人名"].ToString(); mi.UID = (int)UID; mi.PriceCategory = dr["价格类型"] as string; mibll.Add(mi); mp.UID = mi.UID; mp.IsMoneyAndShipping = true; mi.Province = GetRegionId(dr["省"].ToString()); mi.City = GetRegionId(dr["市"].ToString()); mi.Borough = GetRegionId(dr["区"].ToString()); mpbll.Add(mp); } else { modifyMemberinfo(dr); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SOSOshop.Model.MemberAccount a = null; int uid = 0; int.TryParse(Request["UID"], out uid); if (uid > 0) { SOSOshop.BLL.MemberAccount bll = new SOSOshop.BLL.MemberAccount(); SOSOshop.Model.MemberInfo model = new SOSOshop.BLL.MemberInfo().GetModel(uid); object obj = bll.ExecuteScalar("select top(1) Name from DrugsBase_Enterprise where ID=" + model.ParentId); a = bll.GetModel(uid); hfmobilePhone.Value = a.MobilePhone; hftrueName.Value = model.TrueName; hfdefaultIncName.Value = obj != null?obj.ToString() : "未设置"; hfmember_Class.Value = "无"; if (model.Member_Class >= 0) { hfmember_Class.Value = Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.Member_Class), model.Member_Class); } #region 实例化省市区联动 DataSet dsProvinces = bll.ExecuteDataSet("select isnull((select TOP(1) Name from Region where ID=" + model.Province + "),'') as a,isnull((select TOP(1) Name from Region where ID=" + model.City + "),'') as b,isnull((select TOP(1) Name from Region where ID=" + model.Borough + "),'') as c"); if (dsProvinces != null && dsProvinces.Tables.Count > 0 && dsProvinces.Tables[0].Rows.Count > 0) { hfConsigneeProvince.Value = dsProvinces.Tables[0].Rows[0][0].ToString(); hfConsigneeCity.Value = dsProvinces.Tables[0].Rows[0][1].ToString(); hfConsigneeBorough.Value = dsProvinces.Tables[0].Rows[0][2].ToString(); } #endregion } if (a != null) { this.hfUID.Value = uid.ToString(); //显示列表 Search_Click(null, null); } else { Response.Write("<center><br><h3>未知买家!</h3>"); Response.End(); } } }
/// <summary> /// 修改会员信息 /// </summary> /// <param name="dr"></param> private void modifyMemberinfo(DataRow dr) { if (dr != null) { SOSOshop.Model.MemberInfo mi = new SOSOshop.Model.MemberInfo(); SOSOshop.BLL.MemberInfo mibll = new SOSOshop.BLL.MemberInfo(); SOSOshop.BLL.MemberPermission mpbll = new SOSOshop.BLL.MemberPermission(); SOSOshop.Model.MemberPermission mp = new SOSOshop.Model.MemberPermission(); object UID = mibll.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'"); int x = 0; if (int.TryParse(UID.ToString(), out x)) { if (mibll.Exists(x)) { mi = mibll.GetModel(x); mi.Address = dr["地址"].ToString(); mi.Code = dr["会员编号"].ToString(); object r = mibll.ExecuteScalar("select ID from DrugsBase_Enterprise where name='" + dr["公司名称"].ToString().Trim() + "'"); mi.ParentId = (int)r; mi.TrueName = dr["联系人名"].ToString(); mi.PriceCategory = dr["价格类型"] as string; mi.UID = x; mi.Province = GetRegionId(dr["省"].ToString()); mi.City = GetRegionId(dr["市"].ToString()); mi.Borough = GetRegionId(dr["区"].ToString()); mibll.Update(mi); SOSOshop.BLL.Logs.Log.LogAdminAdd("修改" + dr["联系手机"].ToString().Trim(), 0, UID.ToString(), 1); } } else { //SOSOshop.BLL.Logs.Log.LogAdminAdd("添加" + dr["联系手机"].ToString().Trim(), 0, rii.ToString(), 1); addMemberinfo(dr); } } }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // 注册用户 bool ok = false; int UID = 0; //添加买家账号信息 SOSOshop.BLL.MemberAccount aBll = new SOSOshop.BLL.MemberAccount(); SOSOshop.Model.MemberAccount a = new SOSOshop.Model.MemberAccount(); if (string.IsNullOrEmpty(model.Captcha) || !model.Captcha.Equals(Convert.ToString(Session["Captcha"]), StringComparison.CurrentCultureIgnoreCase)) { ModelState.AddModelError("", "提供的验证码不正确。"); } else { if (!string.IsNullOrEmpty(model.UserName) && !string.IsNullOrEmpty(model.PassWord) && model.PassWord.Equals(model.ConfirmPassword) && !string.IsNullOrEmpty(model.LinkMan) && !string.IsNullOrEmpty(model.Email)) { int i = new SOSOshop.BLL.MemberAccount().GetUserIdNameClass(model.UserName); if (i == 2) { a.UserId = ""; a.MobilePhone = model.UserName; a.Email = model.Email; } //else if (i == 3) //{ // a.UserId = ""; // a.MobilePhone = ""; // a.Email = model.UserName; //} //else //{ // a.UserId = model.UserName; // a.MobilePhone = ""; // a.Email = model.Email; //} //Response.Write(model.PassWord+" "+i); a.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1); a.Email_QQ = model.Email.EndsWith("@qq.com") ? model.Email : ""; a.Question = ""; a.Answer = ""; a.RegisterDate = DateTime.Now; a.RegisterIP = ChangeHope.WebPage.PageRequest.GetIP(); a.PeriodOfValidity = a.RegisterDate.AddYears(20); a.State = 1; a.CompanyClass = model.CompanyClass; UID = aBll.Add(a); } //添加买家联系信息 if (UID > 0) { SOSOshop.BLL.MemberInfo bBll = new SOSOshop.BLL.MemberInfo(); SOSOshop.Model.MemberInfo b = new SOSOshop.Model.MemberInfo(); b.UID = UID; b.TrueName = model.LinkMan; b.Member_Class = -1; b.Member_Type = 0; int area = 0; int.TryParse(Request["province"], out area); b.Province = area; area = 0; int.TryParse(Request["city"], out area); b.City = area; area = 0; int.TryParse(Request["county"], out area); b.Borough = area; if (model.CompanyClass == "生产企业" || model.CompanyClass == "商业公司" || model.CompanyClass == "民营医院") { b.Member_Class = 0; } else { b.Member_Class = 1; } //通知交易人员 //int tId = 0;//交易员ID 取消//改为数据库设置默认值 2014/2/12 //string tname = new SOSOshop.BLL.Administrators().GetTraderIdByRegion(b.Province, b.City, b.Borough, out tId, model.CompanyClass);//交易员姓名 int oId = 0; //外销人员(线下推广人员)ID string oName = new SOSOshop.BLL.Administrators().GetOutSellPersonIdByRegion(b.Province, b.City, b.Borough, out oId, model.CompanyClass); //外销人员(线下推广人员)姓名 //if (tId != 0) //{ // string jyphone = string.Format(" SELECT zyphone FROM zhiyzl WHERE is_czy='是' and beactive='是' and zhiyname='{0}'", tname); // SOSOshop.BLL.DbBase db = new SOSOshop.BLL.Db(); // db.ChangeDB("ConnectionStringERP"); // DataTable dt = db.ExecuteTable(jyphone); // if (dt.Rows.Count > 0) // { // string phone = dt.Rows[0][0].ToString().Trim(); // if (!string.IsNullOrEmpty(phone)) // { // ok = SOSOshop.BLL.Sms.SendAndSaveDataBase(phone, "手机号为" + model.UserName + "的用户,已经在101商城前台进行注册,请尽快联系完成后续注册审核。", "系统", phone); // } // } //} //b.Editer = tId; b.OSPId = oId; b.HandPhone = a.MobilePhone; ok = bBll.Add(b); //添加权限 if (ok) { SOSOshop.BLL.MemberPermission cBll = new SOSOshop.BLL.MemberPermission(); SOSOshop.Model.MemberPermission c = new SOSOshop.Model.MemberPermission(); c.UID = UID; c.IsMoneyAndShipping = true;//款到发货权限 ok = cBll.Add(c); } if (!ok) { aBll.Delete(UID); } } if (ok) { //发送注册成功的短信 取消//彭宴负责交易员分配工作,后台操作后发送短信 2014/2/12 var sms = new SOSOshop.MSG.Sms(); object phone = aBll.ExecuteScalar("select OfficePhone from yxs_administrators where adminid=(select Editer from memberaccount a inner join memberinfo b on a.UID=b.UID where a.UID='" + UID + "')"); //string SmsMsg = "尊敬的" + model.LinkMan + ",您已完成注册第一步,立即致电您的专属采购顾问" + phone + "开通查看价格权限"; string CompanyShortName = ConfigurationManager.AppSettings["CompanyShortName"]; string SmsMsg = string.Format("尊敬的用户,您在{0}医药网注册已成功,您的账户名为", CompanyShortName) + model.UserName + ",请留意保存,祝您采购愉快!"; string from = "系统"; string to = model.UserName; ok = SOSOshop.BLL.Sms.SendAndSaveDataBase(model.UserName, SmsMsg, from, to); //写入登陆日志 new SOSOshop.BLL.MemberLoginLog().Add(UID, model.UserName, a.PassWord); Session["Captcha"] = null; DateTime expiration = DateTime.Now.AddHours(12); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, model.UserName, DateTime.Now, expiration, false, UID.ToString(), FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); HttpCookie tk = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(tk); return(RedirectToAction("RegisterOK")); } else { ModelState.AddModelError("", "注册失败!"); } } } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(model)); }
public ActionResult LogOn(LogOnModel model, string returnUrl) { //Response.Write(returnUrl); returnUrl = Request["referrer"]; if (ModelState.IsValid) { if (model.UserName != null) { model.UserName = model.UserName.Trim(); } SOSOshop.BLL.MemberAccount bll = new SOSOshop.BLL.MemberAccount(); SOSOshop.Model.MemberAccount obj = null; if ((string.IsNullOrEmpty(model.Captcha) || !model.Captcha.Equals(Convert.ToString(Session["Captcha"]), StringComparison.CurrentCultureIgnoreCase))) { ModelState.AddModelError("", "您输入的验证码不正确。"); } else { string loginname = model.UserName; string loginpwd = model.PassWord; if (!string.IsNullOrEmpty(model.UserName) && !string.IsNullOrEmpty(model.PassWord)) { model.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1); obj = bll.GetModelByNameAndPassword(model.UserName, model.PassWord); } if (obj != null) { if (obj.State == 2) { ModelState.AddModelError("", "用户已经被冻结,请联系客服。"); } else if (obj.PeriodOfValidity <= DateTime.Now) { ModelState.AddModelError("", "用户过期时间已到,请联系客服。"); } //else if (bll.GetMember_Class(obj.UID) == SOSOshop.Model.Member.Member_Class.无) //{ // ModelState.AddModelError("", "用户属未知买家类别,请联系客服。"); //} else { //写入登陆日志 new SOSOshop.BLL.MemberLoginLog().Add(obj.UID, model.UserName, model.PassWord); Session["Captcha"] = null; DateTime expiration = DateTime.Now.AddHours(12); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, model.UserName, DateTime.Now, expiration, false, obj.UID.ToString(), FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); HttpCookie tk = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(tk); //普通会员引导去升级 SOSOshop.BLL.MemberPermission mpb = new SOSOshop.BLL.MemberPermission(); SOSOshop.BLL.MemberInfo mifo = new SOSOshop.BLL.MemberInfo();//判断用户类型 SOSOshop.Model.MemberInfo obj2 = mifo.GetModel(obj.UID); int memberClass = obj2.Member_Class; //判断用户是否GSP建档 //未建档用户跳转到会员建档资料提交页面 if (!mpb.GetBuyFilingStatus(obj.UID)) { if (1 == (int)mpb.ExecuteScalar("SELECT IsSpecialTrade FROM dbo.memberpermission WHERE UID=" + obj.UID)) { #region 短信提醒 string phone = obj.MobilePhone; string CompanyShortName = ConfigurationManager.AppSettings["CompanyShortName"]; SOSOshop.BLL.Sms.SendAndSaveDataBase(phone, "尊敬的" + obj2.TrueName + string.Format(",快捷交易权限仅7天内有效,请尽快邮寄合法的首营资料到{0}审核,享永久会员权益", CompanyShortName), "系统", phone); int tId = obj2.Editer; if (tId > 0) { string jyphone = (string)new SOSOshop.BLL.Administrators().ExecuteScalar("select MobilePhone from yxs_administrators where adminid=" + tId); if (!string.IsNullOrEmpty(jyphone)) { SOSOshop.BLL.Sms.SendAndSaveDataBase(phone, "手机号为" + model.UserName + "的快捷开通客户已登录,请及时联系跟进,督促首营资质到位。", "系统", phone); } } #endregion return(RedirectToAction("Upgrade", "MemberCenter")); } else { return(RedirectToAction("registerok", "account")); } } else { if (returnUrl.Length > 10) { int pos = returnUrl.LastIndexOf("/"); int outs = 0; if (pos != -1) { pos++; } int.TryParse(returnUrl.Substring(pos).Replace(".html", ""), out outs); if ((outs != 0) || (returnUrl.IndexOf("products") != -1)) { return(Redirect(returnUrl)); } } return(RedirectToAction("index", "home")); //if (memberClass == 0)//批发客户跳转到基药频道 //{ // return RedirectToAction("Index", "jy"); //} //else if (memberClass == 1)//OTC客户跳转到OTC频道 //{ // //return RedirectToAction("Index", "Otc"); //} //else//其它用户 //{ // if (returnUrl.ToLower().IndexOf("logon") != -1 || returnUrl.ToLower().IndexOf("register") != -1) // { // return RedirectToAction("LoginOK", "Account"); // } // else if (!string.IsNullOrEmpty(returnUrl)) // { // return Redirect(returnUrl); // } // else // { // return RedirectToAction("LoginOK", "Account"); // } //} } } } else { ModelState.AddModelError("", "您输入的用户名或密码不正确。"); } } } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SOSOshop.BLL.PromptInfo.Popedom("008009014", "对不起,您没有权限进行查看"); int uid = 0; int.TryParse(Request["UID"], out uid); SOSOshop.Model.MemberAccount a = null; SOSOshop.Model.MemberInfo b = null; SOSOshop.Model.MemberPermission c = null; if (uid > 0) { //查询数据 a = new SOSOshop.BLL.MemberAccount().GetModel(uid); if (a != null) { b = new SOSOshop.BLL.MemberInfo().GetModel(uid); } if (a != null) { c = new SOSOshop.BLL.MemberPermission().GetModelWithNoCache(uid); } } if (a != null && b != null && c != null) { //买家ID this.hfUID.Value = uid.ToString(); //买家单位 this.ltlMemberinfo.Text = string.Format("<b>{0}</b> <b>{1}</b> <span>(类别:{2} {3})</span>", new SOSOshop.BLL.DbBase().ExecuteScalar("select Name from DrugsBase_Enterprise where ID=" + b.ParentId), b.TrueName, a.UserType >= 0 ? Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.UserType), a.UserType) : "", b.Member_Class >= 0 ? Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.Member_Class), b.Member_Class) : ""); //权限列表 this.cb_IsCOD.SelectedValue = c.IsCOD ? "1" : "0"; this.cb_IsLookPrice_01.SelectedValue = c.IsLookPrice_01 ? "1" : "0"; this.cb_IsLookPrice_02.SelectedValue = c.IsLookPrice_02 ? "1" : "0"; this.cb_IsLookProduct_01.SelectedValue = c.IsLookProduct_01 ? "1" : "0"; this.cb_IsLookProduct_02.SelectedValue = c.IsLookProduct_02 ? "1" : "0"; this.cb_IsLookStock.SelectedValue = c.IsLookStock ? "1" : "0"; this.cb_IsMoneyAndShipping.SelectedValue = c.IsMoneyAndShipping ? "1" : "0"; this.cb_IsPeriodicalSettle.SelectedValue = c.IsPeriodicalSettle ? "1" : "0"; this.cb_IsTrade.SelectedValue = c.IsTrade ? "1" : "0"; this.cb_IsPriorDistribution.SelectedValue = c.IsPriorDistribution ? "1" : "0"; this.cb_IsShippingFor48h.SelectedValue = c.IsShippingFor48h ? "1" : "0"; this.cb_IsSpecialTrade.SelectedValue = c.IsSpecialTrade ? "1" : "0"; //授权 bool isCheckUp = SOSOshop.BLL.PowerPass.isPass("008009014"); this.cb_IsCOD.Enabled = isCheckUp; this.cb_IsLookPrice_01.Enabled = isCheckUp; this.cb_IsLookPrice_02.Enabled = isCheckUp; this.cb_IsLookProduct_01.Enabled = isCheckUp; this.cb_IsLookProduct_02.Enabled = isCheckUp; this.cb_IsLookStock.Enabled = isCheckUp; this.cb_IsMoneyAndShipping.Enabled = isCheckUp; this.cb_IsPeriodicalSettle.Enabled = isCheckUp; this.cb_IsTrade.Enabled = isCheckUp; this.cb_IsPriorDistribution.Enabled = isCheckUp; this.cb_IsShippingFor48h.Enabled = isCheckUp; this.cb_IsSpecialTrade.Enabled = isCheckUp; //建档通过 bool bBuyFilingStatus = 1 == _101shop.admin.v3.member.BuyerLib.GetGSP(uid); this.cb_IsSpecialTrade.Enabled = !bBuyFilingStatus && a.State == 0;//已审核的未建档的才能开通快捷交易的权限 //权限【拥有快捷开通交易的权限】, 第一次建档状态.通过 > 允许已经建档通过的会员的定单可以执行流程 int UID_BuyFilingStatus = (bBuyFilingStatus ? 1 : 0); //var lbll = new SOSOshop.BLL.Logs.Log("LogService"); string oks = "买家" + b.Code + "的建档已经通过"; if (UID_BuyFilingStatus > 0 && c.IsSpecialTrade && !b.Code.StartsWith("del", StringComparison.CurrentCultureIgnoreCase)) { SOSOshop.BLL.Order.Orders obll = new SOSOshop.BLL.Order.Orders(); obll.LetOrders2(b.Code, "一级单位"); //SOSOshop.BLL.Logs.Log.LogServiceAdd(oks, uid, b.TrueName, "往来单位消息处理1", "同步商城买家" + b.Code + "成功!", 0); } if (b.Member_Class != 0) { cb_IsPriorDistribution.Enabled = false; c.IsPriorDistribution = false; cb_IsPriorDistribution.SelectedValue = "0"; } } else { Response.Write("<center><br><h3>未知买家!</h3>"); Response.End(); } } }