示例#1
0
        /// <summary>
        /// rptSys_ItemDataBound
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rptSys_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex == -1)
            {
                return;
            }
            Literal ltrHandles = (Literal)e.Item.FindControl("ltrHandles");

            if (ltrHandles == null)
            {
                return;
            }

            EyouSoft.Model.SysStructure.MSysInfo info = (EyouSoft.Model.SysStructure.MSysInfo)e.Item.DataItem;

            string s = string.Empty;

            if (info.SmsConfig == null || !info.SmsConfig.IsEnabled)
            {
                s += string.Format("<a href=\"system.aspx?sysid={0}&cid={1}\">开通短信</a>&nbsp;", info.SysId, info.CompanyId);
            }
            else
            {
                s += string.Format("<a href=\"smsprice.aspx?sysid={0}&cid={1}\">短信价格</a>&nbsp;", info.SysId, info.CompanyId);
            }

            if (info.OnlineStatus == EyouSoft.Model.EnumType.ComStructure.UserOnlineStatus.Online)
            {
                s += string.Format("<a href=\"systems.aspx?cid={0}&uid={1}&dotype=logout\">退出</a>&nbsp;", info.CompanyId, info.UserId);
            }

            ltrHandles.Text = s;
        }
示例#2
0
        /// <summary>
        /// 创建子系统
        /// </summary>
        /// <param name="info">系统信息业务实体</param>
        /// <returns></returns>
        /// <remarks>
        /// 1.创建系统信息
        /// 2.创建系统公司信息
        /// 3.创建管理员账号信息
        /// 4.创建管理员角色信息
        /// 5.创建总部信息
        /// 6.子系统基础数据
        /// 7.创建短信账号
        /// </remarks>
        public int CreateSys(EyouSoft.Model.SysStructure.MSysInfo info)
        {
            if (info == null)
            {
                return(0);
            }
            if (info.Password == null || string.IsNullOrEmpty(info.Password.NoEncryptPassword))
            {
                return(-1);
            }

            if (info.SmsConfig == null || !info.SmsConfig.IsEnabled)
            {
                info.SmsConfig = new EyouSoft.BLL.SmsStructure.BSmsAccount().CreateSmsAccount();
            }

            if (info.SmsConfig == null)
            {
                return(-2);
            }

            info.SysId     = Guid.NewGuid().ToString();
            info.CompanyId = Guid.NewGuid().ToString();
            info.UserId    = Guid.NewGuid().ToString();
            info.IssueTime = DateTime.Now;

            int dalRetCode = dal.CreateSys(info);

            if (dalRetCode == 1)
            {
                new EyouSoft.BLL.ComStructure.BComSetting().SetComSmsConfig(info.CompanyId, info.SmsConfig);
            }

            return(dalRetCode);
        }
示例#3
0
        /// <summary>
        /// 创建子系统
        /// </summary>
        /// <param name="info">系统信息业务实体</param>
        /// <returns></returns>
        /// <remarks>
        /// 1.创建系统信息
        /// 2.创建系统公司信息
        /// 3.创建管理员账号信息
        /// 4.创建管理员角色信息
        /// 5.创建总部信息
        /// 6.子系统基础数据
        /// </remarks>
        public int CreateSys(EyouSoft.Model.SysStructure.MSysInfo info)
        {
            DbCommand dc = _db.GetStoredProcCommand("proc_Sys_Create");

            _db.AddInParameter(dc, "SysId", DbType.AnsiStringFixedLength, info.SysId);
            _db.AddInParameter(dc, "SysName", DbType.String, info.SysName);
            _db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, info.CompanyId);
            _db.AddInParameter(dc, "FullName", DbType.String, info.FullName);
            _db.AddInParameter(dc, "Telephone", DbType.String, info.Telephone);
            _db.AddInParameter(dc, "Mobile", DbType.String, info.Mobile);
            _db.AddInParameter(dc, "UserId", DbType.AnsiStringFixedLength, info.UserId);
            _db.AddInParameter(dc, "Username", DbType.String, info.Username);
            _db.AddInParameter(dc, "NoEncryptPassword", DbType.String, info.Password.NoEncryptPassword);
            _db.AddInParameter(dc, "MD5Password", DbType.String, info.Password.MD5Password);
            _db.AddInParameter(dc, "IssueTime", DbType.DateTime, info.IssueTime);
            //_db.AddInParameter(dc, "KingdeeKMImportPath", DbType.String, Utils.GetMapPath("/ExcelDownTemp/导入科目表.xls"));
            //_db.AddInParameter(dc, "KingdeeHSImportPath", DbType.String, Utils.GetMapPath("/ExcelDownTemp/导入核算项目.xls"));
            _db.AddOutParameter(dc, "ReturnValue", DbType.Int32, 4);

            DbHelper.RunProcedure(dc, _db);

            object obj = _db.GetParameterValue(dc, "ReturnValue");

            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                return(0);
            }

            return(Utils.GetInt(obj.ToString()));
        }
示例#4
0
        /// <summary>
        /// 修改系统信息
        /// 1、修改管理员密码
        /// 2、修改权限
        /// 3、修改系统配置
        /// 4、修改域名
        /// </summary>
        /// <param name="sysInfo">系统信息实体</param>
        /// <returns>返回1成功,其他失败</returns>
        public int UpdateSys(EyouSoft.Model.SysStructure.MSysInfo sysInfo)
        {
            DbCommand cmd = this._db.GetStoredProcCommand("proc_Sys_UpdateSys");

            this._db.AddInParameter(cmd, "SysId", DbType.Int32, sysInfo.SystemId);
            this._db.AddInParameter(cmd, "SysDomainsXML", DbType.String, this.CreateSysDomainsXML(sysInfo.Domains));
            this._db.AddInParameter(cmd, "FirstPermission", DbType.String, this.ArrayToString(sysInfo.ModuleIds));
            this._db.AddInParameter(cmd, "SecondPermission", DbType.String, this.ArrayToString(sysInfo.PartIds));
            this._db.AddInParameter(cmd, "ThirdPermission", DbType.String, this.ArrayToString(sysInfo.PermissionIds));
            this._db.AddInParameter(cmd, "Username", DbType.String, sysInfo.AdminInfo.UserName);
            this._db.AddInParameter(cmd, "Password", DbType.String, sysInfo.AdminInfo.PassWordInfo.NoEncryptPassword);
            this._db.AddInParameter(cmd, "MD5Password", DbType.String, string.IsNullOrEmpty(sysInfo.AdminInfo.PassWordInfo.NoEncryptPassword) ? "" : sysInfo.AdminInfo.PassWordInfo.MD5Password);
            this._db.AddInParameter(cmd, "SettingsXML", DbType.String, this.CreateCompanySettingsXML(sysInfo.Setting));
            this._db.AddOutParameter(cmd, "Result", DbType.Int32, 4);

            int sqlExceptionCode = 0;

            try
            {
                DbHelper.RunProcedure(cmd, this._db);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                sqlExceptionCode = 0 - e.Number;
            }

            if (sqlExceptionCode < 0)
            {
                return(sqlExceptionCode);
            }

            return(Convert.ToInt32(this._db.GetParameterValue(cmd, "Result")));
        }
示例#5
0
        /// <summary>
        /// btnCreate click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.SysStructure.MSysInfo info = new EyouSoft.Model.SysStructure.MSysInfo();
            info.Password = new EyouSoft.Model.ComStructure.MPasswordInfo();

            #region get form values
            info.SysName   = Utils.GetFormValue("txtSysName");
            info.FullName  = Utils.GetFormValue("txtFullname");
            info.Telephone = Utils.GetFormValue("txtTelephone");
            info.Mobile    = Utils.GetFormValue("txtMobile");
            info.Username  = Utils.GetFormValue("txtUsername");
            info.Password.NoEncryptPassword = Utils.GetFormValue("txtPassword");
            #endregion

            #region validate form
            if (string.IsNullOrEmpty(info.SysName))
            {
                RegisterAlertScript("请输入系统名称!");
                return;
            }

            if (string.IsNullOrEmpty(info.Username))
            {
                RegisterAlertScript("请输入登录账号!");
                return;
            }

            if (string.IsNullOrEmpty(info.Password.NoEncryptPassword))
            {
                RegisterAlertScript("请输入登录密码!");
                return;
            }
            #endregion

            info.SmsConfig = new EyouSoft.BLL.SmsStructure.BSmsAccount().CreateSmsAccount();

            if (info.SmsConfig == null)
            {
                RegisterAlertScript("开通短信账号时异常!");
                return;
            }

            int createResult = new EyouSoft.BLL.SysStructure.BSys().CreateSys(info);

            if (createResult == 1)
            {
                this.RegisterAlertAndRedirectScript("子系统添加成功", "systems.aspx");
            }
            else
            {
                this.RegisterAlertAndRedirectScript("子系统添加失败", "systemadd.aspx");
            }
        }
示例#6
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");
            }
        }
示例#7
0
        /// <summary>
        /// 创建子系统,返回1成功,其它失败
        /// </summary>
        /// <param name="sysInfo">EyouSoft.Model.SysStructure.MSysInfo</param>
        /// <returns></returns>
        public int CreateSys(EyouSoft.Model.SysStructure.MSysInfo sysInfo)
        {
            DbCommand cmd = this._db.GetStoredProcCommand("proc_Sys_CreateSys");

            this._db.AddInParameter(cmd, "SysName", DbType.String, sysInfo.SystemName);
            this._db.AddInParameter(cmd, "SysDomainsXML", DbType.String, this.CreateSysDomainsXML(sysInfo.Domains));
            this._db.AddInParameter(cmd, "FirstPermission", DbType.String, this.ArrayToString(sysInfo.ModuleIds));
            this._db.AddInParameter(cmd, "SecondPermission", DbType.String, this.ArrayToString(sysInfo.PartIds));
            this._db.AddInParameter(cmd, "ThirdPermission", DbType.String, this.ArrayToString(sysInfo.PermissionIds));
            this._db.AddInParameter(cmd, "CompanyName", DbType.String, sysInfo.CompanyInfo.CompanyName);
            this._db.AddInParameter(cmd, "Realname", DbType.String, sysInfo.CompanyInfo.ContactName);
            this._db.AddInParameter(cmd, "Telephone", DbType.String, sysInfo.CompanyInfo.ContactTel);
            this._db.AddInParameter(cmd, "Mobile", DbType.String, sysInfo.CompanyInfo.ContactMobile);
            this._db.AddInParameter(cmd, "Fax", DbType.String, sysInfo.CompanyInfo.ContactFax);
            this._db.AddInParameter(cmd, "DepartmentName", DbType.String, sysInfo.DepartmentInfo.DepartName);
            this._db.AddInParameter(cmd, "Username", DbType.String, sysInfo.AdminInfo.UserName);
            this._db.AddInParameter(cmd, "Password", DbType.String, sysInfo.AdminInfo.PassWordInfo.NoEncryptPassword);
            this._db.AddInParameter(cmd, "MD5Password", DbType.String, sysInfo.AdminInfo.PassWordInfo.MD5Password);
            this._db.AddInParameter(cmd, "SettingsXML", DbType.String, this.CreateCompanySettingsXML(sysInfo.Setting));
            this._db.AddOutParameter(cmd, "Result", DbType.Int32, 4);
            this._db.AddOutParameter(cmd, "SysId", DbType.Int32, 4);
            this._db.AddOutParameter(cmd, "CompanyId", DbType.Int32, 4);

            int sqlExceptionCode = 0;

            try
            {
                DbHelper.RunProcedure(cmd, this._db);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                sqlExceptionCode = 0 - e.Number;
            }

            if (sqlExceptionCode < 0)
            {
                return(sqlExceptionCode);
            }

            sysInfo.SystemId       = Convert.ToInt32(this._db.GetParameterValue(cmd, "SysId"));
            sysInfo.CompanyInfo.Id = Convert.ToInt32(this._db.GetParameterValue(cmd, "CompanyId"));

            return(Convert.ToInt32(this._db.GetParameterValue(cmd, "Result")));
        }
示例#8
0
        /// <summary>
        /// 获取系统信息,仅取WEBMASTER修改子系统时使用的数据
        /// </summary>
        /// <param name="SystemId">系统编号</param>
        /// <returns></returns>
        public EyouSoft.Model.SysStructure.MSysInfo GetSysInfo(int sysId)
        {
            EyouSoft.Model.SysStructure.MSysInfo sysInfo = null;
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_GetSysInfo);

            this._db.AddInParameter(cmd, "SysId", DbType.Int32, sysId);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, this._db))
            {
                if (rdr.Read())
                {
                    sysInfo               = new EyouSoft.Model.SysStructure.MSysInfo();
                    sysInfo.SystemId      = sysId;
                    sysInfo.SystemName    = rdr["SysName"].ToString();
                    sysInfo.ModuleIds     = this.StringToIntArray(rdr["Module"].ToString());
                    sysInfo.PartIds       = this.StringToIntArray(rdr["Part"].ToString());
                    sysInfo.PermissionIds = this.StringToIntArray(rdr["Permission"].ToString());
                }
            }

            return(sysInfo);
        }
示例#9
0
        /// <summary>
        /// validate form
        /// </summary>
        /// <param name="sysInfo">EyouSoft.Model.SysStructure.MSystemInfo</param>
        /// <param name="message">error message</param>
        /// <returns></returns>
        private bool ValidateForm(EyouSoft.Model.SysStructure.MSysInfo sysInfo, out string message)
        {
            message = string.Empty;
            bool b = true;

            if (string.IsNullOrEmpty(sysInfo.AdminInfo.UserName))
            {
                b       = false;
                message = "管理员账号不能为空!";
                return(b);
            }

            if (sysInfo.Domains == null && sysInfo.Domains.Count < 1)
            {
                b       = false;
                message = "至少有一个系统域名!";
                return(b);
            }

            #region 打印单据配置验证
            if (sysInfo.Setting != null && sysInfo.Setting.PrintDocument != null && sysInfo.Setting.PrintDocument.Count > 0)//打印单据配置验证
            {
                IDictionary <EyouSoft.Model.EnumType.CompanyStructure.PrintTemplateType, int> dic = new Dictionary <EyouSoft.Model.EnumType.CompanyStructure.PrintTemplateType, int>();

                foreach (var item in sysInfo.Setting.PrintDocument)
                {
                    if (dic.ContainsKey(item.PrintTemplateType))
                    {
                        dic[item.PrintTemplateType]++;
                    }
                    else
                    {
                        dic.Add(item.PrintTemplateType, 1);
                    }
                }

                bool isRepeat = false;
                EyouSoft.Model.EnumType.CompanyStructure.PrintTemplateType?repeatType = null;
                foreach (var item in dic)
                {
                    if (item.Value > 1)
                    {
                        repeatType = item.Key;
                        isRepeat   = true;
                        break;
                    }
                }

                if (isRepeat)
                {
                    b       = false;
                    message = "打印单据配置有重复:" + repeatType.Value.ToString();
                    return(b);
                }
            }
            #endregion

            #region 验证域名是否重复
            IList <string> domains = new List <string>();
            foreach (var domain in sysInfo.Domains)
            {
                domains.Add(domain.Domain);
            }

            EyouSoft.BLL.SysStructure.SystemDomain sysdomainbll = new EyouSoft.BLL.SysStructure.SystemDomain();
            IList <string> existsDomains = sysdomainbll.IsExistsDomains(domains, this.SysId);
            sysdomainbll = null;

            if (existsDomains != null && existsDomains.Count > 0)
            {
                b       = false;
                message = string.Format("域名:{0}已经存在!", existsDomains[0]);
                return(b);
            }
            #endregion


            return(b);
        }
示例#10
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);
        }
示例#11
0
        /// <summary>
        /// btncreate click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.SysStructure.MSysInfo sysInfo = new EyouSoft.Model.SysStructure.MSysInfo();

            #region get form values
            sysInfo.AdminInfo      = new EyouSoft.Model.CompanyStructure.CompanyUser();
            sysInfo.CompanyInfo    = new EyouSoft.Model.CompanyStructure.CompanyInfo();
            sysInfo.CreateTime     = DateTime.Now;
            sysInfo.DepartmentInfo = new EyouSoft.Model.CompanyStructure.Department();
            sysInfo.Domains        = null;
            sysInfo.ModuleIds      = null;
            sysInfo.PartIds        = null;
            sysInfo.PermissionIds  = null;
            sysInfo.Setting        = new EyouSoft.Model.CompanyStructure.CompanyFieldSetting();

            sysInfo.SystemName = EyouSoft.Common.Utils.GetFormValue("txtSysName");

            sysInfo.AdminInfo.IsAdmin      = true;
            sysInfo.AdminInfo.IsDeleted    = false;
            sysInfo.AdminInfo.IsEnable     = true;
            sysInfo.AdminInfo.UserName     = EyouSoft.Common.Utils.GetFormValue("txtUsername");
            sysInfo.AdminInfo.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord()
            {
                NoEncryptPassword = EyouSoft.Common.Utils.GetFormValue("txtPassword")
            };

            sysInfo.CompanyInfo.CompanyName   = EyouSoft.Common.Utils.GetFormValue("txtCompanyName");
            sysInfo.CompanyInfo.ContactName   = EyouSoft.Common.Utils.GetFormValue("txtRealname");
            sysInfo.CompanyInfo.ContactTel    = EyouSoft.Common.Utils.GetFormValue("txtTelephone");
            sysInfo.CompanyInfo.ContactFax    = EyouSoft.Common.Utils.GetFormValue("txtFax");
            sysInfo.CompanyInfo.ContactMobile = EyouSoft.Common.Utils.GetFormValue("txtMobile");

            sysInfo.DepartmentInfo.DepartName = EyouSoft.Common.Utils.GetFormValue("txtDepartmentName");

            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.RegisterAlertScript(message);
                return;
            }
            #endregion

            EyouSoft.BLL.SysStructure.BSys bll = new EyouSoft.BLL.SysStructure.BSys();
            int addResult = bll.CreateSys(sysInfo);

            if (addResult == 1)
            {
                message = "子系统添加成功!";
                this.RegisterAlertAndRedirectScript(message, "systems.aspx");
            }
            else
            {
                message = "子系统添加失败!";
                this.RegisterAlertAndRedirectScript(message, "systemadd.aspx");
            }
        }