本文整理汇总了C#中Users.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Users.Add方法的具体用法?C# Users.Add怎么用?C# Users.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserRegister
public string UserRegister(string Name, string Password, string Email, string RealityName)
{
long CpsID = -1;
long CommenderID = -1;
string Memo = "";
Users user = new Users(1);
user.Name = Name;
user.Password = Password;
user.Email = Email;
user.RealityName = RealityName;
user.UserType = 2;
user.CommenderID = CommenderID;
user.CpsID = CpsID;
user.Memo = Memo;
string ReturnDescription=string.Empty;
int Result = user.Add(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("会员注册不成功:" + ReturnDescription);
return "会员注册不成功:" + ReturnDescription;
}
Result = user.Login(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("注册成功后登录失败:" + ReturnDescription);
return "注册成功后登录失败:" + ReturnDescription;
}
return "1";
}
示例2: RegUser
private string RegUser()
{
string userName = Request.Form["userName"];
string pwd = Request.Form["pwd"];
string email = Request.Form["email"];
string trueName = Request.Form["trueName"];
var u = new Users(1);
u.Name = userName;
u.Password = pwd;
u.Email = email;
u.RealityName = trueName;
u.UserType = 1;
string returnMsg = string.Empty;
int r = u.Add(ref returnMsg);
if (r < 0) {
var msg = string.Format("注册失败!{0}", returnMsg);
new Log("Users").Write(msg);
return msg;
}
return r.ToString();
}
示例3: FindAll
public Users FindAll(int buid, int userId)
{
#region FindAll
var users = new Users();
for (var i = 0; i < 10; i++)
{
users.Add(new User
{
BuId =
{
DataValue = i
},
UserId =
{
DataValue = i
},
UserName =
{
DataValue = String.Format("UserName_{0}", i)
},
Password =
{
DataValue = String.Format("Password_{0}", i)
},
Status =
{
DataValue = Status.Active
},
JobTitle =
{
DataValue = String.Format("JobTitle_{0}", i)
},
FirstName =
{
DataValue = String.Format("FirstName_{0}", i)
},
MiddleName =
{
DataValue = String.Format("MiddleName_{0}", i)
},
LastName =
{
DataValue = String.Format("LastName_{0}", i)
},
DateOfBirth =
{
DataValue = DateTime.Now
},
EmailAddress =
{
DataValue = String.Format("emailaddress{0}@gmail.com", i)
},
ContactNum1 =
{
DataValue = String.Format("1876443000{0}", i)
},
ContactNum2 =
{
DataValue = String.Format("1876443000{0}", i)
},
ContactNum3 =
{
DataValue = String.Format("1876443000{0}", i)
},
Address1 =
{
DataValue = String.Format("MyAddress1_{0}", i)
},
Address2 =
{
DataValue = String.Format("MyAddress2_{0}", i)
},
Address3 =
{
DataValue = String.Format("MyAddress3_{0}", i)
},
Parish =
{
DataValue = String.Format("Parish_{0}", i)
},
Gender =
{
DataValue = Gender.Male
},
PhotoPath =
{
DataValue = new Uri(String.Format("../UsersImage/{0}", i), UriKind.Relative).AbsolutePath
},
CreatedAt =
{
DataValue = DateTime.Now
},
CreatedBy =
{
DataValue = i
},
UpdatedAt =
{
DataValue = DateTime.Now
},
//.........这里部分代码省略.........
示例4: cmd_Save_Click
protected void cmd_Save_Click(object sender, EventArgs e)
{
if (!CheckExistText(txt_UserName))
{
ShowPageMsg("請輸入使用者姓名");
return;
}
if (!CheckExistText(txt_User_ID))
{
ShowPageMsg("請輸入使用者代號");
return;
}
if (_operator == null)
{
_operator = new UserRole();
}
Security sec = new Security();
Users user = new Users();
bool suc = true;
try
{
user.User_ID = this.txt_User_ID.Text.Trim();
user.User_Name = this.txt_UserName.Text;
if (txt_Password.Text.Length > 0)
user.User_Password = user.GetEncryptPassword(this.txt_Password.Text.Trim());
user.Create_Time = DateTime.Now;
//if (ddl_department.SelectedValue != "-1")
//{
// user.DepartmentID = Convert.ToInt32(ddl_department.SelectedValue);
//}
user.Phone = txt_tel.Text;
user.Email = txt_email.Text;
user.Status = chk_Status.Checked;
user.Expire_Time = DateTime.Now;
user.Update_Time = DateTime.Now;
if (this.hidden_Action.Value.Equals("add"))
{
//新增User
if (user.Add())
{
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add user", "AuthManage", "success", Session["LoginStaffID"].ToString());
}
else
{
suc = false;
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add user", "AuthManage", "fault", Session["LoginStaffID"].ToString());
}
//新增User Role
string role = "";
for (int i = 0; i < this.gv.Rows.Count; i++)
{
CheckBox chk = (CheckBox)this.gv.Rows[i].Cells[0].Controls[1];
if (chk.Checked)
{
_operator.User_ID = this.txt_User_ID.Text.Trim();
_operator.Role_ID = this.gv.Rows[i].Cells[1].Text.Trim();
suc &= _operator.AddUserRole();
role += _operator.Role_ID + ",";
}
}
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add userrole", "AuthManage", "role[" + role.TrimEnd(',') + "]", Session["LoginStaffID"].ToString());
}
else
{
//儲存User Role
_operator.DeleteUserRole(this.hidden_ID.Value);
string role = "";
for (int i = 0; i < this.gv.Rows.Count; i++)
{
CheckBox chk = (CheckBox)this.gv.Rows[i].Cells[0].Controls[1];
if (chk.Checked)
{
_operator.User_ID = this.hidden_ID.Value;
_operator.Role_ID = this.gv.Rows[i].Cells[1].Text.Trim();
suc &= _operator.AddUserRole();
role += _operator.Role_ID + ",";
}
}
sec.SaveLog(this.hidden_ID.Value, "save userrole", "AuthManage", "role[" + role.TrimEnd(',') + "]", Session["LoginStaffID"].ToString());
//儲存狀態
switch (this.chk_Status.Checked)
{
case true:
user.SaveStatus(this.hidden_ID.Value, "1");
break;
case false:
user.SaveStatus(this.hidden_ID.Value, "0");
break;
default:
break;
}
suc = user.EditUser(user);
sec.SaveLog(this.hidden_ID.Value, "save status", "AuthManage", "status[" + this.chk_Status.Checked + "]", Session["LoginStaffID"].ToString());
}
//.........这里部分代码省略.........
示例5: btnReg_Click
protected void btnReg_Click(object sender, EventArgs e)
{
if (tbRegCheckCode.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
string RegCode = tbRegCheckCode.Text.Trim().ToLower();
if (Shove._Web.Cache.GetCacheAsString("CheckCode_" + Request.Cookies["ASP.NET_SessionId"].Value, "") != Shove._Security.Encrypt.MD5(PF.GetCallCert() + RegCode))
{
Shove._Web.JavaScript.Alert(this.Page, "验证码输入错误,请重新输入!");
return;
}
long CpsID = -1;
long CommenderID = -1;
string Memo = "";
FirstUrl firstUrl = new FirstUrl();
string URL = firstUrl.Get();
if (!URL.StartsWith("http://"))
{
URL = "http://" + URL;
URL = URL.Split('?'.ToString().ToCharArray())[0];
}
DataTable dt = new DAL.Tables.T_Cps().Open("id, [ON], [Name]", "SiteID = " + _Site.ID.ToString() + " and( DomainName = '" + URL + "' or DomainName='" + Shove._Web.Utility.GetUrl() + "')", "");
if (Shove._Convert.StrToLong(firstUrl.CpsID, -1) > 0) //读取第一次访问页面时保存的CPS ID
{
CpsID = Shove._Convert.StrToLong(firstUrl.CpsID, -1);
}
else if ((dt != null) && (dt.Rows.Count > 0))
{
CpsID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), -1);
Memo = firstUrl.PID;//联盟商推广URL的PID
}
System.Threading.Thread.Sleep(500);
string Name = TBUserName.Text.Trim();
string Password = TBPwdOne.Text.Trim();
string Password2 = TBPwdTwo.Text.Trim();
string Email = TBUserMail.Text.Trim();
string RealityName = tbRealityName.Text.Trim();
string Mobile = TBMobile.Text.Trim();
Users user = new Users(_Site.ID);
user.Name = Name;
user.Password = Password;
user.Email = Email;
user.RealityName = RealityName;
user.UserType = 2;
user.Mobile = Mobile;
if (!string.IsNullOrEmpty(hidCity.Value))
{
DataTable dtCity = new DAL.Views.V_Citys().Open("ID", "City='" + hidCity.Value.Substring(0, hidCity.Value.Length - 1) + "'", "");
if (dtCity != null && dtCity.Rows.Count == 1)
{
user.CityID = Shove._Convert.StrToInt(dtCity.Rows[0]["ID"].ToString(), 1);
}
}
dt = new DAL.Tables.T_Users().Open("", "id=" + Shove._Web.Utility.GetRequest("CID") + " and Name='" + Shove._Web.Utility.GetRequest("CN") + "'", "");
if ((dt != null) && (dt.Rows.Count == 1))
{
CommenderID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("CID"), -1);
}
user.CommenderID = CommenderID;
user.CpsID = CpsID;
user.Memo = Memo;
string ReturnDescription = "";
int Result = user.Add(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("会员注册不成功:" + ReturnDescription);
Shove._Web.JavaScript.Alert(this, ReturnDescription);
return;
}
Result = user.Login(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("注册成功后登录失败:" + ReturnDescription);
Shove._Web.JavaScript.Alert(this, ReturnDescription);
//.........这里部分代码省略.........
示例6: LoadProjectUsers
internal static Users LoadProjectUsers(Project p)
{
if (p.ID != "")
{
SqlCommand cmd = new SqlCommand("select u.Firstname, u.Lastname, u.Username, u.Email from UserProject as up inner join [User] as u on up.Username = u.Username where ProjectID = @pid", Main.GetConnection());
cmd.Parameters.Add(new SqlParameter("pid", p.ID));
SqlDataReader reader = cmd.ExecuteReader();
Users projectUsers = new Users();
while (reader.Read())
{
User u = new User();
u.Firstname = reader.GetString(0);
u.Lastname = reader.GetString(1);
u.Username = reader.GetString(2);
u.Email = reader.GetString(3);
projectUsers.Add(u);
}
return projectUsers;
}
else return null;
}
示例7: btnReg_Click
protected void btnReg_Click(object sender, EventArgs e)
{
if (this.CheckCodeReg.Visible)
{
if (this.tbRegCheckCode.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
if (!this.ShoveCheckCode2.Valid(this.tbRegCheckCode.Text.Trim()))
{
JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
long num = -1L;
long num2 = -1L;
string pID = "";
FirstUrl url = new FirstUrl();
string str2 = url.Get();
if (!str2.StartsWith("http://"))
{
char ch = '?';
str2 = ("http://" + str2).Split(ch.ToString().ToCharArray())[0];
}
DataTable table = new Tables.T_Cps().Open("id, [ON], [Name]", "SiteID = " + base._Site.ID.ToString() + " and( DomainName = '" + str2 + "' or DomainName='" + Shove._Web.Utility.GetUrl() + "')", "");
if (_Convert.StrToLong(url.CpsID, -1L) > 0L)
{
num = _Convert.StrToLong(url.CpsID, -1L);
}
else if ((table != null) && (table.Rows.Count > 0))
{
num = _Convert.StrToLong(table.Rows[0]["ID"].ToString(), -1L);
pID = url.PID;
}
Thread.Sleep(500);
string str3 = this.tbRegUserName.Text.Trim();
string str4 = this.tbFormPassword.Text.Trim();
this.tbPassword2.Text.Trim();
string str5 = this.tbEmail.Text.Trim();
string str6 = this.tbRealityName.Text.Trim();
Users users = new Users(base._Site.ID)
{
Name = str3,
Password = str4,
Email = str5,
RealityName = str6,
UserType = 2,
CommenderID = num2,
CpsID = num,
Memo = pID
};
string returnDescription = "";
if (users.Add(ref returnDescription) < 0)
{
new Log("Users").Write("会员注册不成功:" + returnDescription);
JavaScript.Alert(this, returnDescription);
}
else if (users.Login(ref returnDescription) < 0)
{
new Log("Users").Write("注册成功后登录失败:" + returnDescription);
JavaScript.Alert(this, returnDescription);
}
else
{
base.Response.Redirect("UserRegSuccess.aspx");
}
}
示例8: btnReg_Click
protected void btnReg_Click(object sender, EventArgs e)
{
if (!cbAgree.Checked)
{
Shove._Web.JavaScript.Alert(this.Page, "必须同意注册协议!");
return;
}
if (CheckCode.Visible)
{
if (tbCheckCode.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
else
{
if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
}
string url = tbWebUrl.Text;
if (!url.StartsWith("http://"))
{
url = "http://" + url;
}
Regex regex = new Regex(@"([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
Match m = regex.Match(url);
if (!m.Success && url.IndexOf("http") == 0)
{
Shove._Web.JavaScript.Alert(this.Page, "网址填写错误");
return;
}
double scale = scale = _Site.SiteOptions["Opt_CpsBonusScale"].ToDouble(0);
if (_User == null) //没有登录注册
{
Users user = new Users(_Site.ID);
user.Name = tbUserName.Text.Trim();
user.Password = tbPassword.Text.Trim();
user.Email = tbEmail.Text.Trim();
user.RealityName = tbRealyName.Text.Trim();
user.Mobile = tbPhone.Text.Trim();
user.QQ = tbQQ.Text.Trim();
user.UserType = 2;
string ReturnDescription = "";
long Result = user.Add(ref ReturnDescription);
if (Result < 0)
{
Shove._Web.JavaScript.Alert(this, ReturnDescription);
return;
}
//登录
Result = user.Login(ref ReturnDescription);
if (Result < 0)
{
Shove._Web.JavaScript.Alert(this, ReturnDescription);
return;
}
user.cps.BonusScale = scale;
user.cps.ON = true;
user.cps.ResponsiblePerson = tbRealyName.Text.Trim();
user.cps.ContactPerson = tbRealyName.Text.Trim();
user.cps.Mobile = tbPhone.Text.Trim();
user.cps.Email = tbEmail.Text.Trim();
user.cps.QQ = tbQQ.Text.Trim();
user.cps.Type = Shove._Convert.StrToShort(ddlCpsType.SelectedValue, 1);
user.cps.OwnerUserID = user.ID;
user.cps.Url = tbWebUrl.Text.Trim();
user.cps.Name = tbSiteName.Text.Trim();
user.cps.MD5Key = tbMD5.Text.Trim();
user.cps.Content = "";
ReturnDescription = "";
Result = user.cps.Try(ref ReturnDescription);
if (Result < 0)
{
Shove._Web.JavaScript.Alert(this, ReturnDescription);
//.........这里部分代码省略.........
示例9: btnOK_Click
protected void btnOK_Click(object sender, EventArgs e)
{
if (this.tbName.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入用户名。");
}
else if (this.tbPassword.Text == "")
{
JavaScript.Alert(this.Page, "请输入用户密码。");
}
else if (this.tbPassword.Text.Length < 6)
{
JavaScript.Alert(this.Page, "用户密码长度不足 6 位。");
}
else if (this.tbPassword.Text != this.tbPassword2.Text)
{
JavaScript.Alert(this.Page, "输入的两次密码不一致。");
}
else
{
if (this.CheckCode.Visible)
{
if (this.tbCheckCode.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
if (!this.ShoveCheckCode1.Valid(this.tbCheckCode.Text.Trim()))
{
JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
Thread.Sleep(500);
Sites sites = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];
if (sites != null)
{
long num = -1L;
string str = new FirstUrl().Get();
if (!str.StartsWith("http://"))
{
char ch = '?';
str = ("http://" + str).Split(ch.ToString().ToCharArray())[0];
}
DataTable table = new Tables.T_Cps().Open("id, [ON], [Name]", "SiteID = " + base._Site.ID.ToString() + " and DomainName = '" + str + "' or DomainName='" + Shove._Web.Utility.GetUrl() + "'", "");
if (((table != null) && (table.Rows.Count > 0)) && _Convert.StrToBool(table.Rows[0]["ON"].ToString(), false))
{
num = _Convert.StrToLong(table.Rows[0]["ID"].ToString(), -1L);
}
string str2 = Shove._Web.Utility.GetRequest("real_name").Trim();
Users users = new Users(sites.ID)
{
Name = this.tbName.Text.Trim(),
RealityName = str2,
Password = this.tbPassword.Text.Trim(),
PasswordAdv = this.tbPassword.Text.Trim(),
CityID = 1,
Email = this.labAccount.Text.Trim(),
ComeFrom = 4,
UserType = 2,
CpsID = num,
CommenderID = -1L
};
string returnDescription = "";
if (users.Add(ref returnDescription) < 0)
{
JavaScript.Alert(this.Page, returnDescription + "用户添加失败");
}
else
{
Member member = new Member();
string realityName = "";
long num2 = member.Query(this.labAccount.Text, ref realityName);
if (num2 < 0L)
{
JavaScript.Alert(this.Page, "输入的账号在支付宝网站验证失败(不存在账号或者网络通讯故障," + num2.ToString() + "),请重新填写一个账号名称。");
}
else
{
new Tables.T_Users { AlipayID = { Value = this.tbAlipayID.Text }, AlipayName = { Value = this.labAccount.Text }, isAlipayNameValided = { Value = true } }.Update("[ID] = " + users.ID.ToString());
users.LoginDirect(ref returnDescription);
long buyID = -1L;
if ((base.Request.Url.AbsoluteUri.IndexOf("?BuyID") > 0) && (base.Request.Url.AbsoluteUri.IndexOf("&") > 0))
{
buyID = _Convert.StrToLong(HttpUtility.UrlDecode(base.Request.Url.AbsoluteUri).Split(new char[] { '?' })[1].Split(new char[] { '&' })[0].Replace("BuyID=", ""), -1L);
}
if (buyID > 0L)
{
this.GoBuy(buyID);
}
else
{
base.Response.Redirect("UserRegSuccess.aspx", true);
}
}
}
}
}
}
示例10: btnOK_Click
//.........这里部分代码省略.........
Shove._Web.JavaScript.Alert(this.Page, "请输入用户密码。");
return;
}
if (tbPassword.Text.Length < 6)
{
Shove._Web.JavaScript.Alert(this.Page, "用户密码长度不足 6 位。");
return;
}
if (tbPassword.Text != tbPassword2.Text)
{
Shove._Web.JavaScript.Alert(this.Page, "输入的两次密码不一致。");
return;
}
if (tbEmail.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入您的邮箱。");
return;
}
if (!Shove._String.Valid.isEmail(tbEmail.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page,"请正确输入您的邮箱。");
return;
}
if (CheckCode.Visible)
{
if (tbCheckCode.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
else
{
if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
}
#endregion
System.Threading.Thread.Sleep(500);
Sites site = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];
if (site == null)
{
return;
}
Users user = new Users(site.ID);
user.Name =Shove._Web.Utility.FilteSqlInfusion(tbName.Text.Trim());
user.RealityName = Shove._Web.Utility.FilteSqlInfusion(tbTrueName.Text.Trim());
user.Password = Shove._Web.Utility.FilteSqlInfusion(tbPassword.Text.Trim());
user.PasswordAdv = Shove._Web.Utility.FilteSqlInfusion(tbPassword.Text.Trim());
user.CityID = 1;
user.ComeFrom = 4;
user.Email = Shove._Web.Utility.FilteSqlInfusion(tbEmail.Text.Trim());
user.isEmailValided = true;
user.QQ = tbQQID.Text.Trim();
user.UserType = 2;
user.CommenderID = -1;
user.isQQValided = true;
string ReturnDescription = "";
int UserID = user.Add(ref ReturnDescription);
if (UserID < 0)
{
Shove._Web.JavaScript.Alert(this.Page, ReturnDescription + "用户添加失败");
return;
}
int Result = user.Login(ref ReturnDescription);
if (Result < 0)
{
new Log("Users").Write("注册成功后登录失败:" + ReturnDescription);
Shove._Web.JavaScript.Alert(this, ReturnDescription);
return;
}
Response.Redirect("UserRegSuccess.aspx",true);
}
示例11: Lookup
public Users Lookup(List<long> UserIdList)
{
// Lookup function is limited to 100 id's at a time
List<string> Lookups = new List<string>();
for (int i = 0; i < UserIdList.Count(); i += 100)
{
var q = (from u in UserIdList
select u).Skip(i).Take(100);
Lookups.Add(string.Join(",", q.ToArray()));
}
var user = new UserClient(CurrentUserId);
var results = new List<WebClientResult<Users>>();
var list = new Users();
foreach (string IdSet in Lookups)
{
WebClientResult<Users> usersListReturn = user.Lookup(IdSet, null);
foreach (var u in usersListReturn.Object)
{
list.Add(u);
}
}
return list;
}
示例12: FindAllUsersAsync
private Users FindAllUsersAsync()
{
var usersVar = new Users
{
new User()
{
Id = 1,
FirstName = "John",
LastName = "Smith",
Password = "passwordfill",
UserName= "[email protected]"
},
new User()
{
Id = 2,
FirstName = "Bonnie",
LastName = "Skelly",
Password = "(206) 555 7301",
UserName = "[email protected]"
},
new User()
{
Id = 3,
FirstName = "Dana",
LastName = "Birkby",
Password = "(425) 555 7492",
UserName = "[email protected]"
},
new User()
{
Id = 4,
FirstName = "David",
LastName = "Probst",
Password = "(425) 555 2836",
UserName = "[email protected]"
},
new User()
{
Id = 4,
FirstName = "Rainaldo",
LastName = "Crosboune",
Password = "(425) 555 2836",
UserName = "[email protected]"
},
};
for (int i = 0; i < 1000000; i++)
{
usersVar.Add(new User()
{
Id = i,
FirstName = "FirstName " + i,
LastName = "LastName " + i,
Password = "sdfsdfs",
UserName = "username" + i
});
}
return usersVar;
}
示例13: btnOK_Click
protected void btnOK_Click(object sender, EventArgs e)
{
if (tbName.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入用户名。");
return;
}
if (string.IsNullOrEmpty(tbRealityName.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page, "请输入真实姓名。");
return;
}
if (CheckCode.Visible)
{
if (tbCheckCode.Text.Trim() == "")
{
Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
else
{
if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
{
Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
}
System.Threading.Thread.Sleep(500);
Sites site = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];
if (site == null)
{
return;
}
long CpsID = -1;
string URL = new FirstUrl().Get();
if (!URL.StartsWith("http://"))
{
URL = "http://" + URL;
URL = URL.Split('?'.ToString().ToCharArray())[0];
}
DataTable dt = new DAL.Tables.T_Cps().Open("id, [ON], [Name]", "SiteID = " + _Site.ID.ToString() + " and DomainName = '" + URL + "' or DomainName='" + Shove._Web.Utility.GetUrl() + "'", "");
if ((dt != null) && (dt.Rows.Count > 0))
{
if (Shove._Convert.StrToBool(dt.Rows[0]["ON"].ToString(), false))
{
CpsID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), -1);
}
}
string Password = GetRandPassword();
Users user = new Users(site.ID);
user.Name = tbName.Text.Trim();
user.RealityName = tbRealityName.Text.Trim();
user.Password = Password;
user.PasswordAdv = Password;
user.CityID = 1;
user.Email = labAccount.Text.Trim();
user.ComeFrom = 4;
user.UserType = 2;
user.CpsID = CpsID;
user.CommenderID = -1;
string ReturnDescription = "";
if (user.Add(ref ReturnDescription) < 0)
{
Shove._Web.JavaScript.Alert(this.Page, ReturnDescription + "用户添加失败");
return;
}
DAL.Tables.T_Users T_Users = new DAL.Tables.T_Users();
T_Users.AlipayName.Value = labAccount.Text;
T_Users.AlipayID.Value = hidUserID.Value;
T_Users.isAlipayNameValided.Value = true;
T_Users.Update("[ID] = " + user.ID.ToString());
user.LoginDirect(ref ReturnDescription);
this.Response.Redirect("UserRegSuccess.aspx", true);
}
示例14: FindAll
public Users FindAll(int buId, int userId)
{
MySqlCommand.CommandType = CommandType.StoredProcedure;
MySqlCommand.CommandText = FindAllStoredProcedure;
MySqlCommand.Parameters.Clear();
MySqlCommand.Parameters.AddWithValue("buid", userId);
MySqlCommand.Parameters.AddWithValue("userid", userId);
MySqlCommand.Parameters.Add(new MySqlParameter("@result", MySqlDbType.Int32));
MySqlCommand.Parameters["@result"].Direction = ParameterDirection.Output;
MySqlDataAdapter.SelectCommand = MySqlCommand;
MySqlDataAdapter.Fill(UserDataSet);
//Now lets return buis
var users = new Users();
DataTable dataTable = UserDataSet.Tables[0]; // Only 1 table
for (var i = 0; i < dataTable.Rows.Count; i++)
{
#region Add to list
users.Add(new User
{
BuId =
{
DataValue = Int32.Parse(dataTable.Rows[i][(int)UserTableDefinition.BuId].ToString())
},
UserId =
{
DataValue = Int32.Parse(dataTable.Rows[i][(int)UserTableDefinition.UserId].ToString())
},
UserName =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.UserName].ToString())
},
Password =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Password].ToString())
},
Status =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Status].ToString())
},
JobTitle =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.JobTitle].ToString())
},
FirstName =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.FirstName].ToString())
},
MiddleName =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.MiddleName].ToString())
},
LastName =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.LastName].ToString())
},
DateOfBirth =
{
DataValue = DateTime.Parse((dataTable.Rows[i][(int)UserTableDefinition.DateOfBirth].ToString()))
},
EmailAddress =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.EmailAddress].ToString())
},
ContactNum1 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.ContactNum1].ToString())
},
ContactNum2 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.ContactNum2].ToString())
},
ContactNum3 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.ContactNum3].ToString())
},
Address1 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Address1].ToString())
},
Address2 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Address2].ToString())
},
Address3 =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Address3].ToString())
},
Parish =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Parish].ToString())
},
Gender =
{
DataValue = (dataTable.Rows[i][(int)UserTableDefinition.Gender].ToString())
},
PhotoPath =
{
DataValue = GetAbsoluteFilePath(dataTable.Rows[i][(int)UserTableDefinition.PhotoPath].ToString())
//.........这里部分代码省略.........
示例15: btnOK_Click
protected void btnOK_Click(object sender, EventArgs e)
{
if (this.tbName.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入用户名。");
}
else if (this.tbTrueName.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入真实姓名。");
}
else if (this.tbPassword.Text == "")
{
JavaScript.Alert(this.Page, "请输入用户密码。");
}
else if (this.tbPassword.Text.Length < 6)
{
JavaScript.Alert(this.Page, "用户密码长度不足 6 位。");
}
else if (this.tbPassword.Text != this.tbPassword2.Text)
{
JavaScript.Alert(this.Page, "输入的两次密码不一致。");
}
else if (this.tbEmail.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入您的邮箱。");
}
else if (!_String.Valid.isEmail(this.tbEmail.Text.Trim()))
{
JavaScript.Alert(this.Page, "请正确输入您的邮箱。");
}
else
{
if (this.CheckCode.Visible)
{
if (this.tbCheckCode.Text.Trim() == "")
{
JavaScript.Alert(this.Page, "请输入验证码!");
return;
}
if (!this.ShoveCheckCode1.Valid(this.tbCheckCode.Text.Trim()))
{
JavaScript.Alert(this.Page, "验证码输入有误!");
return;
}
}
Thread.Sleep(500);
Sites sites = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];
if (sites != null)
{
Users users = new Users(sites.ID)
{
Name = Shove._Web.Utility.FilteSqlInfusion(this.tbName.Text.Trim()),
RealityName = Shove._Web.Utility.FilteSqlInfusion(this.tbTrueName.Text.Trim()),
Password = Shove._Web.Utility.FilteSqlInfusion(this.tbPassword.Text.Trim()),
PasswordAdv = Shove._Web.Utility.FilteSqlInfusion(this.tbPassword.Text.Trim()),
CityID = 1,
ComeFrom = 4,
Email = Shove._Web.Utility.FilteSqlInfusion(this.tbEmail.Text.Trim()),
isEmailValided = true,
QQ = this.tbQQID.Text.Trim(),
UserType = 2,
CommenderID = -1L,
isQQValided = true
};
string returnDescription = "";
if (users.Add(ref returnDescription) < 0)
{
JavaScript.Alert(this.Page, returnDescription + "用户添加失败");
}
else if (users.Login(ref returnDescription) < 0)
{
new Log("Users").Write("注册成功后登录失败:" + returnDescription);
JavaScript.Alert(this, returnDescription);
}
else
{
base.Response.Redirect("UserRegSuccess.aspx", true);
}
}
}
}