/// <summary> /// 获得数据列表 /// </summary> public List <M_td_Userinvitation> DataTableToList(DataTable dt) { List <M_td_Userinvitation> modelList = new List <M_td_Userinvitation>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { M_td_Userinvitation model = new M_td_Userinvitation(); for (int n = 0; n < rowsCount; n++) { // model = dal.DataRowToModel(dt.Rows[n]); if (model != null) { modelList.Add(model); } } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_td_Userinvitation model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update hx_td_Userinvitation set "); strSql.Append("invcode=@invcode,"); strSql.Append("invtime=@invtime,"); strSql.Append("invpersonid=@invpersonid,"); strSql.Append("Invpeopleid=@Invpeopleid,"); strSql.Append("InvitesStates=@InvitesStates,"); strSql.Append("Invitereward=@Invitereward"); strSql.Append(" where invitationid=@invitationid"); SqlParameter[] parameters = { new SqlParameter("@invcode", SqlDbType.VarChar, 50), new SqlParameter("@invtime", SqlDbType.DateTime), new SqlParameter("@invpersonid", SqlDbType.Int, 4), new SqlParameter("@Invpeopleid", SqlDbType.Int, 4), new SqlParameter("@InvitesStates", SqlDbType.Int, 4), new SqlParameter("@Invitereward", SqlDbType.Decimal, 5), new SqlParameter("@invitationid", SqlDbType.Int, 4) }; parameters[0].Value = model.invcode; parameters[1].Value = model.invtime; parameters[2].Value = model.invpersonid; parameters[3].Value = model.Invpeopleid; parameters[4].Value = model.InvitesStates; parameters[5].Value = model.Invitereward; parameters[6].Value = model.invitationid; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_td_Userinvitation model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into hx_td_Userinvitation("); strSql.Append("invcode,invtime,invpersonid,Invpeopleid,InvitesStates,Invitereward,UserAct)"); strSql.Append(" values ("); strSql.Append("@invcode,@invtime,@invpersonid,@Invpeopleid,@InvitesStates,@Invitereward,@UserAct)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@invcode", SqlDbType.VarChar, 50), new SqlParameter("@invtime", SqlDbType.DateTime), new SqlParameter("@invpersonid", SqlDbType.Int, 4), new SqlParameter("@Invpeopleid", SqlDbType.Int, 4), new SqlParameter("@InvitesStates", SqlDbType.Int, 4), new SqlParameter("@Invitereward", SqlDbType.Decimal, 5), new SqlParameter("@UserAct", SqlDbType.Int, 4) }; parameters[0].Value = model.invcode; parameters[1].Value = model.invtime; parameters[2].Value = model.invpersonid; parameters[3].Value = model.Invpeopleid; parameters[4].Value = model.InvitesStates; parameters[5].Value = model.Invitereward; parameters[6].Value = model.UserAct; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public M_td_Userinvitation DataRowToModel(DataRow row) { M_td_Userinvitation model = new M_td_Userinvitation(); if (row != null) { if (row["invitationid"] != null && row["invitationid"].ToString() != "") { model.invitationid = int.Parse(row["invitationid"].ToString()); } if (row["invcode"] != null) { model.invcode = row["invcode"].ToString(); } if (row["invtime"] != null && row["invtime"].ToString() != "") { model.invtime = DateTime.Parse(row["invtime"].ToString()); } if (row["invpersonid"] != null && row["invpersonid"].ToString() != "") { model.invpersonid = int.Parse(row["invpersonid"].ToString()); } if (row["Invpeopleid"] != null && row["Invpeopleid"].ToString() != "") { model.Invpeopleid = int.Parse(row["Invpeopleid"].ToString()); } if (row["InvitesStates"] != null && row["InvitesStates"].ToString() != "") { model.InvitesStates = int.Parse(row["InvitesStates"].ToString()); } if (row["Invitereward"] != null && row["Invitereward"].ToString() != "") { model.Invitereward = decimal.Parse(row["Invitereward"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public M_td_Userinvitation GetModel(int invitationid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 invitationid,invcode,invtime,invpersonid,Invpeopleid,InvitesStates,Invitereward from hx_td_Userinvitation "); strSql.Append(" where invitationid=@invitationid"); SqlParameter[] parameters = { new SqlParameter("@invitationid", SqlDbType.Int, 4) }; parameters[0].Value = invitationid; M_td_Userinvitation model = new M_td_Userinvitation(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖励 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); string tid = "";//富爸爸参数uid //Utils.GetCookie("Cooperation", "tid");//渠道来源ID string invcode = Utils.GetInvCode(); // 用户邀请用户关系存在的时候,不走 新渠道机制(channel) #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; var channelInvitedCode = ef.hx_Channel.Where(c => c.ChannelName == "fubaba").Select(c => c.Invitedcode).FirstOrDefault(); if (cInvitedcode.Trim() == channelInvitedCode) { tid = cc_keyValue["uid"]; } } #endregion int ch = 0; if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch"));//渠道来源 } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 1; } } if (strvcode != null) { if (strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p); if (uid > 0) { CheckXiCai(p.mobile, cInvitedcode); //if (tid != "") //{ // Utils.GetCoopAPI(tid, uid.ToString(), 1); //} string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; if (Utils.LoginWriteSession(mlogin, remember) > 0) { string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); LogInfo.WriteLog(sql); DbHelperSQL.ExecuteSql(sql); } #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/""}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖历 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); //string strvcode = "y"; if ((Settings.Instance.SiteDomain.IndexOf(PublicURL.NewWXUrl) >= 0)) { strvcode = ck.GetVcodeWX(Validatecode, mobile1); } string tid = Utils.GetCookie("Cooperation", "tid"); int ch = 0; string invcode = Utils.GetInvCode(); #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; } #endregion if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch")); } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 3; } else { ch = 2; } } if (realMobileUser || strvcode != null) { if (realMobileUser || strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p);//注册成功返回会员ID if (uid > 0) { //记录用户信息到活动流量发放表里 2016.10.21-31日 //string CookCode = Utils.GetCookie("CookCode"); //if (!string.IsNullOrWhiteSpace(CookCode)) //{ // if (CookCode== "liumi") // { // AddReceiveInfo(uid); // } //} if (tid != "") { // Utils.GetCoopAPI(tid, uid.ToString(), 1); } string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; FormsAuthentication.SignOut(); Utils.AddLoginCache(p.username, mlogin); string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); DbHelperSQL.ExecuteSql(sql); #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/index.html"",""uid"":" + uid + "}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/index.html", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_td_Userinvitation model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_td_Userinvitation model) { return(dal.Add(model)); }