Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _cmdCtrl                 = FindControl("CommandCtrl") as CommandCtrl;
     _ph                      = FindControl("PlaceHolder1") as PlaceHolder;
     _cmdCtrl.OnCommand      += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);
     _cmdCtrl.State["Action"] = null;
 }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Data = AccountImpl.Instance.GetDeptInfo(Convert.ToInt32(Request.QueryString["DeptID"]));

            CommandCtrl cmdCtrl = FindControl("CommandCtrl1") as CommandCtrl;

            cmdCtrl.OnCommand += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);

            cmdCtrl.State["Data"] = Data;
        }
        private void cmdCtrl_OnCommand(string command, object data)
        {
            CommandCtrl cmdCtrl = FindControl("CommandCtrl1") as CommandCtrl;

            try
            {
                if (command == "Update")
                {
                    Hashtable info = data as Hashtable;
                    if (Request.Files["file_headimg"] != null && Request.Files["file_headimg"].InputStream.Length > 0)
                    {
                        String filename = String.Format("/{0}/pub/HeadIMG/{1}{2}", Info.ID, Guid.NewGuid().ToString().Replace("-", ""), Path.GetExtension(Request.Files["file_headimg"].FileName));
                        info["HeadIMG"] = filename;
                        string dirname = Path.GetDirectoryName(filename);
                        Directory.CreateDirectory(dirname);
                        File.SetAttributes(dirname, File.GetAttributes(dirname) | FileAttributes.Hidden);
                        using (System.IO.Stream stream = File.Open(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
                        {
                            byte[] buffer = new byte[4 * 1024];
                            while (true)
                            {
                                int c = Request.Files["file_headimg"].InputStream.Read(buffer, 0, buffer.Length);
                                if (c == 0)
                                {
                                    break;
                                }
                                stream.Write(buffer, 0, c);
                            }
                        }
                    }

                    Utility.FilterUserInfoHtml(info);
                    AccountImpl.Instance.UpdateUserInfo(Info.ID, info);
                    SessionManagement.Instance.SendToRelatedUsers(Info.ID, "GLOBAL:ACCOUNTINFO_CHANGED", Utility.RenderHashJson("Details", Info.DetailsJson));

                    cmdCtrl.State["Info"] = Info.DetailsJson;
                }
                else if (command == "ResetPassword")
                {
                    Hashtable info = data as Hashtable;
                    AccountImpl.Instance.ResetPassword(Info.ID, info["Password"].ToString());
                    cmdCtrl.State["Info"] = Info.DetailsJson;
                }
                else if (command == "ResetSelfPassword")
                {
                    Hashtable info = data as Hashtable;
                    AccountImpl.Instance.UpdateUserInfo(Info.ID, info);
                }
            }
            catch (Exception ex)
            {
                cmdCtrl.State["Action"]    = "Error";
                cmdCtrl.State["Exception"] = ex;
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _deptID  = Convert.ToInt32(Request.QueryString["DeptID"]);
            DeptInfo = AccountImpl.Instance.GetDeptInfo(_deptID);
            AccountInfo cu = ServerImpl.Instance.GetCurrentUser(Context);

            if (cu == null || !cu.IsAdmin)
            {
                throw new Exception("你没有权限访问该页面!");
            }

            _cmdCtrl            = FindControl("CommandCtrl") as CommandCtrl;
            _cmdCtrl.OnCommand += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _currentPage = Request.QueryString["CurrentPage"] == null ? 1 : Convert.ToInt32(Request.QueryString["CurrentPage"]);
            _isTemp      = Request.QueryString["IsTemp"] == null ? 0 : Convert.ToInt32(Request.QueryString["IsTemp"]);

            AccountInfo cu = ServerImpl.Instance.GetCurrentUser(Context);

            if (cu == null || !cu.IsAdmin)
            {
                throw new Exception("你没有权限访问该页面!");
            }

            _cmdCtrl                 = FindControl("CommandCtrl") as CommandCtrl;
            _cmdCtrl.OnCommand      += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);
            _cmdCtrl.State["Action"] = null;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Info = AccountImpl.Instance.GetUserInfo(Convert.ToInt32(Request.QueryString["ID"]));

            AccountInfo cu = ServerImpl.Instance.GetCurrentUser(Context);

            if (!(cu != null && (cu.IsAdmin || (Info.Type == 0 && cu.ID == Info.ID) || (Info.Type == 1 && cu.ID == Info.Creator))))
            {
                throw new Exception("你没有权限访问该页面!");
            }
            if (cu.IsAdmin && Info.ID != AccountImpl.AdminID)
            {
                Depts = AccountImpl.Instance.GetUserDepts(Info.ID);
                Control depts_ph = FindControl("PlaceHolderDepts");
                if (depts_ph != null)
                {
                    depts_ph.Visible = true;
                }
            }

            CommandCtrl cmdCtrl = FindControl("CommandCtrl1") as CommandCtrl;

            cmdCtrl.OnCommand += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);

            cmdCtrl.State["Info"] = Info.DetailsJson;

            Control prepwd_ph = FindControl("PrePasswordPH");

            if (prepwd_ph != null)
            {
                prepwd_ph.Visible = Info.ID == ServerImpl.Instance.GetUserID(Context);
            }

            Control resetpwd_ph = FindControl("PlaceHolderResetPwd");

            if (resetpwd_ph != null)
            {
                resetpwd_ph.Visible = !Info.IsTemp;
            }
        }
Example #7
0
        private void cmdCtrl_OnCommand(string command, object data)
        {
            CommandCtrl cmdCtrl = FindControl("CommandCtrl1") as CommandCtrl;

            try
            {
                if (command == "Update")
                {
                    Hashtable dept_info = data as Hashtable;
                    AccountImpl.Instance.UpdateDeptInfo(Convert.ToInt32(Data["ID"]), dept_info["Name"].ToString());
                    SessionManagement.Instance.NotifyResetListCache(3, false, true, null);
                    Data = AccountImpl.Instance.GetDeptInfo(Convert.ToInt32(Request.QueryString["DeptID"]));
                    cmdCtrl.State["Action"]   = "ResetDeptData";
                    cmdCtrl.State["DeptID"]   = DeptID;
                    cmdCtrl.State["DeptInfo"] = AccountImpl.Instance.GetDeptInfo(DeptID);
                }
            }
            catch (Exception ex)
            {
                cmdCtrl.State["Action"]  = "Alert";
                cmdCtrl.State["Message"] = ex.Message;
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _groupID = Convert.ToInt32(Request.QueryString["GroupID"]);
            AccountInfo groupInfo = Core.AccountImpl.Instance.GetUserInfo(_groupID);

            AccountInfo cu = ServerImpl.Instance.GetCurrentUser(Context);

            if (!(cu != null && (cu.IsAdmin || groupInfo.Type == 1 && cu.ID == groupInfo.Creator)))
            {
                throw new Exception("你没有权限访问该页面!");
            }

            _cmdCtrl            = FindControl("CommandCtrl") as CommandCtrl;
            _cmdCtrl.OnCommand += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);

            _cmdCtrl.State["Action"] = null;
            var bottom_ope = FindControl("BottomOpe");

            if (bottom_ope != null)
            {
                bottom_ope.Visible = cu.IsAdmin;
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AccountInfo cu = ServerImpl.Instance.GetCurrentUser(Context);

            _cmdCtrl                 = FindControl("CommandCtrl") as CommandCtrl;
            _cmdCtrl.OnCommand      += new CommandCtrl.OnCommandDelegate(cmdCtrl_OnCommand);
            _cmdCtrl.State["Action"] = null;
            if (!IsPostBack)
            {
                _cmdCtrl.State["IDS"]     = "";
                _cmdCtrl.State["Keyword"] = "";

                PlaceHolder ph1 = FindControl("PlaceHolder1") as PlaceHolder;
                ph1.Visible = false;
            }

            if (!String.IsNullOrEmpty(_cmdCtrl.State["IDS"].ToString()))
            {
                PreSelRows = AccountImpl.Instance.SearchUsers(_cmdCtrl.State["IDS"].ToString(), "MultiID");
            }

            (FindControl("PlaceHolder2") as PlaceHolder).Visible = PreSelRows != null && PreSelRows.Count > 0;
            (FindControl("PlaceHolder3") as PlaceHolder).Visible = !(PreSelRows != null && PreSelRows.Count > 0);
        }