Beispiel #1
0
        /// <summary>
        /// btnupdate click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            EyouSoft.BLL.SysStructure.BSys       bll     = new EyouSoft.BLL.SysStructure.BSys();
            EyouSoft.Model.SysStructure.MSysInfo sysInfo = new EyouSoft.Model.SysStructure.MSysInfo();
            sysInfo.SystemId = this.SysId;

            sysInfo = bll.GetSysInfo(this.SysId);

            #region get form values
            sysInfo.AdminInfo.UserName     = EyouSoft.Common.Utils.InputText(this.txtUsername.Value);
            sysInfo.AdminInfo.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord()
            {
                NoEncryptPassword = EyouSoft.Common.Utils.InputText(this.txtPassword.Value)
            };

            sysInfo.Domains       = this.GetSysDomains();
            sysInfo.ModuleIds     = this.GetBigPermissions();
            sysInfo.PartIds       = this.GetSmallPermissions();
            sysInfo.PermissionIds = this.GetThirdPermissions();
            sysInfo.Setting       = this.GetSetting();
            #endregion

            #region validate form
            string message      = string.Empty;
            bool   verifyResult = this.ValidateForm(sysInfo, out message);

            if (!verifyResult)
            {
                this.RegisterAlertAndRedirectScript(message, "");
                return;
            }
            #endregion

            int addResult = bll.UpdateSys(sysInfo);
            if (addResult == 1)
            {
                message = "子系统修改成功!";
                this.RegisterAlertAndRedirectScript(message, "systems.aspx");
            }
            else
            {
                message = "子系统修改失败!";
                this.RegisterAlertAndRedirectScript(message, "window.location.href");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 初始化系统信息
        /// </summary>
        private void InitSysInfo()
        {
            EyouSoft.BLL.SysStructure.BSys       bll     = new EyouSoft.BLL.SysStructure.BSys();
            EyouSoft.Model.SysStructure.MSysInfo sysInfo = bll.GetSysInfo(this.SysId);
            bll = null;

            if (sysInfo == null)
            {
                this.RegisterAlertAndRedirectScript("未找到指定的系统信息", "systems.aspx");
                return;
            }

            this.ltrSysName.Text = this.ltrTitleSysName.Text = sysInfo.SystemName;

            if (sysInfo.CompanyInfo != null)
            {
                this.ltrCompanyName.Text = sysInfo.CompanyInfo.CompanyName;
                this.ltrRealname.Text    = sysInfo.CompanyInfo.ContactName;
                this.ltrTelephone.Text   = sysInfo.CompanyInfo.ContactTel;
                this.ltrMobile.Text      = sysInfo.CompanyInfo.ContactMobile;
                this.ltrFax.Text         = sysInfo.CompanyInfo.ContactFax;
            }

            if (sysInfo.AdminInfo != null)
            {
                this.txtUsername.Value = sysInfo.AdminInfo.UserName;
                this.txtPassword.Value = sysInfo.AdminInfo.PassWordInfo.NoEncryptPassword;
                this.txtPassword.Attributes.Add("value", sysInfo.AdminInfo.PassWordInfo.NoEncryptPassword);
            }

            if (sysInfo.DepartmentInfo != null)
            {
                this.ltrHeadOfficeName.Text = sysInfo.DepartmentInfo.DepartName;
            }

            this.RegisterPrintDocumentScripts();
            this.InitPermissions();

            string script = string.Empty;

            if (sysInfo.Domains != null && sysInfo.Domains.Count > 0)
            {
                script = "var sysDomains={0};";
                script = string.Format(script, Newtonsoft.Json.JsonConvert.SerializeObject(sysInfo.Domains));
                this.RegisterScript(script);
            }
            else
            {
                this.RegisterScript("var sysDomains=[];");
            }

            if (sysInfo.Setting != null)
            {
                script = "var sysSetting={0};";
                script = string.Format(script, Newtonsoft.Json.JsonConvert.SerializeObject(sysInfo.Setting));
                this.RegisterScript(script);
            }
            else
            {
                this.RegisterScript("var sysSetting=null;");
            }

            script = "var sysPermissions={{first:{0},second:{1},third:{2}}};";
            script = string.Format(script, Newtonsoft.Json.JsonConvert.SerializeObject(sysInfo.ModuleIds)
                                   , Newtonsoft.Json.JsonConvert.SerializeObject(sysInfo.PartIds)
                                   , Newtonsoft.Json.JsonConvert.SerializeObject(sysInfo.PermissionIds));
            this.RegisterScript(script);
        }