public static void Write(Cxt cxt, Exception ex, string message) { if (ex == null) { ex = new Exception("Exception object was null. Using this dummy as replacement."); } Write(cxt, Log.Error, Log.System, AppException.GetError(ex, message)); }
public static void Write(Cxt cxt, string type, string category, string message) { Log log = new Log(cxt, 0); log.Type = type; log.Category = category; log.Message = message; log.Save(); }
protected void Page_Load(object sender, EventArgs e) { Cxt = new Cxt(ViewState); if (!Cxt.Service.IsNew) { Cxt.Service.Init(); } guc12.InitControl(); guc22.InitControl(); fuc1.InitControl(); }
public ItemAttribute(Cxt cxt, int itemID, int attributeID, bool loadFromParent) { Cxt = cxt; if (loadFromParent) { LoadFromParent(itemID, attributeID); } else { Load(itemID, attributeID); } }
public static string Value(Cxt cxt, string valueSource) { switch (GetName(valueSource)) { case "User.ID": return cxt.User.ID.ToString(); case "User.Name": return cxt.User.Name; case "User.UserName": return cxt.User.UserName; case "DateTime.Now": return UStr.Timestamp; default: throw new Exception("Invalid value name:" + valueSource); } }
public static string Text(Cxt cxt, string valueSource, string value) { switch (GetName(valueSource)) { case "User.ID": return User.GetUser(cxt, value).Name; case "User.Name": return User.GetUser(cxt, value).Name; case "User.UserName": return User.GetUser(cxt, value).UserName; case "DateTime.Now": return value; default: throw new Exception("Invalid value name:" + valueSource); } }
public static void HandleRequestType(Cxt cxt, AccountRequestTypeE RequestType, string userName) { switch (RequestType) { case AccountRequestTypeE.ActivateEmail: SendActivationEmail(cxt, userName); break; case AccountRequestTypeE.ActivateAccount: ActivateUser(cxt, userName); break; default: break; } }
public static void ActivateUser(Cxt Cxt, string userName) { User user = User.GetUser(Cxt, userName); if (user.IsNew) { AppException.Throw(Msg.UserNameNotExists(userName)); } switch (user.StatusID) { case StatusE.Active: AppException.Throw("Account is already active. <a href='http://RafeySoft.com/Web/Page/Account/SignIn.aspx'>Sign In</a> now!"); break; case StatusE.Disabled: AppException.Throw("Account is disabled."); break; case StatusE.Inactive: case StatusE.Deleted: user.StatusID = StatusE.Active; user.Save(); AppException.Throw("Account activated successfully. <a href='http://RafeySoft.com/Web/Page/Account/SignIn.aspx'>Sign In</a> now!"); break; } }
public BaseItem(Cxt cxt, DataRow row) { Cxt = cxt; DataRow = row; }
public User(Cxt cxt, BaseItem item) : base(cxt, item) { }
public AttributeType(Cxt cxt, int id) : base(cxt, id) { }
public AttributeType(Cxt cxt, Attribute attribute) { Cxt = cxt; Attribute = attribute; }
public FilterItems(Cxt cxt) { Cxt = cxt; DataTable = GetFilterItemsTable(); }
public ServiceCategory(Cxt cxt, BaseItem item) : base(cxt, item) { }
public Team(Cxt cxt, DataRow row) { Cxt = cxt; DataRow = row; }
public static Team GetTeamById(Cxt cxt, int teamID) { return(new Team(cxt, BaseCollection.SelectItem(InfiChess.Team, teamID))); }
public Team(Cxt cxt, BaseItem item) : base(cxt, item) { }
public Team(Cxt cxt, int id) : base(cxt, id) { }
public BaseItem(Cxt cxt, int id) { Cxt = cxt; Load(id); }
public TournamentPrize(Cxt cxt, DataRow row) { Cxt = cxt; DataRow = row; }
public FilterItems(Cxt cxt, BaseCollection items) { Cxt = cxt; DataTable = items.DataTable; }
private static void UpdateStats(Cxt cxt, BaseCollection items) { for (int i = 0; i < items.Count; i++) { ServiceCategory c = new ServiceCategory(cxt, items[i].GetColInt32("ServiceID"), items[i].GetColInt32("CategoryID")); c.ConfigAttributes.Set(AttributeE.ServiceCategoryItemCount, items[i].GetCol("ItemCount")); c.ConfigAttributes.Save(); } }
public FilterItems(Cxt cxt, DataTable table) { Cxt = cxt; DataTable = table; }
public static TournamentPrize GetTournamentPrizeID(Cxt cxt, int TournamentPrizeID) { return(new TournamentPrize(cxt, BaseCollection.SelectItem(InfiChess.TournamentPrize, TournamentPrizeID))); }
public static bool Login(Cxt cxt, string userName, string password) { User user = User.GetUser(cxt, userName, password); switch (user.StatusID) { case StatusE.Disabled: AppException.Throw("Account is disabled."); break; case StatusE.Inactive: case StatusE.Deleted: AppException.Throw("Account is inactive, please <a href='" + UWeb.GetUrlActivationEmail(user.UserName) + "'>click here</a> to receive activation email."); break; default: break; } if (!user.IsNew && user.Roles.Length == 0) { AppException.Throw("Can not sign in, " + UStr.B(userName) + " has not assigned any role."); } return !user.IsNew; }
public AttributeType(Cxt cxt, BaseItem item) : base(cxt, item) { }
public static bool Exists(Cxt cxt, string userName) { User user = User.GetUser(cxt, userName); return !user.IsNew; }
public BaseProcess(Cxt cxt) { Cxt = cxt; }
public BaseItem(Cxt cxt, BaseItem item) { Cxt = cxt; DataRow = item.DataRow; }
public static User GetUser(Cxt cxt, string userName) { DataTable table = BaseCollection.ExecuteSql(RsOneItemTable.User, "select * from [User] where LOWER(UserName)=LOWER(@p1)", userName); User user = null; if (table.Rows.Count > 0) { user = new User(cxt, table.Rows[0]); } else { user = new User(); } return user; }
public TournamentPrize(Cxt cxt, int id) : base(cxt, id) { }
public User(Cxt cxt, int id) : base(cxt, id) { }
public static void SendActivationEmail(Cxt cxt) { BaseCollection items = BaseCollection.SelectItems(RsOneItemTable.User, "StatusID", 3); for (int i = 0; i < items.Count; i++) { if (UMail.Send(new User(cxt, items[i]), MailTemplateE.ActivateAccount) != MailVerifyResult.Ok) { System.Threading.Thread.Sleep(5000); } } }
public User(Cxt cxt, DataRow row) { Cxt = cxt; DataRow = row; }
public Task(Cxt cxt, BaseItem item) : base(cxt, item) { }
public static void SendActivationEmail(Cxt cxt, string userName) { User user = User.GetUser(cxt, userName); if (user.IsNew) { AppException.Throw(Msg.UserNameNotExists(userName)); } MailVerifyResult result = UMail.Send(user, MailTemplateE.ActivateAccount); if (result == MailVerifyResult.Ok) { AppException.Throw(Msg.ActivationEmailOk(userName)); } }
public static void UpdateStats(Cxt cxt) { string sql = ""; sql = "SELECT distinct CategoryID, ServiceID, COUNT(CategoryID) ItemCount FROM Item group by CategoryID, ServiceID"; BaseCollection items = BaseCollection.SelectItems(RsOneItemTable.Unknown, sql); UpdateStats(cxt, items); }
public User(Cxt cxt, string userName) { Cxt = cxt; Load(userName); }
public TournamentPrize(Cxt cxt, BaseItem item) : base(cxt, item) { }
public Task(Cxt cxt, int id) : base(cxt, id) { }
public FilterItem(Cxt cxt, int id) : base(cxt, id) { }
public TableItem(Cxt cxt) { this.cxt = cxt; }
public FilterItem(Cxt cxt, BaseItem item) : base(cxt, item) { }
public static void UpdateStats(Cxt cxt, int serviceID, int categoryID) { string sql = ""; sql = "SELECT CategoryID, ServiceID, COUNT(CategoryID) ItemCount FROM Item where ServiceID=@p1 AND CategoryID=@p2 group by CategoryID, ServiceID"; BaseCollection items = new BaseCollection(BaseCollection.ExecuteSql(RsOneItemTable.Unknown, sql, serviceID, categoryID)); UpdateStats(cxt, items); }
public FilterItem(Cxt cxt, DataRow row) { Cxt = cxt; DataRow = row; }
public ServiceCategory(Cxt cxt, int id) : base(cxt, id) { }
public ServiceCategory(Cxt cxt, int serviceID, int categoryID) { Cxt = cxt; Load(serviceID, categoryID); }
public CxtParam(Cxt cxt, bool viewStateOnly) { Cxt = cxt; ViewStateOnly = viewStateOnly; }