本文整理汇总了C#中SocioBoard.Domain.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于SocioBoard.Domain命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
//public User GetById(int id)
//{
// using (ISession session = NHibernateHelper.OpenSession())
// {
// User user = session
// .CreateCriteria(typeof(User))
// .Add(Restrictions.Eq("UserId", id))
// .UniqueResult<User>();
// return user;
// }
//}
public static void Update(User user)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
int i = session.CreateQuery("Update User set ProfileUrl =:profileurl, UserName =: username , EmailId=:emailid,UserStatus=:userstatus,ExpiryDate=:expirydate,TimeZone=:timezone where Id = :twtuserid")
.SetParameter("twtuserid", user.Id)
.SetParameter("profileurl", user.ProfileUrl)
.SetParameter("username", user.UserName)
.SetParameter("emailid", user.EmailId)
.SetParameter("userstatus", user.UserStatus)
.SetParameter("expirydate", user.ExpiryDate)
.SetParameter("timezone", user.TimeZone)
.ExecuteUpdate();
transaction.Commit();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
}
}
示例2: getNewFollowing
public string getNewFollowing(User user, string profileId,int days)
{
string strTwtFollowing = string.Empty;
try
{
//SocioBoard.Domain.User user = (User)Session["LoggedUser"];
TwitterStatsRepository objtwtStatsRepo = new TwitterStatsRepository();
ArrayList arrTwtStats = objtwtStatsRepo.getTwitterStatsByIdDay(user.Id, profileId, days);
string str = string.Empty;
foreach (var item in arrTwtStats)
{
Array temp = (Array)item;
strTwtFollowing += (temp.GetValue(3).ToString()) + ",";
}
if (arrTwtStats.Count < 7)
{
for (int i = 0; i < 7 - arrTwtStats.Count; i++)
{
str += "0,";
}
}
strTwtFollowing = str + strTwtFollowing;
strTwtFollowing = strTwtFollowing.Substring(0, strTwtFollowing.Length - 1);
// strTwtArray += "]";
}
catch (Exception Err)
{
Console.Write(Err.Message.ToString());
}
return strTwtFollowing;
}
示例3: getAllUserPackageRelationByUserId
public List<UserPackageRelation> getAllUserPackageRelationByUserId(User objuser)
{
List<UserPackageRelation> alstFBAccounts = null;
try
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
alstFBAccounts = session.CreateQuery("from UserPackageRelation where UserId = : UserId")
.SetParameter("UserId", objuser.Id)
.List<UserPackageRelation>().ToList<UserPackageRelation>();
}
catch (Exception ex)
{
logger.Error("Error : " + ex.StackTrace);
Console.WriteLine("Error : " + ex.StackTrace);
}
}
}
}
catch (Exception ex)
{
logger.Error("Error : " + ex.StackTrace);
Console.WriteLine("Error : " + ex.StackTrace);
}
return alstFBAccounts;
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
User user = new User();
PackageRepository objPgeRepo = new PackageRepository();
ddlPackage.DataSource = objPgeRepo.getAllPackage();
ddlPackage.DataTextField = "PackageName";
ddlPackage.DataValueField = "PackageName";
ddlPackage.DataBind();
// ddlPackage.Items.Insert();
user = objUerRepo.getUsersById(Guid.Parse(Request.QueryString["id"].ToString()));
if (user != null)
{
txtName.Text = user.UserName;
txtEmail.Text = user.EmailId;
// txtdatepicker.Text = user.ExpiryDate.ToString();
datepicker.Text = user.ExpiryDate.ToString();
ddlPackage.SelectedValue = user.AccountType.ToString(); //user.PaymentStatus;
ddlStatus.SelectedValue = user.UserStatus.ToString();
}
}
catch (Exception ex)
{
logger.Error(ex.StackTrace);
}
}
}
示例5: AddUserRefreeRelation
public void AddUserRefreeRelation(User objReferee, User objReference)
{
try
{
logger.Error("Entered AddUserRefreeRelation");
UserRefRelation objUserRefRelation = new UserRefRelation();
UserRefRelationRepository objUserRefRelationRepository = new UserRefRelationRepository();
objUserRefRelation.Id = Guid.NewGuid();
objUserRefRelation.RefereeUserId = objReferee.Id;
objUserRefRelation.ReferenceUserId = objReference.Id;
objUserRefRelation.ReferenceUserEmail = objReference.EmailId;
objUserRefRelation.RefereeUserEmail = objReferee.EmailId;
objUserRefRelation.EntryDate = DateTime.Now;
objUserRefRelation.Status = "0";
objUserRefRelationRepository.AddUserRefRelation(objUserRefRelation);
logger.Error("Coming out of AddUserRefreeRelation");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
}
示例6: Add
/// <summary>
/// Add a new student in the database.
/// </summary>
/// <param name="student">Student object</param>
public static void Add(User user)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
session.Save(user);
transaction.Commit();
}
}
}
示例7: IsUserValid
/// <summary>
/// This function check Is User Exist or Not created by Abhay Kr 5-2-2014
/// </summary>
/// <param name="UserId"></param>
/// <returns>bool</returns>
public bool IsUserValid(string UserId, ref User user)
{
bool ret = false;
try
{
UserRepository objUserRepository = new UserRepository();
user = objUserRepository.getUsersById(Guid.Parse(UserId));
if (user != null)
ret = true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
return ret;
}
示例8: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
User user = new User();
user.Id =Guid.Parse(Request.QueryString["id"].ToString());
user.EmailId = txtEmail.Text;
user.ExpiryDate = Convert.ToDateTime(datepicker.Text);
user.UserName = txtName.Text;
user.UserStatus=1;
UserRepository.Update(user);
}
catch (Exception Err)
{
logger.Error(Err.Message);
Console.Write(Err.StackTrace);
}
}
示例9: SetPaymentStatus
public int SetPaymentStatus(Guid guid)
{
int res = 0;
try
{
UserRepository objUserRepository = new UserRepository();
User user = new Domain.User();
user.Id = guid;
user.PaymentStatus = "paid";
res=objUserRepository.UpdatePaymentStatusByUserId(user);
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.StackTrace);
}
return res;
}
示例10: Add
/// <summary>
/// Add a new student in the database.
/// </summary>
/// <param name="student">Student object</param>
public static void Add(User user)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
session.Save(user);
transaction.Commit();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
}
}
示例11: Register
public string Register(string EmailId, string Password, string AccountType, string FirstName, string LastName)
{
try
{
UserRepository userrepo = new UserRepository();
if (!userrepo.IsUserExist(EmailId))
{
Registration regObject = new Registration();
User user = new User();
user.AccountType = AccountType;
user.EmailId = EmailId;
user.CreateDate = DateTime.Now;
user.ExpiryDate = DateTime.Now.AddMonths(1);
user.Password = regObject.MD5Hash(Password);
user.PaymentStatus = "unpaid";
user.ProfileUrl = string.Empty;
user.TimeZone = string.Empty;
user.UserName = FirstName + " " + LastName;
user.UserStatus = 1;
user.Id = Guid.NewGuid();
UserRepository.Add(user);
MailSender.SendEMail(user.UserName,Password, EmailId);
return new JavaScriptSerializer().Serialize(user);
}
else
{
return "Email Already Exists";
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return "Something Went Wrong";
}
}
示例12: GetFollowersAgeWise
public string GetFollowersAgeWise(User user,int days)
{
string strTwtAgeArray = string.Empty;
try
{
TwitterStatsRepository objtwtStatsRepo = new TwitterStatsRepository();
object arrTwtStats = objtwtStatsRepo.getFollowersAgeCount(user.Id,days);
string[] arr = ((IEnumerable)arrTwtStats).Cast<object>().Select(x => x.ToString()).ToArray();
strTwtAgeArray="0,";
for (int i = 0; i < arr.Count(); i++)
{
strTwtAgeArray += arr[i] + ",";
}
strTwtAgeArray = strTwtAgeArray.Substring(0, strTwtAgeArray.Length - 1) ;
//strTwtArray += "]";
}
catch (Exception Err)
{
Console.Write(Err.Message.ToString());
}
return strTwtAgeArray;
}
示例13: ChangePassword
public string ChangePassword(string EmailId, string Password, string NewPassword)
{
try
{
User user = new User();
UserRepository userrepo = new UserRepository();
int i = userrepo.ChangePassword(NewPassword, Password, EmailId);
if (i == 1)
{
return "Password Changed Successfully";
}
else
{
return "Invalid EmailId";
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return "Please Try Again";
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string ret = string.Empty;
try
{
User objUser = new User();
UserRepository objUserRepository = new UserRepository();
scheduling objscheduling = new scheduling();
ScheduledMessage objScheduledMessage = new ScheduledMessage();
ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
List<ScheduledTracker> lstScheduledTracker = objScheduledMessageRepository.GetAllScheduledDetails();
foreach (ScheduledTracker item in lstScheduledTracker)
{
try
{
//List<ScheduledMessage> lstScheduledMessage = objScheduledMessageRepository.getAllMessagesOfUser(Guid.Parse(item._Id));
List<ScheduledMessage> lstUnsentScheduledMessage = objScheduledMessageRepository.getAllIUnSentMessagesOfUser(Guid.Parse(item._Id));
objUser = objUserRepository.getUsersById(Guid.Parse(item._Id));
ret += "<tr class=\"gradeX\"><td><a href=\"ScheduledMessageDetail.aspx?id=" + objUser.Id + "\">" + objUser.UserName + "</a></td><td>" + item._count + "</td><td>" + (item._count - lstUnsentScheduledMessage.Count()) + "</td><td>" + lstUnsentScheduledMessage.Count() + "</td></tr>";
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Response.Write(ret);
}
示例15: btnSignup_Click
protected void btnSignup_Click(object sender, ImageClickEventArgs e)
{
User user = new User();
UserRepository userrepo = new UserRepository();
try
{
if (txtPassword.Text == txtConfirmPassword.Text)
{
user.AccountType = "free";
user.CreateDate = DateTime.Now;
user.ExpiryDate = DateTime.Now.AddMonths(1);
user.Id = Guid.NewGuid();
user.UserName = txtUserName.Text;
user.Password = this.MD5Hash(txtPassword.Text);
user.EmailId = txtEmail.Text;
user.UserStatus = 1;
if (!userrepo.IsUserExist(user.EmailId))
{
UserRepository.Add(user);
MailSender.SendEMail(txtUserName.Text, txtPassword.Text, txtEmail.Text);
lblerror.Text = "registered successfully !" + "<a href=\"login.aspx\">login</a>";
}
else
{
lblerror.Text = "email already exists " + "<a href=\"login.aspx\">login</a>";
}
}
}
catch (Exception ex)
{
lblerror.Text = "Please Insert Correct Information";
Console.WriteLine(ex.StackTrace);
}
}