示例#1
0
        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));
        }
示例#2
0
        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);
            }
        }
示例#7
0
 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;
     }
 }
示例#8
0
        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;
            }
        }
示例#9
0
        public BaseItem(Cxt cxt, DataRow row)
        {
            Cxt = cxt;

            DataRow = row;
        }
示例#10
0
 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;
        }
示例#13
0
 public FilterItems(Cxt cxt)
 {
     Cxt       = cxt;
     DataTable = GetFilterItemsTable();
 }
 public ServiceCategory(Cxt cxt, BaseItem item)
     : base(cxt, item)
 {
 }
示例#15
0
        public Team(Cxt cxt, DataRow row)
        {
            Cxt = cxt;

            DataRow = row;
        }
示例#16
0
 public static Team GetTeamById(Cxt cxt, int teamID)
 {
     return(new Team(cxt, BaseCollection.SelectItem(InfiChess.Team, teamID)));
 }
示例#17
0
 public Team(Cxt cxt, BaseItem item)
     : base(cxt, item)
 {
 }
示例#18
0
 public Team(Cxt cxt, int id)
     : base(cxt, id)
 {
 }
示例#19
0
        public BaseItem(Cxt cxt, int id)
        {
            Cxt = cxt;

            Load(id);
        }
        public TournamentPrize(Cxt cxt, DataRow row)
        {
            Cxt = cxt;

            DataRow = row;
        }
示例#21
0
        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();
            }
        }
示例#23
0
        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)));
 }
示例#25
0
        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)
 {
 }
示例#27
0
        public static bool Exists(Cxt cxt, string userName)
        {
            User user = User.GetUser(cxt, userName);

            return !user.IsNew;
        }
 public BaseProcess(Cxt cxt)
 {
     Cxt = cxt;
 }
示例#29
0
        public BaseItem(Cxt cxt, BaseItem item)
        {
            Cxt = cxt;

            DataRow = item.DataRow;
        }
示例#30
0
        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)
 {
 }
示例#32
0
 public User(Cxt cxt, int id)
     : base(cxt, id)
 {
 }
示例#33
0
        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);
                }
            }
        }
示例#34
0
        public User(Cxt cxt, DataRow row)
        {
            Cxt = cxt;

            DataRow = row;
        }
示例#35
0
 public Task(Cxt cxt, BaseItem item)
     : base(cxt, item)
 {
 }
示例#36
0
        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);
        }
示例#38
0
        public User(Cxt cxt, string userName)
        {
            Cxt = cxt;

            Load(userName);
        }
 public TournamentPrize(Cxt cxt, BaseItem item)
     : base(cxt, item)
 {
 }
示例#40
0
 public Task(Cxt cxt, int id)
     : base(cxt, id)
 {
 }
示例#41
0
 public FilterItem(Cxt cxt, int id)
     : base(cxt, id)
 {
 }
 public TableItem(Cxt cxt)
 {
     this.cxt = cxt;
 }
示例#43
0
 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);
        }
示例#45
0
 public FilterItem(Cxt cxt, DataRow row)
 {
     Cxt     = cxt;
     DataRow = row;
 }
 public ServiceCategory(Cxt cxt, int id)
     : base(cxt, id)
 {
 }
示例#47
0
 public BaseProcess(Cxt cxt)
 {
     Cxt = cxt;
 }
        public ServiceCategory(Cxt cxt, int serviceID, int categoryID)
        {
            Cxt = cxt;

            Load(serviceID, categoryID);
        }
示例#49
0
 public CxtParam(Cxt cxt, bool viewStateOnly)
 {
     Cxt           = cxt;
     ViewStateOnly = viewStateOnly;
 }