Example #1
0
        /// <summary>
        /// 遍历子模块
        /// </summary>
        /// <param name="parentNode">父模块节点</param>
        /// <param name="ds">模块记录集</param>
        /// <param name="roleRight">角色权限模块</param>
        private void AddNode(Tree <TSModule> parentNode, DataSet ds, Hashtable roleRight)
        {
            DataView dv = new DataView();

            dv.Table     = ds.Tables[0];
            dv.RowFilter = "parentId='" + parentNode.attributes.moduleId + "'";
            dv.Sort      = "moduleIndex desc";
            for (int i = 0; i < dv.Count; i++)
            {
                Tree <TSModule> treeNode = new Tree <TSModule>();
                treeNode.text = dv[i]["moduleName"].ToString();                    //节点名称
                TSModule tsModule = new TSModule();
                tsModule.moduleId    = dv[i]["moduleId"].ToString();               //模块编号
                tsModule.moduleCode  = dv[i]["moduleCode"].ToString();             //模块代码
                tsModule.moduleName  = dv[i]["moduleName"].ToString();             //模块名称
                tsModule.moduleURL   = dv[i]["moduleURL"].ToString();              //模块URL
                tsModule.imgClass    = dv[i]["imgClass"].ToString();               //模块图片样式
                tsModule.parentId    = dv[i]["parentId"].ToString();               //父模块编号("0"代表无父模块)
                tsModule.moduleLayer = int.Parse(dv[i]["moduleLayer"].ToString()); //模块所属层次
                tsModule.moduleIndex = int.Parse(dv[i]["moduleIndex"].ToString()); //模块索引
                treeNode.attributes  = tsModule;
                AddNode(treeNode, ds, roleRight);                                  //遍历子模块
                if (treeNode.children.Count == 0)
                {
                    treeNode.need_to_json_checked = roleRight.ContainsKey(tsModule.moduleId);
                }
                parentNode.children.Add(treeNode);//添加子模块节点
            }
        }
Example #2
0
        /// <summary>
        /// 获取系统功能模块
        /// <param name="moduleId">模块编号</param>
        /// </summary>
        /// <returns>系统功能模块对象</returns>
        public TSModule Get(string moduleId)
        {
            TSModule tsModule = null;

            try
            {
                string strSQL = "select * from TSModule where moduleId=:moduleId";
                Param  param  = new Param();
                param.Clear();
                param.Add(":moduleId", moduleId);
                db.Open();
                ComDataReader dr = db.ExecuteReader(CommandType.Text, strSQL, param);
                if (dr.Read())
                {
                    tsModule = ReadData(dr);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                db.Close();
            }
            return(tsModule);
        }
Example #3
0
        /// <summary>
        /// 读取系统功能模块信息
        /// </summary>
        /// <param name="dr">记录指针</param>
        /// <returns>系统功能模块对象</returns>
        protected virtual TSModule ReadData(ComDataReader dr)
        {
            TSModule tsModule = new TSModule();

            tsModule.moduleId = dr["moduleId"].ToString();//模块编号
            if (dr["moduleCode"] != null)
            {
                tsModule.moduleCode = dr["moduleCode"].ToString();//模块代码
            }
            if (dr["moduleName"] != null)
            {
                tsModule.moduleName = dr["moduleName"].ToString();//模块名称
            }
            if (dr["moduleURL"] != null)
            {
                tsModule.moduleURL = dr["moduleURL"].ToString();//模块路径
            }
            if (dr["imgClass"] != null)
            {
                tsModule.imgClass = dr["imgClass"].ToString();//图片样式
            }
            if (dr["parentId"] != null)
            {
                tsModule.parentId = dr["parentId"].ToString();//父模块编号
            }
            if (dr["moduleLayer"] != null)
            {
                tsModule.moduleLayer = int.Parse(dr["moduleLayer"].ToString());//模块层次
            }
            if (dr["moduleIndex"] != null)
            {
                tsModule.moduleIndex = int.Parse(dr["moduleIndex"].ToString());//排列顺序
            }
            return(tsModule);
        }
Example #4
0
 /// <summary>
 /// 加载指定系统功能模块
 /// <param name="moduleId">模块编号</param>
 /// </summary>
 public void Load(string moduleId)
 {
     try
     {
         TSModule tsModule = tsModuleDAO.Get(moduleId);
         WebJson.ToJson(context, tsModule);
     }
     catch (Exception e)
     {
         Message.error(context, e.Message);
     }
 }
Example #5
0
        /// <summary>
        /// 读取系统功能模块信息
        /// <param name="dr">记录指针</param>
        /// </summary>
        /// <returns>系统功能模块对象</returns>
        private TSModule ReadData(ComDataReader dr)
        {
            TSModule tsModule = new TSModule();

            tsModule.moduleId    = dr["moduleId"].ToString();               //模块编号
            tsModule.moduleCode  = dr["moduleCode"].ToString();             //模块代码
            tsModule.moduleName  = dr["moduleName"].ToString();             //模块名称
            tsModule.moduleURL   = dr["moduleURL"].ToString();              //模块路径
            tsModule.imgClass    = dr["imgClass"].ToString();               //图片样式
            tsModule.parentId    = dr["parentId"].ToString();               //父模块编号
            tsModule.moduleLayer = int.Parse(dr["moduleLayer"].ToString()); //模块层次
            tsModule.moduleIndex = int.Parse(dr["moduleIndex"].ToString()); //排列顺序
            return(tsModule);
        }
Example #6
0
        /// <summary>
        /// 修改系统功能模块【修改】
        /// <param name="data">数据库连接</param>
        /// <param name="tsModule">系统功能模块</param>
        /// </summary>
        public override void Edit(DataAccess data, TSModule tsModule)
        {
            string strSQL = "update TSModule set moduleCode=@moduleCode,moduleName=@moduleName,moduleURL=@moduleURL,imgClass=@imgClass,moduleIndex=@moduleIndex where moduleId=@moduleId";
            Param  param  = new Param();

            param.Clear();
            param.Add("@moduleCode", tsModule.moduleCode); //模块代码
            param.Add("@moduleName", tsModule.moduleName); //模块名称
            param.Add("@moduleURL", tsModule.moduleURL);   //模块路径
            param.Add("@imgClass", tsModule.imgClass);     //图片样式
            //param.Add("@parentId", tsModule.parentId);//父模块编号
            //param.Add("@moduleLayer", tsModule.moduleLayer);//模块层次
            param.Add("@moduleIndex", tsModule.moduleIndex); //排列顺序
            param.Add("@moduleId", tsModule.moduleId);       //模块编号
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
Example #7
0
 /// <summary>
 /// 修改系统功能模块
 /// <param name="tsModule">系统功能模块</param>
 /// </summary>
 public void Edit(TSModule tsModule)
 {
     try
     {
         db.Open();
         Edit(db, tsModule);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Close();
     }
 }
Example #8
0
        /// <summary>
        /// 增加系统功能模块
        /// <param name="data">数据库连接</param>
        /// <param name="tsModule">系统功能模块</param>
        /// </summary>
        public void Add(DataAccess data, TSModule tsModule)
        {
            string strSQL = "insert into TSModule (moduleId,moduleCode,moduleName,moduleURL,imgClass,parentId,moduleLayer,moduleIndex) values (:moduleId,:moduleCode,:moduleName,:moduleURL,:imgClass,:parentId,:moduleLayer,:moduleIndex)";
            Param  param  = new Param();

            param.Clear();
            param.Add(":moduleId", tsModule.moduleId);       //模块编号
            param.Add(":moduleCode", tsModule.moduleCode);   //模块代码
            param.Add(":moduleName", tsModule.moduleName);   //模块名称
            param.Add(":moduleURL", tsModule.moduleURL);     //模块路径
            param.Add(":imgClass", tsModule.imgClass);       //图片样式
            param.Add(":parentId", tsModule.parentId);       //父模块编号
            param.Add(":moduleLayer", tsModule.moduleLayer); //模块层次
            param.Add(":moduleIndex", tsModule.moduleIndex); //排列顺序
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
Example #9
0
 /// <summary>
 /// 增加系统功能模块
 /// </summary>
 /// <param name="tsModule">系统功能模块</param>
 public virtual void Add(TSModule tsModule)
 {
     try
     {
         db.Open();
         Add(db, tsModule);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Close();
     }
 }
Example #10
0
        /// <summary>
        /// 增加系统功能模块
        /// <param name="tsModule">系统功能模块</param>
        /// </summary>
        public void Add(TSModule tsModule)
        {
            //检查模块代码是否重复
            if (tsModuleDAO.Exist("moduleCode", tsModule.moduleCode))
            {
                Message.error(context, "按钮模板名称不允许重复");
                return;
            }

            try
            {
                tsModule.moduleId = commonDao.GetMaxNo("TSModule", "", 6);
                tsModuleDAO.Add(tsModule);
                Message.success(context, "模块增加成功");
                loginSession.Log(tsModule.moduleName + "模块增加成功");
            }
            catch (Exception e)
            {
                Message.error(context, "模块增加失败");
                loginSession.Log(e.Message);
            }
        }
Example #11
0
        /// <summary>
        /// 显示模块树
        /// </summary>
        public void LoadTree(string roleId)
        {
            DataSet   ds                     = tsModuleDAO.GetDataSet("select * from TSModule", null);
            Hashtable roleRight              = new TSRightDAO().GetModuleIdHash(roleId);
            List <Tree <TSModule> > list     = new List <Tree <TSModule> >(1);
            Tree <TSModule>         treeNode = new Tree <TSModule>();

            treeNode.text = "系统平台模块";//节点名称
            TSModule tsModule = new TSModule();

            tsModule.moduleId    = "0";       //模块编号
            tsModule.moduleCode  = "";        //模块代码
            tsModule.moduleName  = "";        //模块名称
            tsModule.moduleURL   = "";        //模块URL
            tsModule.imgClass    = "";        //模块图片样式
            tsModule.parentId    = "";        //父模块编号("0"代表无父模块)
            tsModule.moduleLayer = 0;         //模块所属层次
            tsModule.moduleIndex = 0;         //模块索引
            treeNode.attributes  = tsModule;
            AddNode(treeNode, ds, roleRight); //遍历子模块
            list.Add(treeNode);
            WebJson.ToJson(context, list);
        }
Example #12
0
        /// <summary>
        /// 修改系统功能模块
        /// <param name="tsModule">系统功能模块</param>
        /// </summary>
        public void Edit(TSModule tsModule)
        {
            //检查模块代码是否修改如果修改是否重复
            List <TSModule> list = tsModuleDAO.GetList("ModuleCode", tsModule.moduleCode);

            if (list.Count > 0 && (!tsModule.moduleId.Equals(list[0].moduleId)))
            {
                Message.error(context, "按钮模板名称不允许重复");
                return;
            }

            try
            {
                tsModuleDAO.Edit(tsModule);
                Message.success(context, "模块修改成功");
                loginSession.Log(tsModule.moduleName + "[" + tsModule.moduleId + "]模块修改成功");
            }
            catch (Exception e)
            {
                Message.error(context, "模块修改失败");
                loginSession.Log(e.Message);
            }
        }
Example #13
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                LoginUser loginUser = new LoginUser(context, "Module");
                if (!loginUser.Pass)//权限验证
                {
                    return;
                }

                //加载树
                if (context.Request["action"] == "treeLoad")
                {
                    ModuleBLL bll = new ModuleBLL(context, loginUser);
                    bll.LoadTree("XX");
                    return;
                }

                //加载信息
                if (context.Request["action"] == "load")
                {
                    ModuleBLL bll      = new ModuleBLL(context, loginUser);
                    string    moduleId = context.Request["moduleId"];//模块编号
                    bll.Load(moduleId);
                    return;
                }

                //增加
                if (context.Request["action"] == "add")
                {
                    ModuleBLL bll      = new ModuleBLL(context, loginUser);
                    TSModule  tsModule = new TSModule();
                    //tsModule.moduleId = context.Request["moduleId"];//模块编号
                    tsModule.moduleCode  = context.Request["moduleCode"];             //模块代码
                    tsModule.moduleName  = context.Request["moduleName"];             //模块名称
                    tsModule.moduleURL   = context.Request["moduleURL"];              //模块路径
                    tsModule.imgClass    = context.Request["imgClass"];               //图片样式
                    tsModule.parentId    = context.Request["parentId"];               //父模块编号
                    tsModule.moduleLayer = int.Parse(context.Request["moduleLayer"]); //模块层次
                    tsModule.moduleIndex = int.Parse(context.Request["moduleIndex"]); //排列顺序
                    bll.Add(tsModule);
                    return;
                }

                //修改
                if (context.Request["action"] == "edit")
                {
                    ModuleBLL bll      = new ModuleBLL(context, loginUser);
                    TSModule  tsModule = new TSModule();
                    tsModule.moduleId   = context.Request["moduleId"];   //模块编号
                    tsModule.moduleCode = context.Request["moduleCode"]; //模块代码
                    tsModule.moduleName = context.Request["moduleName"]; //模块名称
                    tsModule.moduleURL  = context.Request["moduleURL"];  //模块路径
                    tsModule.imgClass   = context.Request["imgClass"];   //图片样式
                    //tsModule.parentId = context.Request["parentId"];//父模块编号
                    //tsModule.moduleLayer = int.Parse(context.Request["moduleLayer"]);//模块层次
                    tsModule.moduleIndex = int.Parse(context.Request["moduleIndex"]);//排列顺序
                    bll.Edit(tsModule);
                    return;
                }

                //删除
                if (context.Request["action"] == "delete")
                {
                    ModuleBLL bll      = new ModuleBLL(context, loginUser);
                    string    moduleId = context.Request["moduleId"];//模块编号
                    bll.Delete(moduleId);
                    return;
                }
            }
            catch (Exception e)
            {
                Message.error(context, e.Message);
            }
        }
Example #14
0
        public bool TSLogin(string UserName, string Password, TSModule ModuleID)
        {
            try
            {
                //  Get the license
                string tsLicense = String.Empty;
                switch (ModuleID)
                {
                    case TSModule.SCAN:
                        tsLicense = "Scan License";
                        break;
                    case TSModule.ENHANCE:
                        tsLicense = "Enhance License";
                        break;
                    case TSModule.SEPARATOR:
                        tsLicense = "Separator License";
                        break;
                    case TSModule.AUTOINDEX:
                        tsLicense = "AutoIndex License";
                        break;
                    case TSModule.FULLTEXTOCR:
                        tsLicense = "FullText OCR License";
                        break;
                    case TSModule.MANUALINDEX:
                        tsLicense = "Manual Index License";
                        break;
                    case TSModule.VERIFICATION:
                        tsLicense = "Verification License";
                        break;
                    case TSModule.QA:
                        tsLicense = "QA License";
                        break;
                    case TSModule.EXPORT:
                        tsLicense = "Export License";
                        break;
                    case TSModule.CONTROL:
                        tsLicense = "Control License";
                        break;
                    case TSModule.MANAGER:
                        tsLicense = "Manager License";
                        break;
                    default:
                        break;
                }

                if (ts2KServerMain.ManagedLogon((int)ModuleID, TS_WORKSTATION, UserName, Password, tsLicense))
                {
                    ServerInfo = ts2KServerMain.ServerInfo(1);
                    if (!string.IsNullOrEmpty(ServerInfo))
                    {
                        TSDBVersion = mem.GetInt("TSDBInfo", "DBVersion", 1, ServerInfo);
                        if (TSDBVersion >= 4)
                        {
                            this.CurrentUser = GetCurrentUser();
                            if (this.CurrentUser.UserID > 0)
                            {
                                this.JobList = GetJobList();
                                if (JobList != null && JobList.Count > 0)
                                {
                                    //  We're good!!!
                                }
                            }
                            else
                            {
                                throw new Exception("Invalid User ID!");
                            }
                        }
                        else
                        {
                            throw new Exception("TurboscanNG DB Version must be 4 or higher!");
                        }
                    }
                    else
                    {
                        throw new Exception("Could not obtain server information!");
                    }
                }
                else
                {
                    throw new Exception("Could not log into TurboscanNG!");
                }
                return true;
            }
            catch (Exception)
            {
                throw;
            }
        }