protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["DeliveryBorker"] != null) { if (Session["DeliveryBorker"].GetType() != typeof(AdminAgent)) { _db = new AdminAgent(); } else { _db = (AdminAgent)Session["DeliveryBorker"]; } } else { _db = new AdminAgent(); } _db._Top = 1; _db._PageSize = 1000; _db._Flag = "C"; GetDeliveryMethod(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } if (Session["SelectedBookOut"] != null) { SelectedBookOutDT = (DataTable)Session["SelectedBookOut"]; } else { SelectedBookOutDT = new DataTable(); } } }
public Result Login([FromForm] string userName, [FromForm] string password, [FromForm] string code) { return(this.GetResultContent(AdminAgent.Instance().Login(userName, password, code, out string token), "登录成功", new { Token = token })); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["CatalogueBroker"] != null) { if (Session["CatalogueBroker"].GetType() != typeof(AdminAgent)) { _cb = new AdminAgent(); } else { _cb = (AdminAgent)Session["CatalogueBroker"]; } } else { _cb = new AdminAgent(); } _cb._Top = 1; _cb._PageSize = 1000; _cb._Flag = "C"; DisplayCatgeory(); GetCategoryNewId(); } }
/// <summary> /// 方法执行之前 /// </summary> /// <param name="context"></param> public override void OnActionExecuting(ActionExecutingContext context) { MethodInfo method = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo; bool isGuest = method.HasAttribute <GuestAttribute>(); bool isUser = context.HttpContext.GetAuth(out string userName, out string token); SystemAdmin admin = isUser ? AdminAgent.Instance().GetAdminInfo(token) : null; if (!isGuest && admin == null) { context.Result = (ContentResult) new Result(false, "请先登录", new { Error = ErrorType.Login }); } else if (method.HasAttribute <PermissionAttribute>() && !AdminAgent.Instance().IsPermission(admin?.ID, method.GetAttribute <PermissionAttribute>())) { string permission = method.GetAttribute <PermissionAttribute>(); context.Result = (ContentResult) new Result(false, $"没有权限:{ Permission.NAME.Get(permission, method.Name) }", new { Error = ErrorType.Permission }); } if (admin != null) { context.HttpContext.SetItem <IAccount>(admin); } }
/// <summary> /// 管理员操作日志 /// </summary> /// <param name="account"></param> /// <returns></returns> public static bool Log(this IAccount account, SystemAdminLog.LogType type, string content) { if (account == null) { return(false); } AdminAgent.Instance().SaveLog(account.ID, type, content); return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["ProfileMonitorBroker"] != null) { if (Session["ProfileMonitorBroker"].GetType() != typeof(AdminAgent)) { _pmb = new AdminAgent(); } else { _pmb = (AdminAgent)Session["ProfileMonitorBroker"]; } } else { _pmb = new AdminAgent(); } if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } _sb._CustomerId = _pmb._Id; firstNamelbl.Text = _pmb._FirstName; lastNamelbl.Text = _pmb._LastName; MiddleNamelbl.Text = _pmb._MiddleName; if (Session["SelectedBookOut"] != null) { SelectedBookOutDT = (DataTable)Session["SelectedBookOut"]; } else { SelectedBookOutDT = new DataTable(); } SelectedBookOutGV.DataSource = SelectedBookOutDT; SelectedBookOutGV.DataBind(); Calculate(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["ProfileMonitorBroker"] != null) { if (Session["ProfileMonitorBroker"].GetType() != typeof(AdminAgent)) { _pmb = new AdminAgent(); } else { _pmb = (AdminAgent)Session["ProfileMonitorBroker"]; } } else { _pmb = new AdminAgent(); } if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } if (Session["SelectedBookInDT"] != null) { SelectedBookInDT = (DataTable)Session["SelectedBookInDT"]; } else { SelectedBookInDT = new DataTable(); } supplierNamelbl.Text = _pmb._SupplierName; SelectedBookInGV.DataSource = SelectedBookInDT; SelectedBookInGV.DataBind(); Calculate(); } }
public Result Info() { SystemAdmin admin = AdminAgent.Instance().GetAdminInfo(this.AdminInfo); return(this.GetResultContent(new { admin.ID, admin.Name, admin.LoginAt, admin.LoginIP, IPAddress = IPAgent.GetAddress(admin.LoginIP), admin.Face })); }
public Result GetInfo([FromForm] int id) { SystemAdmin admin = AdminAgent.Instance().GetAdminInfo(id) ?? new SystemAdmin() { Permission = string.Empty }; XElement root = XElement.Parse(Resources.Permission); return(this.GetResultContent(new { admin.ID, admin.Status, admin.UserName, Permission = new JsonString(new AdminMenu(root, false, admin.Permission.Split(','))) })); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["CatalogueAgent"] != null) { _cb = (AdminAgent)Session["CatalogueAgent"]; } else { _cb = new AdminAgent(); } GetBookNewId(); DisplayCatgeory(); categoryDDL.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["CatalogueBroker"] != null) { if (Session["CatalogueBroker"].GetType() != typeof(AdminAgent)) { _cb = new AdminAgent(); } else { _cb = (AdminAgent)Session["CatalogueBroker"]; } } else { _cb = new AdminAgent(); } _cb._Top = 1; _cb._PageSize = 1000; _cb._Flag = "C"; DisplayCatgeory(); double vc = _cb._SelectAllCategoryCount; double vp = _cb._PageSize; double v = vc / vp; double m = Math.Ceiling(v); CategoryCount = m; indexToplbl.Text = _cb._Top.ToString(); CategoryPagesTop.Text = CategoryCount.ToString(); indexBottomlbl.Text = _cb._Top.ToString(); CategoryPagesBottom.Text = CategoryCount.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } if (Session["CatalogueBroker"] != null) { if (Session["CatalogueBroker"].GetType() != typeof(AdminAgent)) { _cb = new AdminAgent(); } else { _cb = (AdminAgent)Session["CatalogueBroker"]; } } else { _cb = new AdminAgent(); } Initialize(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["DeliveryBorker"] != null) { if (Session["DeliveryBorker"].GetType() != typeof(AdminAgent)) { _db = new AdminAgent(); } else { _db = (AdminAgent)Session["DeliveryBorker"]; } } else { _db = new AdminAgent(); } GetDeliveryMethodNewId(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["SearchBroker"] != null) { if (Session["SearchBroker"].GetType() != typeof(AdminAgent)) { _schb = new AdminAgent(); } else { _schb = (AdminAgent)Session["SearchBroker"]; } } else { _schb = new AdminAgent(); } if (Session["ProfileMonitorBroker"] != null) { if (Session["ProfileMonitorBroker"].GetType() != typeof(AdminAgent)) { _pmb = new AdminAgent(); } else { _pmb = (AdminAgent)Session["ProfileMonitorBroker"]; } } else { _pmb = new AdminAgent(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["CatalogueBroker"] != null) { if (Session["CatalogueBroker"].GetType() != typeof(AdminAgent)) { _cb = new AdminAgent(); } else { _cb = (AdminAgent)Session["CatalogueBroker"]; } } else { _cb = new AdminAgent(); } if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } if (Session["PurchaseBroker"] != null) { if (Session["PurchaseBroker"].GetType() != typeof(AdminAgent)) { _pb = new AdminAgent(); } else { _pb = (AdminAgent)Session["PurchaseBroker"]; } } else { _pb = new AdminAgent(); } if (Session["InteractionBroker"] != null) { if (Session["InteractionBroker"].GetType() != typeof(AdminAgent)) { _ib = new AdminAgent(); } else { _ib = (AdminAgent)Session["InteractionBroker"]; } } else { _ib = new AdminAgent(); } DisplayCatgeory(); SetBook(); bookId = _cb._Id; GetOrderOutByBook(); GetOrderInByBook(); GetShoppingCartbyBook(); GetWishListbyBook(); GetReviewbyBook(); GetRatebyBook(); } }
public Result SavePermission([FromForm] int id, [FromForm] SystemAdmin.AdminStatus?status, [FromForm] string permission) { return(this.GetResultContent(AdminAgent.Instance().SavePermission(id, status.Value, permission))); }
public Result ResetPassword([FromForm] int id) { return(this.GetResultContent(AdminAgent.Instance().ResetPassword(id))); }
public Result Menu() { AdminMenu menu = AdminAgent.Instance().GetAdminMenu(this.AdminInfo.ID); return(this.GetResultContent(menu.ToString())); }
public Result Logout() { AdminAgent.Instance().Logout(this.AdminInfo); return(this.GetResultContent(true)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (PaymentMethodDDl.SelectedValue == "Cash") { cashRow.Visible = true; ccGridViewRow.Visible = false; ccDetail.Visible = false; } if (Session["CatalogueBroker"] != null) { if (Session["CatalogueBroker"].GetType() != typeof(AdminAgent)) { _cb = new AdminAgent(); } else { _cb = (AdminAgent)Session["CatalogueBroker"]; } } else { _cb = new AdminAgent(); } if (Session["StockBroker"] != null) { if (Session["StockBroker"].GetType() != typeof(AdminAgent)) { _sb = new AdminAgent(); } else { _sb = (AdminAgent)Session["StockBroker"]; } } else { _sb = new AdminAgent(); } if (Session["ProfileMonitorBroker"] != null) { if (Session["ProfileMonitorBroker"].GetType() != typeof(AdminAgent)) { _pmb = new AdminAgent(); } else { _pmb = (AdminAgent)Session["ProfileMonitorBroker"]; } } else { _pmb = new AdminAgent(); } if (Session["SelectedBookOut"] != null) { SelectedBookOutDT = (DataTable)Session["SelectedBookOut"]; } else { SelectedBookOutDT = new DataTable(); } totallbl.Text = _sb._Total.ToString(); } }
public Result AddAdmin([FromForm] string userName, [FromForm] string password) { return(this.GetResultContent(AdminAgent.Instance().AddAdminInfo(userName, password))); }