コード例 #1
0
        /// <summary>
        /// 得到所有的职责
        /// </summary>
        /// <returns></returns>
        public static DataSet GetAllDuty()
        {
            DataSet   ds = new DataSet();
            DBOperate db = new DBOperate("DADB");

            try
            {
                string strSql = "select * from Duty";
                ds = db.RunSql(strSql);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(ds);
        }
コード例 #2
0
        /// <summary>
        /// 取得用户的功能列表

        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static DataSet GetUserBusiness(string userID)
        {
            DBOperate db  = new DBOperate("CFDBPOOL");
            string    sql = string.Format(@"select UserID,ScreenID from MN_UserBusiness where UserID='{0}';", userID);
            DataSet   ds  = null;

            try
            {
                ds = db.RunSql(sql);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(ds);
        }
コード例 #3
0
        //根据条件添加授权
        public static string AddBusiness(string userID, string screenID)
        {
            string    result = "1";
            DBOperate db     = new DBOperate("CFDBPOOL");
            string    sql    = string.Format(@"insert into MN_UserBusiness(UserID,ScreenID) values('{0}','{2}');", userID, screenID);

            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                result = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 获取所有可用网点
        /// </summary>
        /// <returns></returns>
        public static DataSet GetJG_Branches()
        {
            DataSet   ds  = null;
            DBOperate db  = new DBOperate("DADB");
            string    sql = " select BR_BranchCode,BR_BranchName from JG_Branches where BR_State='1' ";

            try
            {
                ds = db.RunSql(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.Despose();
            }

            return(ds);
        }
コード例 #5
0
        /// <summary>
        /// 根据编号删除指定职责
        /// </summary>
        /// <param name="DutyID">编号</param>
        /// <returns></returns>
        public static string DeleteDutyByID(string DutyID)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string strSql = "delete from Duty where DutyID=@DutyID";
                db.RunSqlNonQuery(strSql, new SqlParameter[] { new SqlParameter("@DutyID", DutyID) });
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #6
0
        //根据用户编号删除用户
        public static string DelUser(string userID)
        {
            DBOperate db     = new DBOperate("CFDBPOOL");
            string    sql    = string.Format(@"delete from MN_User where UserID='{0}';", userID);
            string    resule = "1";

            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                resule = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(resule);
        }
コード例 #7
0
        public static DataSet getFunData()
        {
            DataSet ds;

            DBOperate db = new DBOperate("DADB");

            try
            {
                ds = db.RunSql("select * from DSPFUNC;");
                ds.Tables[0].TableName = "UserFuc";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(ds);
        }
コード例 #8
0
        /// <summary>
        /// 添加法院信息
        /// </summary>
        /// <param name="unitID">法院编号</param>
        /// <param name="zjm">助记码</param>
        /// <param name="unitName">法院名称</param>
        /// <returns></returns>
        public static string AddCurt(string unitID, string zjm, string unitName)
        {
            string    result = "1";
            DBOperate db     = new DBOperate("CFDBPOOL");
            string    sql    = string.Format(@"insert into MN_Units(UnitID,UnitType,ZJM,UnitName) values('{0}','1','{1}','{2}');", unitID, zjm, unitName);

            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                result = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// 分配职责
        /// </summary>
        /// <param name="lsUserDuty">用户职责</param>
        /// <returns></returns>
        public static string LicendToUser(UserDuty[] userdutys)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            db.BeginTransaction();
            try
            {
                StringBuilder sb         = new StringBuilder();
                int           count      = userdutys.Length;
                string        UserDutyId = Guid.NewGuid().ToString();
                if (count > 1)
                {
                    sb.Append("begin ");
                    for (int i = 0; i < count; i++)
                    {
                        UserDutyId = Guid.NewGuid().ToString();
                        sb.Append(string.Format("insert into UserDuty(USERDUTYID,UserID,DutyID) values('{0}','{1}','{2}');", UserDutyId, userdutys[i].UserID, userdutys[i].DutyID));
                    }
                    sb.Append(" end;");
                }
                else
                {
                    sb.Append(string.Format("insert into UserDuty(USERDUTYID,UserID,DutyID) values('{0}','{1}','{2}')", UserDutyId, userdutys[0].UserID, userdutys[0].DutyID));
                }
                db.RunSqlNonQuery(sb.ToString());
                db.Commit();
                result = "1";
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #10
0
        /// <summary>
        /// 获取各业务的流水号
        /// </summary>
        /// <returns></returns>
        public static DataSet GetNumbers()
        {
            DataSet   ds   = null;
            string    sql  = string.Format(@";SELECT ISNULL (MAX(SerialNo),'000000000000') SerialNo  From ArchiveIndex where SerialNo like '{0}%';
            SELECT ISNULL (MAX(ListNumber),'000000000000') ListNumber  From ArchiveIndex where substring(ListNumber,len(ListNumber)-11,8)='{0}';
            SELECT ISNULL (MAX(BusiCode),'000000000000') ListNumber  From UseBusiness where BusiCode like '{0}%';", DateTime.Now.ToString("yyyyMMdd"));
            DBOperate dbop = new DBOperate("DADB");

            try
            {
                ds = dbop.RunSql(sql);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                dbop.Despose();
            }
            return(ds);
        }
コード例 #11
0
        /// <summary>
        /// 根据编号移除用户职责
        /// </summary>
        /// <param name="UserDutyIDs">编号</param>
        /// <returns></returns>
        public static string RemoveDuty(string[] UserDutyIDs)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            db.BeginTransaction();
            int count = UserDutyIDs.Length;

            try
            {
                StringBuilder sb = new StringBuilder();
                if (count > 0)
                {
                    sb.Append("begin ");
                    for (int i = 0; i < count; i++)
                    {
                        sb.Append(string.Format("delete from UserDuty where UserDutyID='{0}';", UserDutyIDs[i]));
                    }
                    sb.Append(" end;");
                }
                else
                {
                    sb.Append(string.Format("delete from UserDuty where UserDutyID='{0}'", UserDutyIDs[0]));
                }
                db.RunSqlNonQuery(sb.ToString());
                result = "1";
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #12
0
        /// <summary>
        /// 根据用户编号修改用户状态
        /// </summary>
        /// <param name="UserID">用户编号</param>
        /// <param name="State">状态</param>
        /// <returns></returns>
        public static string UpdataStateByID(string UserID, string State)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string         strSql = "Update UserInfo set \"State\"=@State where UserID=@UserID";
                SqlParameter[] sps    = new SqlParameter[] { new SqlParameter("@State", State), new SqlParameter("@UserID", UserID) };
                db.RunSqlNonQuery(strSql, sps);
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #13
0
        /// <summary>
        /// 根据用户编号删除用户信息
        /// </summary>
        /// <param name="UserID">用户编号</param>
        /// <returns></returns>
        public static string DeleteUserByID(string UserID)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string         strSql = "delete from UserInfo where UserID=@UserID";
                SqlParameter[] sps    = new SqlParameter[] { new SqlParameter("@UserID", UserID) };
                db.RunSqlNonQuery(strSql, sps);
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #14
0
        /// <summary>
        /// 根据组织编号和组织类别的到相应用户信息

        /// </summary>
        /// <returns></returns>

        public static DataSet GetData()
        {
            DBOperate db = new DBOperate("CFDBPOOL");
            DataSet   ds = null;

            try
            {
                string sql = @"SELECT UnitID,ZJM,UnitName FROM MN_Units where unittype='1';
                               select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常'
	                           when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='1';
                               select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常'
	                           when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='2';
                               select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常'
	                           when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='3';
                               select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常'
	                           when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='4';
                               select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常'
	                           when Status='0' then '停用' else null end Status,Birthday,DepartMent,UnitName from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID;"    ;

                ds = db.RunSql(sql);
                ds.Tables[0].TableName = "Court";        //法院列表
                ds.Tables[1].TableName = "CourtUser";    //法院用户
                ds.Tables[2].TableName = "ArchieveUser"; //档案馆用户

                ds.Tables[3].TableName = "CodeUser";     //法规科用户

                ds.Tables[4].TableName = "InfoUser";     //信息中心用户
                ds.Tables[5].TableName = "AllUser";      //系统所有用户
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(ds);
        }
コード例 #15
0
        /// <summary>
        /// 根据单位编号删除单位信息
        /// </summary>
        /// <param name="unitID">单位编号</param>
        /// <returns></returns>
        public static string DelUnit(string unitID)
        {
            string    result = "1";
            DBOperate db     = new DBOperate("CFDBPOOL");
            string    sql    = string.Format(@"delete from MN_Units where UnitID='{0}';", unitID);

            //DataSet ds = null;
            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                result = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #16
0
        //根据用户编号修改用户信息
        public static string UpdateUser(string userID, string userCode, string userName, string psw, string userType, string status, string sex, string birthday, string officeTel, string departMent, string email)
        {
            DBOperate db  = new DBOperate("CFDBPOOL");
            string    sql = string.Format(@"update MN_User set UserCode='{0}', UserName='******',Psw='{2}', UserType='{3}',status='{4}',sex='{5}',birthday='{6}',
                                         officeTel='{7}',departMent='{8}',email='{9}' where UserID='{10}';", userCode, userName, psw, userType, status, sex,
                                          birthday, officeTel, departMent, email, userID);
            string resule = "1";

            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                resule = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(resule);
        }
コード例 #17
0
        /// <summary>
        /// 得到所有现存用户信息
        /// </summary>
        /// <returns></returns>
        public static DataSet GetAllUser()
        {
            DataSet   dsAllUser = new DataSet();
            DBOperate db        = new DBOperate("DADB");

            try
            {
                string strSql = @"select UserID,UserCode,UserPWD,UserName,UNITID,SEX,LINKTEL,EMAIL,State,DESCRIBE,LOGINIP,
                                case when State='1' then '正常' when State='0' then '停用' end as UserState,SSQ,jb.BR_BranchName as SSQNAME from UserInfo u
                                inner join dbo.JG_Branches jb
                                on u.ssq=jb.BR_BranchCode";
                dsAllUser = db.RunSql(strSql);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(dsAllUser);
        }
コード例 #18
0
        /// <summary>
        /// 根据编号获得相应子项
        /// </summary>
        /// <param name="SetCode">编号</param>
        /// <returns></returns>
        public static DataSet GetItemsBySetCode(string[] SetCode)
        {
            DBOperate db = new DBOperate("DADB");
            DataSet   ds = null;

            try
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < SetCode.Length; i++)
                {
                    sb.Append(string.Format(@"select PI_ItemCode,PI_ItemName from ParmItem where PI_SetCode='{0}' order by PI_ItemCode;", SetCode[i]));
                }
                ds = db.RunSql(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(ds);
        }
コード例 #19
0
        /// <summary>
        /// 修改职责信息
        /// </summary>
        /// <param name="duty">职责对象</param>
        /// <returns></returns>
        public static string UpdateDuty(Duty duty)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string strSql = "update Duty set DutyCode=@DutyCode,DutyName=@DutyName,Describe=@Describe where DutyID=@DutyID";
                db.RunSqlNonQuery(strSql, new SqlParameter[] { new SqlParameter("@DutyCode", duty.DutyCode),
                                                               new SqlParameter("@DutyName", duty.DutyName),
                                                               new SqlParameter("@Describe", duty.Describe),
                                                               new SqlParameter("@DutyID", duty.DutyID) });
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
コード例 #20
0
        /// <summary>
        /// 根据参数编号活的参数值
        /// </summary>
        /// <param name="ParmCode">参数编号</param>
        /// <returns></returns>
        public static string GetSysParaValue(string ParmCode)
        {
            string    SysParaValue = "";
            DBOperate db           = new DBOperate("DADB");

            try
            {
                string  strSql = "select ParmValue from SysParameter where ParmCode='" + ParmCode + "'";
                DataSet ds     = db.RunSql(strSql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    SysParaValue = ds.Tables[0].Rows[0]["ParmValue"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(SysParaValue);
        }
コード例 #21
0
        //添加用户信息
        public static string AddUser(string userID, string userCode, string userName, string psw, string userType, string status, string sex, string birthday, string officeTel, string departMent, string email)
        {
            //DBOperate db = new DBOperate("CFDBPOOL");
            DBOperate db  = new DBOperate("CFDBPOOL");
            string    sql = string.Format(@"insert into MN_User(UserID,UserCode,UserName,Psw,UserType,Status,Sex,Birthday,OfficeTel,DepartMent,Email) 
                        values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", userID, userCode, userName, psw, userType, status, sex,
                                          birthday, officeTel, departMent, email);
            string resule = "1";

            try
            {
                db.RunSqlNonQuery(sql);
            }
            catch (Exception ex)
            {
                resule = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(resule);
        }