public ActionResult CompanyEenter() { BLL.MemberBase member = new BLL.MemberBase(); var list = member.GetModelList(" m_usertype = 2 and m_shenPstatus = 1 and m_statuscode = 0 and "); ViewData["companyEnter"] = list; return View(); }
//注册成功页面 验证邮箱页面 // GET: /RegisterSuccessMail/ public ActionResult RegisterSuccessPage() { string successname = RequestBase.GetString("username"); string successusertype = RequestBase.GetString("usertype"); if (LoginMember != null) { ViewData["IsLogin"] = true; } else { ViewData["IsLogin"] = false; } if (successname != null && successname != "" && successusertype == "0") { BLL.MemberBase mbbll = new BLL.MemberBase(); DataSet ds = mbbll.GetList(" m_UserName='******' and m_UserType=0"); string id = ds.Tables[0].Rows[0]["m_ID"].ToString(); Model.MemberBase mbmodel = new Model.MemberBase(); mbmodel = mbbll.GetModel(int.Parse(id)); mbmodel.m_StatusCode = 0; mbmodel.m_mailyanzheng = true; if (mbbll.Update(mbmodel)) { ViewData["ueername"] = "恭喜您," + successname + ",邮箱验证成功!"; return View(); } else { ViewData["ueername"] = successname + ",数据异常,邮箱验证失败,请联系管理员!"; return View(); } } else { BLL.MemberBase mbbll = new BLL.MemberBase(); DataSet ds = mbbll.GetList(" m_UserName='******' and m_UserType=2"); string id = ds.Tables[0].Rows[0]["m_ID"].ToString(); Model.MemberBase mbmodel = new Model.MemberBase(); mbmodel = mbbll.GetModel(int.Parse(id)); mbmodel.m_StatusCode = 0; mbmodel.m_ShenPstatus = 1; if (mbbll.Update(mbmodel)) { ViewData["ueername"] = "恭喜您," + successname + ",邮箱验证成功!"; return View(); } else { ViewData["ueername"] = successname + ",数据异常,邮箱验证失败,请联系管理员!"; return View(); } } }
/// <summary> /// 验证身份方法 /// </summary> /// <returns></returns> public ActionResult passwordValid() { int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; string password = Request.Form["updatepassword"]; string md5pass=Utils.MD5(password); BLL.MemberBase mbbll = new BLL.MemberBase(); Model.MemberBase mbmodel = mbbll.GetModel(mid); if (md5pass == mbmodel.m_Password) { return RedirectToAction("vipChangePassword", "VipUpdatePassword"); } else { return Content("<script>alert('原始密码错误,请检查!');location.href='vipPasswordValidation'</script>"); } }
/// <summary> /// 获取折扣 /// </summary> /// <returns></returns> public decimal GetMemberDisCount(int mid) { decimal discount = 1.0M; Model.MemberBase member = new BLL.MemberBase().GetModel(mid); discount = member.m_ZheK.Value; //var vipRanks = _vipRank.GetModelList(" r_Status = 0 and r_Score <= " + LoginMember.m_Score); //if (vipRanks != null && vipRanks.Any()) //{ // var model = vipRanks.OrderByDescending(m => m.r_Score).FirstOrDefault(); // if (model != null) // { // discount = model.r_ZheK.Value; // } //} return discount; }
public ActionResult CompanyData() { List<Model.RegionBase> reglist = regbll.GetModelList(" reg_PId=0"); var models = new Models.ListModel(); models.regList = reglist; Model.MemberInfo model = null; if (Request.Cookies["UserInfo"] != null) { model = new BLL.MemberBase().getMemberInfo((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID); var tjlist = _productRecommendDetail.GetTop4List(" order by prt_id desc"); models.dt = tjlist; models.Minfo = model; ViewData["proviceid"] = model.m_Provice; if (model.m_Provice != null) { ViewData["provicename"] = regbll.GetModelByCode((int)model.m_Provice).reg_Name; } else ViewData["provicename"] = "选择省"; ViewData["cityid"] = model.m_City; if (model.m_City != null) { ViewData["cityname"] = regbll.GetModelByCode((int)model.m_City).reg_Name; } else ViewData["cityname"] = "选择市"; ViewData["xianid"] = model.m_Count; if (model.m_Count != null) { ViewData["xianname"] = regbll.GetModelByCode((int)model.m_Count).reg_Name; } else ViewData["xianname"] = "选择区/县"; } else { Response.Redirect("/logon/logon"); } return View(models); }
public void DsnsLogon(HttpContext context) { string username = context.Request.QueryString["uname"].ToString().Trim(); string passwd = context.Request.QueryString["passwd"].ToString().Trim(); passwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passwd, "MD5"); string AutoLogon = context.Request.QueryString["AutoLogon"].ToString(); BLL.MemberBase bll = new BLL.MemberBase(); DataSet ds = bll.GetList(string.Format(" m_UserName='******' and m_Password='******' and m_UserType=2", username, passwd)); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr["m_StatusCode"].ToString() == "1") { context.Response.Write("账号异常,请联系工作人员"); } else if (dr["m_ShenPstatus"].ToString() == "0") { context.Response.Write("账号未审核"); } else { DateTime ckExpires = DateTime.Now.AddHours(1); if (AutoLogon == "1") { ckExpires = DateTime.Now.AddDays(7); } Model.MemberBase model = bll.GetModel(int.Parse(dr["m_id"].ToString())); context.Response.Cookies["UserInfo"].Value = CookieEncrypt.SerializeObject(model); context.Response.Cookies["UserInfo"].Expires = ckExpires; string url = context.Request.UrlReferrer.AbsoluteUri; context.Response.Write("1"); } } else { context.Response.Write("账号不存在或用户名密码错误"); } }
/// <summary> /// 生成订单 /// </summary> public int CreateOrder() { int result=0; try { var context = System.Web.HttpContext.Current; string cID, mID, payID, stID, remarks, oprice,score; cID = context.Request.Params["cID"]; mID = context.Request.Params["mID"]; payID = context.Request.Params["payID"]; stID = context.Request.Params["stID"]; remarks = context.Request.Params["remarks"]; oprice = context.Request.Params["oPrice"]; score = context.Request.Params["score"]; Model.MemberBase memberbase = new BLL.MemberBase().GetModel(Convert.ToInt32(mID)); Model.OrderBase order = new Model.OrderBase(); order.c_ID = Convert.ToInt32(cID); order.m_ID = Convert.ToInt32(mID); order.pay_ID = Convert.ToInt32(payID); order.st_ID = Convert.ToInt32(stID); order.o_CreateOn = DateTime.Now; order.o_Code = order.o_CreateOn.Value.ToUnixTimeStamp() + order.m_ID; order.o_IsDel = false; order.o_Mark = remarks; order.o_Pric = Convert.ToDecimal(oprice); order.o_StatusCode = 0; order.o_Score = Convert.ToInt32(score); order.o_Zhek = memberbase.m_ZheK; result = new BLL.OrderBase().Add(order); return result; } catch { throw new Exception("订单出错"); } }
// // GET: /UserInfo/ public ActionResult Index() { Model.MemberInfo model = null; if (Request.Cookies["UserInfo"] != null) { model = new BLL.MemberBase().getMemberInfo((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID); var tjlist = _productRecommendDetail.GetTop4List(" order by prt_id desc"); var models = new Models.ListModel(); models.dt = tjlist; models.Minfo = model; try { ViewBag.dengji = _newsBase.GetModelList(" n_Title='等级特权' and n_StatusCode=0 and n_IsDel=0")[0].n_Content; } catch { ViewBag.dengji = "暂无等级特权"; } try { ViewBag.shengji = _newsBase.GetModelList(" n_Title='升级机制' and n_StatusCode=0 and n_IsDel=0")[0].n_Content; } catch { ViewBag.shengji = "暂无升级机制"; } return View(models); } else { Response.Redirect("/Index/Index"); return View(); } }
/// <summary> /// 企业会员注册方法 /// </summary> /// <returns></returns> public ActionResult companyRegisterAdd() { string username = Request.Form["email"]; string password = Request.Form["password"]; //转换md5 string md5password = Utils.MD5(password); string lianxiren = Request.Form["lxname"]; string phone = Request.Form["phone"]; string lxemail = Request.Form["lxemail"]; string qq = Request.Form["qq"]; string gsname = Request.Form["gsname"]; string yyzz = Request.Form["yyzz"]; string xxdizhi = Request.Form["xxadress"]; //省份地区 int shengfen = Convert.ToInt32(Request.Form["selectType"]); int shi = Convert.ToInt32(Request.Form["selectType2"]); int quyu = Convert.ToInt32(Request.Form["selectType3"]); //固定电话 string quhao = Request.Form["quhao"]; string gdhaoma = Request.Form["gdhaoma"]; string fenji = Request.Form["fenji"]; string gudingdianhao = "";//固定电话 if (quhao != null && quhao != "") { gudingdianhao += quhao; } if (gdhaoma != null && gdhaoma != "") { gudingdianhao += gdhaoma; } if (fenji != null && fenji != "") { gudingdianhao += fenji; } try { Model.MemberBase mb = new Model.MemberBase(); mb.m_UserName = username; mb.m_Password = md5password; mb.m_RealName = lianxiren;//联系人 if (gudingdianhao != "") { mb.m_GDPhone = gudingdianhao; } mb.m_Phone = phone; mb.m_Email = lxemail; mb.m_QQ = qq; mb.m_GongSiName = gsname; mb.m_YingYZZ = yyzz; mb.m_Provice = shengfen; mb.m_City = shi; mb.m_Count = quyu; mb.m_GongSiAddress = xxdizhi; mb.m_Score = 0; mb.m_Rank = 1; mb.m_ZheK = 1; mb.m_UserType = 2; mb.m_StatusCode = 0; mb.m_ShenPstatus = 0; ////发送邮件 //string url = GetUrl(); //string mailAccount = ConfigurationManager.AppSettings["mailAccount"].ToString();//发送者邮箱 //string mima = ConfigurationManager.AppSettings["mailPassWord"].ToString();//发送者邮箱密码 //string mailShowName = ConfigurationManager.AppSettings["mailShowName"].ToString();//邮件主题 //string body = "欢迎注册月月兴企业会员!请点击<div><a href='http://" + url + "?username="******"&usertype=2'>月月兴验证</a>链接完成注册!</div>"; //if (MailMessageExtensions.SendMail(mailShowName, body, mailAccount, mb.m_Email, mima)) //{ Session["newcmid"]=new BLL.MemberBase().Add(mb); if (int.Parse(Session["newcmid"].ToString()) > 0) { Session["registerusername"] = username; Session["registeremail"] = lxemail; Session["usertype"] = "2"; return View("successRegiser" ); } else { return Content("<script>alert('注册失败,系统信息异常!');location.href='companyRegister'</script>"); } //} //else //{ // return Content("<script>alert('注册失败,您输入邮箱的不存在!');location.href='companyRegister'</script>"); //} } catch (Exception) { return Content("<script>alert('注册失败,系统异常!');location.href='companyRegister'</script>"); } }
public string validatename() { #region 验证用户名是否存在 DataSet isds = new BLL.MemberBase().GetList(" m_UserName='******'"); if (isds.Tables[0].Rows.Count > 0) { return "error"; } else { return "success"; } #endregion }
/// <summary> /// 注册个人会员方法 /// </summary> /// <returns></returns> public ActionResult singleRegisterAdd() { string username = Request.Form["userName"]; string password = Request.Form["password"]; string md5password = Utils.MD5(password); string email = Request.Form["email"]; string phone = Request.Form["phone"]; try { Model.MemberBase mb = new Model.MemberBase(); mb.m_UserName = username; mb.m_Password = md5password; mb.m_Email = email; mb.m_Phone = phone; mb.m_Score = 0; mb.m_Rank = 1; mb.m_ZheK = 1; mb.m_StatusCode = 0; mb.m_ShenPstatus = 1; string url = GetUrl(); ////发送邮件 //string successemailpage=ConfigurationManager.AppSettings["RegisterSuccessPage"].ToString(); //string mailAccount = ConfigurationManager.AppSettings["mailAccount"].ToString();//发送者邮箱 //string mima = ConfigurationManager.AppSettings["mailPassWord"].ToString();//发送者邮箱密码 //string mailShowName = ConfigurationManager.AppSettings["mailShowName"].ToString();//邮件主题 //string body = "欢迎注册月月兴个人会员!请点击<div><a href='http://" + url + "?username="******"&usertype=0'>月月兴验证</a>链接完成注册!</div>"; //if (MailMessageExtensions.SendMail(mailShowName, body, mailAccount, mb.m_Email, mima)) //{ Session["newpmid"]=new BLL.MemberBase().Add(mb); if (int.Parse(Session["newpmid"].ToString())> 0) { Session["registerusername"] = username; Session["registeremail"] = email; return View("successRegiser"); } else { return Content("<script>alert('注册失败,系统信息异常!');location.href='singleRegister'</script>"); } //} //else //{ // return Content("<script>alert('注册失败,您输入邮箱的不存在!');location.href='singleRegister'</script>"); //} } catch (Exception) { return Content("<script>alert('注册失败,系统信息异常!');location.href='singleRegister'</script>"); } }
public string sendemail() { int mid = 0; int mtype = 0; if (Session["newcmid"] != null && !string.IsNullOrEmpty(Session["newcmid"].ToString())) { mid = int.Parse(Session["newcmid"].ToString()); mtype = 1; } if (Session["newpmid"] != null && !string.IsNullOrEmpty(Session["newpmid"].ToString())) { mid = int.Parse(Session["newpmid"].ToString()); mtype = 0; } string successemailpage = ConfigurationManager.AppSettings["RegisterSuccessPage"].ToString(); string mailAccount = ConfigurationManager.AppSettings["mailAccount"].ToString();//发送者邮箱 string mima = ConfigurationManager.AppSettings["mailPassWord"].ToString();//发送者邮箱密码 string mailShowName = ConfigurationManager.AppSettings["mailShowName"].ToString();//邮件主题 string url = GetUrl(); Model.MemberBase model = new BLL.MemberBase().GetModel(mid); string body = "欢迎注册月月兴会员!请点击<div><a href='http://" + url + "?username="******"&usertype=" + mtype + "'>月月兴验证</a>链接完成注册!(若不是本人操作,请忽略此邮件)</div>"; if (MailMessageExtensions.SendMail(mailShowName, body, mailAccount, model.m_Email, mima)) { model.m_ShenPstatus = 1; bool result = new BLL.MemberBase().Update(model); return "http://www.mail." + model.m_Email.Substring(model.m_Email.IndexOf('@') + 1, model.m_Email.Length - model.m_Email.IndexOf('@') - 1); ; } else { return ""; } }
public ActionResult Save(Model.MemberBase model) { bool result = false; #region 验证用户名是否存在 DataSet isds = new BLL.MemberBase().GetList(" m_UserName='******'"); if (isds.Tables[0].Rows.Count>0) { return Content(DWZUtil.GetResultJson("300", "保存失败,用户名已存在,请修改!!", "", "", "")); } #endregion #region 验证输入的积分是否在会员等级范围之内 DataSet ds = new BLL.VipRank().GetList(1, "r_Status!=2 and r_Status!=1", " r_UpperScore desc"); DataTable dt = ds.Tables[0]; List<Model.VipRank> listviprankall = new BLL.VipRank().DataTableToList(dt);//得到最大等级积分 for (int i = 0; i < listviprankall.Count; i++) { if (model.m_Score > listviprankall[i].r_UpperScore || model.m_Score == null) { return Content(DWZUtil.GetResultJson("300", "保存失败,积分不在此会员等级范围内,请修改!!", "", "", "")); } else { if (model.m_Score != null && model.m_Score.ToString() != "" && Request.Form["addselviprank"] != null) { List<Model.VipRank> listviprank = new BLL.VipRank().GetModelList("r_Status!=2 and r_Status!=1 and r_Rank=" + Request.Form["addselviprank"]); for (int j = 0; j < listviprank.Count; j++) { model.m_Rank = listviprank[j].r_Rank; model.m_ZheK = listviprank[j].r_ZheK; } } else { return Content(DWZUtil.GetResultJson("300", "保存失败,积分为空或数据有误!!", "", "", "")); } } } #endregion try { bool istongguo = false;//积分是否在选中的会员等级范围内 List<Model.VipRank> viprank = new BLL.VipRank().GetModelList("r_Status!=2 and r_Status!=1 and r_Rank=" + Request.Form["addselviprank"]); for (int i = 0; i < viprank.Count; i++) { if (model.m_Score < viprank[i].r_Score || model.m_Score > viprank[i].r_UpperScore) { istongguo = false; } else { istongguo = true; } } if (istongguo) //为true时执行 { model.m_UserType = 1; model.m_Password = Utils.MD5(model.m_Password); result = memberbll.Add(model) > 0 ? true : false; } else { return Content(DWZUtil.GetResultJson("300", "保存失败,积分不在此会员等级范围内,请修改!!", "", "", "")); } if (result) { return Content(DWZUtil.GetResultJson("200", "操作成功!!", "w_会员管理", "", "closeCurrent")); } else { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } } catch { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } }
public ActionResult LeftMenu() { int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; Model.MemberBase mbmodel = new Model.MemberBase(); mbmodel = new BLL.MemberBase().GetModel(mid); if (mbmodel.m_UserType == 0) { ViewData["Iscompany"] = false; } else { ViewData["Iscompany"] = true; } } return View(); }
/// <summary> /// 输入新密码方法 /// </summary> /// <returns></returns> public ActionResult vipChangePasswordValid() { try { int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; string password = Request.Form["password"]; string md5pass = Utils.MD5(password); BLL.MemberBase mbbll = new BLL.MemberBase(); Model.MemberBase mbmodel = mbbll.GetModel(mid); mbmodel.m_ID = mid; mbmodel.m_Password = md5pass; if (new BLL.MemberBase().Update(mbmodel)) { //重新保存登录缓存 var model = _memberBase.GetModel(LoginMember.m_ID); System.Web.HttpContext.Current.Response.Cookies["UserInfo"].Value = CookieEncrypt.SerializeObject(model); System.Web.HttpContext.Current.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddMinutes(180); return RedirectToAction("vipSuccessPassword"); } else { return Content("<script>alert('修改密码失败,系统异常!');location.href='vipChangePassword'</script>"); } } catch (Exception) { return Content("<script>alert('修改密码失败,系统异常!');location.href='vipChangePassword'</script>"); } }
public ActionResult SafeCenter() { Model.MemberBase model = null; if (LoginMember != null) { model = new BLL.MemberBase().GetModel((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID); var models = new Models.ListModel(); models.member = model; if (model.m_mailyanzheng) { ViewData["Isshenpi"] = true; } else { ViewData["Isshenpi"] = false; } ViewData["email"] = "http://www." + model.m_Email.Substring(model.m_Email.IndexOf('@') + 1, model.m_Email.Length - model.m_Email.IndexOf('@') - 1); ViewData["mid"] = model.m_ID; return View(model); } else { Response.Redirect("/Index/Index"); return View(); } }
//订单详情 public ActionResult VipOrderDetail() { int oid = 0; int mid = 0; if (LoginMember != null) { if (!string.IsNullOrEmpty(RequestBase.GetString("oid"))) { oid = int.Parse(RequestBase.GetString("oid")); } mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; //订单信息 ViewBag.orderinfo = obll.GetModel(oid); ViewData["status"] = ViewBag.orderinfo.o_StatusCode; Model.ConsigneeInfoBase conmodel = new Model.ConsigneeInfoBase(); int? cid = obll.GetModel(oid).c_ID; //收货人信息 ViewBag.coninfo = new BLL.ConsigneeInfoBase().GetModel(int.Parse(cid.ToString())); //订单商品明细 var orderskulist = vobll.GetModelList(" m_ID=" + mid + " and o_ID=os_oID and o_Code='" + obll.GetModel(oid).o_Code + "'"); if (orderskulist.Count > 0) { ViewBag.ordersku = orderskulist; string skulist = ""; string countlist = ""; decimal pricecount=0; foreach (var sku in ViewBag.ordersku) { skulist += sku.sku_ID + ","; countlist += sku.os_pCount + ","; pricecount += sku.sku_Price * sku.os_pCount; } skulist = skulist.Substring(0, skulist.Length - 1); countlist = countlist.Substring(0, countlist.Length - 1); ViewData["skulist"] = skulist; ViewData["countlist"] = countlist; ViewData["yuanjia"] = pricecount; } ////支付方式 ViewBag.payfor = new BLL.PaymentBase().GetModel(int.Parse(obll.GetModel(oid).pay_ID.ToString())); //配送方式 ViewBag.stname = new BLL.ShipTypeBase().GetModel(int.Parse(obll.GetModel(oid).st_ID.ToString())); //订单追踪 ViewBag.orderstatus = new BLL.OrderStatusBase().GetModelList(" o_ID=" + oid + " and os_IsDel=0"); //折扣 var member = new BLL.MemberBase().GetModel(mid); if (member != null) { var ranklist = new BLL.VipRank().GetModelList(member.m_Score + " between r_score and r_upperscore "); if (ranklist.Count > 0) { ViewData["zhek"] = ranklist[0].r_ZheK; } } ViewData["maxstatus"] = new BLL.OrderStatusBase().Getmaxstatus(" o_ID=" + oid + " and os_IsDel=0"); return View(); } else { Response.Redirect("/wapLogin/Login"); return View(); } }
public ActionResult index() { Model.MemberInfo model = null; model = new BLL.MemberBase().getMemberInfo((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID); var models = new Models.ListModel(); models.Minfo = model; return View(model); }
public ActionResult vipscore() { int pageSize = 6;//每一页的行数 int pageNumber = 1;//当前页数 DateTime from, to; string where = ""; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; Model.MemberBase mmodel = new Model.MemberBase(); Model.OrderBase omodel = new Model.OrderBase(); int fen = 0; decimal fenj = 0; var list = new BLL.OrderBase().GetModelListbypric(" m_ID=" + mid + " and o_StatusCode=4 and o_IsDel=0 order by o_CreateOn desc"); foreach (var i in list) { fen += int.Parse(i.o_Score.ToString()); } var pagelist = list.ToPagedList(pageNumber, pageSize); var mlist = new BLL.MemberBase().GetModel(mid); ViewData["mScore"] = mlist.m_Score; ViewData["mid"] = mid; ViewData["count"] = list.Count; ViewData["pagerows"] = pageSize; ViewData["page"] = pageNumber; var jifen = new BLL.NewsBase().GetModelList(" n_Title='积分规则' and n_StatusCode=0 and n_IsDel=0"); ViewBag.jifen = jifen[0].n_Content; ViewBag.orderinfo = pagelist.ToList(); List<Model.RejectionBase> lvlist = new BLL.RejectionBase().GetModelList(" m_ID=" + mid + " and r_Status=2 and r_Isdelete=0"); foreach (var i in lvlist) { if ((i.r_Price.ToString()).IndexOf('.') > 0) { fenj += int.Parse((i.r_Price.ToString()).Substring(0, (i.r_Price.ToString()).IndexOf('.'))); } } if (fen - int.Parse(fenj.ToString()) > 0) { ViewData["jifenshu"] = fen - int.Parse(fenj.ToString()); } else { ViewData["jifenshu"] = 0; } return View(lvlist.ToList()); } else { Response.Redirect("/Index/Index"); return View(); } }
private string SavePCRegister() { string nickname = Form["nickname"]; string phone = Form["phone"]; string address = Form["address"]; string email = Form["email"]; string password = Form["password"]; string result = ""; try { DataSet ds = new BLL.MemberBase().GetList(" m_StatusCode!=2 and m_UserName='******'"); if (ds.Tables[0].Rows.Count > 0) { result = "{'result':'被注册!'}"; } else { Model.MemberBase mb = new Model.MemberBase(); mb.m_NickName = nickname; mb.m_Phone = phone; mb.m_GongSiAddress = address; mb.m_UserName = email; string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5"); mb.m_Password = pwd; mb.m_Email = email; mb.m_UserType = 0; mb.m_ZheK = 1; mb.m_ShenPstatus = 1; mb.m_Rank = 1; mb.m_Score = 0; int flog = new BLL.MemberBase().Add(mb); if (flog > 0) { result = "{'result':'保存成功!'}"; } else { result = "{'result':'保存失败!'}"; } } return result; } catch (Exception) { result = "{'result':'保存失败!'}"; throw; } }
private string pcLogin(HttpContext context) { string result = ""; string username = Form["username"]; string password = Form["password"]; try { string md5pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(password,"MD5"); DataSet ds= new BLL.MemberBase().GetList("m_UserName='******' and m_Password='******' and m_UserType=0 and m_StatusCode=0 and m_ShenPstatus=1 "); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; //DateTime ckExpires = DateTime.Now.AddHours(1); //ckExpires = DateTime.Now.AddDays(7); Model.MemberBase model = new BLL.MemberBase().GetModel(int.Parse(dr["m_id"].ToString())); //context.Response.Cookies["UserInfo"].Value = CookieEncrypt.SerializeObject(model); //context.Response.Cookies["UserInfo"].Expires = ckExpires; context.Response.Cookies[":userlogin"].Value = CookieEncrypt.SerializeObject(model); context.Response.Cookies[":userlogin"].Expires.AddDays(2); //string url = context.Request.UrlReferrer.AbsoluteUri; //context.Response.Write("1"); result = "{'result':'保存成功!'}"; } else { result = "{'result':'保存失败!'}"; } } catch (Exception) { result = "{'result':'保存失败!'}"; throw; } return result; }