Exemplo n.º 1
0
        /// <summary>
        /// 给用户授权

        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        public static string SetUserBusiness(DataSet ds)
        {
            string    result = "1";
            DBOperate db     = new DBOperate("CFDBPOOL");

            StringBuilder sql = new StringBuilder();

            sql.Append(string.Format("DELETE MN_UserBusiness WHERE UserID='{0}';", ds.Tables[0].Rows[0]["UserID"]));
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                sql.Append(string.Format("INSERT INTO MN_UserBusiness(UserID,ScreenID) VALUES('{0}','{1}');", dr["UserID"], dr["ScreenID"]));
            }
            try
            {
                db.RunSqlNonQuery(sql.ToString());
            }
            catch (Exception ex)
            {
                result = "0";
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="UserCode">用户编号</param>
        /// <param name="UserPwd">用户密码</param>
        /// <param name="UserName">用户姓名</param>
        /// <param name="Sex">性别</param>
        /// <param name="LinkTel">联系电话</param>
        /// <param name="Email">邮箱</param>
        /// <param name="State">状态</param>
        /// <param name="Describe">描述</param>
        /// <param name="LoginIP">登录IP地址</param>
        /// <param name="UserID">ID</param>
        /// <returns></returns>
        //public static string UpdateUserByID(string UserCode, string UserPwd, string UserName, string Sex, string LinkTel, string Email, string Describe,string SSQ, string UserID)
        //{
        //    string result = "0";
        //    DBOperate db = new DBOperate("DADB");
        //    try
        //    {
        //        string strSql = "update UserInfo set UserCode=:UserCode,UserName=:UserName,Sex=:Sex,LinkTel=:LinkTel,Email=:Email,Describe=:Describe,SSQ=:SSQ where UserID=:UserID";

        //        OracleParameter[] sps = new OracleParameter[] {new OracleParameter("UserCode",UserCode),
        //                                                 new OracleParameter("UserName",UserName),
        //                                                 new OracleParameter("Sex",Sex),
        //                                                 new OracleParameter("LinkTel",LinkTel),
        //                                                 new OracleParameter("Email",Email),
        //                                                 new OracleParameter("Describe",Describe),
        //                                                 new OracleParameter("SSQ",SSQ),
        //                                                 new OracleParameter("UserID",UserID)};
        //        db.RunSqlNonQuery(strSql, sps);
        //        result = "1";
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.ToString());
        //    }
        //    finally
        //    {
        //        db.Despose();
        //    }
        //    return result;
        //}


        public static string UpdateUserByID(UserInfo ui)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string strSql = "update UserInfo set UserCode=@UserCode,UserName=@UserName,Sex=@Sex,LinkTel=@LinkTel,Email=@Email,Describe=@Describe,SSQ=@SSQ where UserID=@UserID";

                SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@UserCode", ui.UserCode),
                                                          new SqlParameter("@UserName", ui.UserName),
                                                          new SqlParameter("@Sex", ui.Sex),
                                                          new SqlParameter("@LinkTel", ui.LinkTel),
                                                          new SqlParameter("@Email", ui.Email),
                                                          new SqlParameter("@Describe", ui.Describe),
                                                          new SqlParameter("@SSQ", ui.Ssq),
                                                          new SqlParameter("@UserID", ui.UserId) };
                db.RunSqlNonQuery(strSql, sps);
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 插入职责信息
        /// </summary>
        /// <param name="duty">职责对象</param>
        /// <returns></returns>
        public static string InsertDuty(Duty duty)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string DutyId = Guid.NewGuid().ToString();
                string strSql = "insert into Duty(DutyId,DutyCode,DutyName,Describe) values(@DutyId,@DutyCode,@DutyName,@Describe)";
                db.RunSqlNonQuery(strSql, new SqlParameter[] { new SqlParameter("@DutyId", DutyId),
                                                               new SqlParameter("@DutyCode", duty.DutyCode),
                                                               new SqlParameter("@DutyName", duty.DutyName),
                                                               new SqlParameter("@Describe", duty.Describe) });
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 4
0
        public static bool DeleteFun(string id)
        {
            bool result = true;
            //DataSet ds;
            //DBOperate db = new DBOperate(@"Data Source=.;Initial Catalog=DZFrame;User ID=sa;Password=sa");;
            DBOperate db = null;

            try
            {
                //DataBaseEx db = new DataBaseEx(DataBaseEx.DBTypes.SQLServer, @"Data Source=2011-20110902HE\SQLSERVER2005;Initial Catalog=AHMS;User ID=sa;Password=111111");
                db = new DBOperate("DADB");
                SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@id", id) };
                string         sql = "delete DSPFUNC where ID=@id;";

                db.RunSqlNonQuery(sql, sps);
            }
            catch
            {
                result = false;
            }
            finally
            {
                if (db != null)
                {
                    db.Despose();
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        public static bool AddFun(DataSet ds)
        {
            bool      result = true;
            DBOperate db     = new DBOperate("DADB");

            //DataSet ds;
            //DBOperate db = new DBOperate(@"Data Source=.;Initial Catalog=DZFrame;User ID=sa;Password=sa");
            try
            {
                //DataBaseEx db = new DataBaseEx(DataBaseEx.DBTypes.SQLServer, @"Data Source=2011-20110902HE\SQLSERVER2005;Initial Catalog=AHMS;User ID=sa;Password=111111");

                DataRow dr  = ds.Tables[0].Rows[0];
                string  sql = string.Format(@"delete DSPFUNC where ID='{0}';
                insert into DSPFUNC(ID,Code,Name,Layer,IsDetail,InvokingConfig) values('{0}','{1}','{2}','{3}','{4}','{5}');", dr["ID"], dr["Code"], dr["Name"], dr["Layer"], dr["IsDetail"], dr["InvokingConfig"]);

                db.RunSqlNonQuery(sql);
            }
            catch
            {
                result = false;
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 6
0
        public static bool SetFun(string dutyid, string[] funids)
        {
            bool      result = true;
            DBOperate db     = new DBOperate("DADB");

            try
            {
                List <SqlParameter> splist = new List <SqlParameter>();
                splist.Add(new SqlParameter("@dutyid", dutyid));
                StringBuilder strSql = new StringBuilder("begin Delete DutyFun where DutyID =@dutyid;");
                string        dfid   = Guid.NewGuid().ToString();
                for (int i = 0; i < funids.Length; i++)
                {
                    dfid = Guid.NewGuid().ToString();
                    strSql.Append("insert into DutyFun(DF_ID,DutyID,FunID) values(@DF_ID" + i.ToString() + ",@dutyid,@funid" + i.ToString() + ");");
                    splist.Add(new SqlParameter("@DF_ID" + i.ToString(), dfid));
                    splist.Add(new SqlParameter("@funid" + i.ToString(), funids[i]));
                }
                strSql.Append(" end;");
                SqlParameter[] sps = splist.ToArray();
                db.RunSqlNonQuery(strSql.ToString(), sps);
            }
            catch (Exception ex)
            {
                result = false;
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 插入用户信息
        /// </summary>
        /// <param name="UserCode">用户编号</param>
        /// <param name="UserPwd">用户密码</param>
        /// <param name="UserName">用户姓名</param>
        /// <param name="Sex">性别</param>
        /// <param name="LinkTel">联系电话</param>
        /// <param name="Email">邮箱</param>
        /// <param name="State">状态</param>
        /// <param name="Describe">描述</param>
        /// <returns></returns>
        //public static string InsertUser(string UserID,string UserCode, string UserPwd, string UserName, string Sex, string LinkTel, string Email, string State, string Describe,string SSQ)
        //{
        //    string result = "0";
        //    DBOperate db = new DBOperate("DADB");
        //    try
        //    {
        //        string strSql = "insert into UserInfo(UserID,UserCode,UserPwd,UserName,Sex,LinkTel,Email,\"State\",Describe,SSQ)values(:UserID,:UserCode,:UserPwd,:UserName,:Sex,:LinkTel,:Email,:State,:Describe,:SSQ)";

        //        OracleParameter[] sps = new OracleParameter[] {new OracleParameter("UserID",UserID),
        //                                                 new OracleParameter("UserCode",UserCode),
        //                                                 new OracleParameter("UserPwd",UserPwd),
        //                                                 new OracleParameter("UserName",UserName),
        //                                                 new OracleParameter("Sex",Sex),
        //                                                 new OracleParameter("LinkTel",LinkTel),
        //                                                 new OracleParameter("Email",Email),
        //                                                 new OracleParameter("State",State),
        //                                                 new OracleParameter("Describe",Describe),
        //                                                 new OracleParameter("SSQ",SSQ)};
        //        db.RunSqlNonQuery(strSql, sps);
        //        result = "1";
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.ToString());
        //    }
        //    finally
        //    {
        //        db.Despose();
        //    }
        //    return result;
        //}


        public static string InsertUser(UserInfo ui)
        {
            string    result = "0";
            DBOperate db     = new DBOperate("DADB");

            try
            {
                string strSql = "insert into UserInfo(UserID,UserCode,UserPwd,UserName,Sex,LinkTel,Email,\"State\",Describe,SSQ)values(@UserID,@UserCode,@UserPwd,@UserName,@Sex,@LinkTel,@Email,@State,@Describe,@SSQ)";

                SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@UserID", ui.UserId),
                                                          new SqlParameter("@UserCode", ui.UserCode),
                                                          new SqlParameter("@UserPwd", ui.UserPwd),
                                                          new SqlParameter("@UserName", ui.UserName),
                                                          new SqlParameter("@Sex", ui.Sex),
                                                          new SqlParameter("@LinkTel", ui.LinkTel),
                                                          new SqlParameter("@Email", ui.Email),
                                                          new SqlParameter("@State", ui.State),
                                                          new SqlParameter("@Describe", ui.Describe),
                                                          new SqlParameter("@SSQ", ui.Ssq) };
                db.RunSqlNonQuery(strSql, sps);
                result = "1";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                db.Despose();
            }
            return(result);
        }
Exemplo n.º 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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
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);
        }