Example #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="lstOID"></param>
        /// <returns></returns>
        public bool DeleteFunction(List<string> lstOID)
        {
            string strSQL = @" DELETE FROM TBLFUNCTION WHERE oid=@OID ";
            string[] paramNames = new string[1];
            object[] paramValues = new object[1];

            paramNames[0] = "OID";
            SqlDBBroker broker = new SqlDBBroker();
            try
            {
                broker.Open();
                broker.BeginTrans();
                foreach (string oid in lstOID)
                {
                    paramValues[0] = oid;
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                }
                broker.CommitTrans();
            }
            catch
            {
                broker.RollbackTrans();
                return false;
            }
            finally
            {
                broker.Close();
            }
            return true;
        }
        /// <summary>
        /// 保存功能组菜单权限
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public bool SaveGroupFunction(List<GroupFunctionMapEntity> entitys)
        {
            if (entitys.Count > 0)
            {
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();

                    string strDelSQL = " DELETE FROM dbo.TBLGroupFunctionMap WHERE groupID=@GroupID ";
                    string[] paramNames1 = new string[1];
                    object[] paramValues1 = new object[1];

                    paramNames1[0] = "GroupID";
                    paramValues1[0] = entitys[0].GroupID;
                    broker.ExecuteNonQuery(strDelSQL, CommandType.Text, paramNames1, paramValues1);

                    string strSQL = @" INSERT INTO dbo.TBLGroupFunctionMap
                                            ( oid , groupID , functionID , cuser , cdate , muser , mdate , addition1 , addition2 )
                                    VALUES  ( @OID,@GroupID ,@FunctionID,@Cuser,getdate(),@Muser ,getdate() ,NULL,NULL) ";
                    string[] paramNames = new string[5];
                    object[] paramValues = new object[5];

                    foreach (GroupFunctionMapEntity en in entitys)
                    {
                        paramNames[0] = "OID";
                        paramNames[1] = "GroupID";
                        paramNames[2] = "FunctionID";
                        paramNames[3] = "Cuser";
                        paramNames[4] = "Muser";

                        paramValues[0] = en.OID;
                        paramValues[1] = en.GroupID;
                        paramValues[2] = en.FunctionID;
                        paramValues[3] = en.CUSER;
                        paramValues[4] = en.MUSER;

                        broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    }
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        /// <summary>
        /// 删除群组下的人
        /// </summary>
        /// <param name="personIDS"></param>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public bool DeleteGroupPersonByPersonID(List<string> personIDS,string groupID)
        {
            if (personIDS.Count > 0)
            {
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();

                    string strDelSQL = " DELETE FROM dbo.TBLGroupPersonMap WHERE PersonID=@PersonID AND groupID=@GroupID ";
                    string[] paramNames = new string[2];
                    object[] paramValues = new object[2];

                    paramNames[0] = "GroupID";
                    paramNames[1] = "PersonID";
                    paramValues[0] = groupID;
                    foreach (string personid in personIDS)
                    {
                        paramValues[1] = personid;
                        broker.ExecuteNonQuery(strDelSQL, CommandType.Text, paramNames, paramValues);
                    }
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
Example #4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public bool InsertFunction(FunctionEntity fun)
        {
            if (fun != null)
            {
                string strSQL = @" INSERT  INTO TBLFUNCTION
                                            ( oid , functionkey , functionname ,  functionlevel , functionparentid , functionurl ,functionstatus ,
                                              functionorder , functiontype , memo ,cuser ,cdate ,muser ,mdate ,addition1 ,addition2 )
                                    VALUES  ( @OID ,@functionkey ,@functionname ,@functionlevel ,@functionparentid ,@functionurl ,@functionstatus ,
                                              @functionorder ,@functiontype , @memo ,@cuser ,GETDATE() , @muser ,GETDATE() ,NULL ,NULL) ";
                string[] paramNames = new string[12];
                object[] paramValues = new object[12];

                paramNames[0] = "OID";
                paramNames[1] = "functionkey";
                paramNames[2] = "functionname";
                paramNames[3] = "functionlevel";
                paramNames[4] = "functionparentid";
                paramNames[5] = "functionurl";
                paramNames[6] = "functionstatus";
                paramNames[7] = "functionorder";
                paramNames[8] = "functiontype";
                paramNames[9] = "memo";
                paramNames[10] = "cuser";
                paramNames[11] = "muser";

                paramValues[0] = fun.OID;
                paramValues[1] = fun.FUNCTIONKEY;
                paramValues[2] = fun.FUNCTIONNAME;
                paramValues[3] = fun.FUNCTIONLEVEL;
                paramValues[4] = fun.FUNCTIONPARENTID;
                paramValues[5] = fun.FUNCTIONURL;
                paramValues[6] = fun.FUNCTIONSTATUS;
                paramValues[7] = fun.FUNCTIONORDER;
                paramValues[8] = fun.FUNCTIONTYPE;
                paramValues[9] = fun.MEMO;
                paramValues[10] = fun.CUSER;
                paramValues[11] = fun.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
Example #5
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public bool UpdateFunction(FunctionEntity fun)
        {
            if (fun != null)
            {
                string strSQL = @" UPDATE TBLFUNCTION SET functionkey=@functionkey,functionname=@functionname, functionurl=@functionurl ,
                                    functionstatus=@functionstatus ,functionorder=@functionorder,memo=@memo,muser=@muser,mdate=GETDATE()
                                    WHERE oid=@OID ";
                string[] paramNames = new string[8];
                object[] paramValues = new object[8];

                paramNames[0] = "OID";
                paramNames[1] = "functionkey";
                paramNames[2] = "functionname";
                paramNames[3] = "functionurl";
                paramNames[4] = "functionstatus";
                paramNames[5] = "functionorder";
                paramNames[6] = "memo";
                paramNames[7] = "muser";

                paramValues[0] = fun.OID;
                paramValues[1] = fun.FUNCTIONKEY;
                paramValues[2] = fun.FUNCTIONNAME;
                paramValues[3] = fun.FUNCTIONURL;
                paramValues[4] = fun.FUNCTIONSTATUS;
                paramValues[5] = fun.FUNCTIONORDER;
                paramValues[6] = fun.MEMO;
                paramValues[7] = fun.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        public bool InsertPerson(PersonEntity per)
        {
            if (per != null)
            {
                string strSQL = @" INSERT INTO TBLPERSON ( oid , personcode , personaccount , personpassword , personname , personsex ,
                                                personstatus , persontype , personofficephone , personmobilephone , personemail ,
                                                personmemo , cuser , cdate , muser , mdate , mpwdtime , personpasswordquestion ,
                                                personpasswordanswer , addition1 , addition2 )
                                    VALUES  ( @oid, @personcode,@personaccount,@personpassword,@personname,@personsex,
                                                @personstatus,@persontype,@personofficephone,@personmobilephone,@personemail,
                                                @personmemo,@cuser, GETDATE(),@muser,GETDATE(),GETDATE(),' ' ,' ', NULL,NULL) ";
                string[] paramNames = new string[14];
                object[] paramValues = new object[14];

                paramNames[0] = "OID";
                paramNames[1] = "personcode";
                paramNames[2] = "personaccount";
                paramNames[3] = "personpassword";
                paramNames[4] = "personname";
                paramNames[5] = "personsex";
                paramNames[6] = "personstatus";
                paramNames[7] = "persontype";
                paramNames[8] = "personofficephone";
                paramNames[9] = "personmobilephone";
                paramNames[10] = "personemail";
                paramNames[11] = "personmemo";
                paramNames[12] = "cuser";
                paramNames[13] = "muser";

                paramValues[0] = per.OID;
                paramValues[1] = per.PERSONCODE;
                paramValues[2] = per.PERSONACCOUNT;
                paramValues[3] = per.PERSONPASSWORD??" ";
                paramValues[4] = per.PERSONNAME;
                paramValues[5] = per.PERSONSEX;
                paramValues[6] = per.PERSONSTATUS;
                paramValues[7] = per.PERSONTYPE;
                paramValues[8] = per.PERSONOFFICEPHONE;
                paramValues[9] = per.PERSONMOBILEPHONE;
                paramValues[10] = per.PERSONEMAIL;
                paramValues[11] = per.PERSONMEMO;
                paramValues[12] = per.CUSER;
                paramValues[13] = per.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        public bool UpdatePersonAdmin(PersonEntity per)
        {
            if (per != null)
            {
                string strSQL = @" UPDATE TBLPERSON SET personcode=@personcode,personaccount=@personaccount,personname=@personname,personsex=@personsex,
                                    personstatus=@personstatus,persontype=@persontype,personofficephone=@personofficephone,
                                    personmobilephone=@personmobilephone,personemail=@personemail,personmemo=@personmemo,muser=@muser,mdate=GETDATE()
                                    WHERE oid=@oid ";
                string[] paramNames = new string[12];
                object[] paramValues = new object[12];

                paramNames[0] = "OID";
                paramNames[1] = "personcode";
                paramNames[2] = "personaccount";
                paramNames[3] = "personname";
                paramNames[4] = "personsex";
                paramNames[5] = "personstatus";
                paramNames[6] = "persontype";
                paramNames[7] = "personofficephone";
                paramNames[8] = "personmobilephone";
                paramNames[9] = "personemail";
                paramNames[10] = "personmemo";
                paramNames[11] = "muser";

                paramValues[0] = per.OID;
                paramValues[1] = per.PERSONCODE;
                paramValues[2] = per.PERSONACCOUNT;
                paramValues[3] = per.PERSONNAME;
                paramValues[4] = per.PERSONSEX;
                paramValues[5] = per.PERSONSTATUS;
                paramValues[6] = per.PERSONTYPE;
                paramValues[7] = per.PERSONOFFICEPHONE;
                paramValues[8] = per.PERSONMOBILEPHONE;
                paramValues[9] = per.PERSONEMAIL;
                paramValues[10] = per.PERSONMEMO;
                paramValues[11] = per.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        /// <summary>
        /// 保存功能组人员
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public bool SaveGroupPerson(List<string> personIDS,string groupID,string editor)
        {
            if (personIDS.Count > 0)
            {
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();

                    string strDelSQL = " DELETE FROM dbo.TBLGroupPersonMap WHERE groupID=@GroupID ";
                    string[] paramNames1 = new string[1];
                    object[] paramValues1 = new object[1];

                    paramNames1[0] = "GroupID";
                    paramValues1[0] = groupID;
                    broker.ExecuteNonQuery(strDelSQL, CommandType.Text, paramNames1, paramValues1);

                    string strSQL = @" INSERT INTO dbo.TBLGroupPersonMap
                                            ( oid , groupID , personID , cuser , cdate , muser , mdate , addition1 , addition2 )
                                    VALUES  ( @OID,@GroupID ,@PersonID,@Cuser,getdate(),@Muser ,getdate() ,NULL,NULL) ";
                    string[] paramNames = new string[5];
                    object[] paramValues = new object[5];

                    foreach (string personid in personIDS)
                    {
                        paramNames[0] = "OID";
                        paramNames[1] = "GroupID";
                        paramNames[2] = "PersonID";
                        paramNames[3] = "Cuser";
                        paramNames[4] = "Muser";

                        paramValues[0] = Guid.NewGuid().ToString();
                        paramValues[1] = groupID;
                        paramValues[2] = personid;
                        paramValues[3] = editor;
                        paramValues[4] = editor;

                        broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    }
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        public bool InsertGroup(PermissionGroupEntity group)
        {
            if (group != null)
            {
                string strSQL = @" INSERT INTO dbo.TBLPermissionGroup( oid , groupcode , groupname , groupstatus ,memo,
                                              cuser , cdate , muser ,  mdate , addition1 , addition2 )
                                    VALUES  ( @OID , @GroupCode , @GroupName , @GroupStatus,@Memo,
                                              @Cuser , GETDATE(), @Muser,GETDATE(),NULL, NULL) ";
                string[] paramNames = new string[7];
                object[] paramValues = new object[7];

                paramNames[0] = "OID";
                paramNames[1] = "GroupCode";
                paramNames[2] = "GroupName";
                paramNames[3] = "GroupStatus";
                paramNames[4] = "Memo";
                paramNames[5] = "Cuser";
                paramNames[6] = "Muser";

                paramValues[0] = group.OID;
                paramValues[1] = group.GroupCode;
                paramValues[2] = group.GroupName;
                paramValues[3] = group.GroupStatus;
                paramValues[4] = group.MEMO;
                paramValues[5] = group.CUSER;
                paramValues[6] = group.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }
        public bool UpdateGroup(PermissionGroupEntity group)
        {
            if (group != null)
            {
                string strSQL = @" UPDATE TBLPermissionGroup SET groupcode=@GroupCode,groupname=@GroupName,groupstatus=@GroupStatus,
                                                memo=@Memo,muser=@Muser,mdate=GETDATE() WHERE oid=@OID   ";
                string[] paramNames = new string[6];
                object[] paramValues = new object[6];

                paramNames[0] = "OID";
                paramNames[1] = "GroupCode";
                paramNames[2] = "GroupName";
                paramNames[3] = "GroupStatus";
                paramNames[4] = "Memo";
                paramNames[5] = "Muser";

                paramValues[0] = group.OID;
                paramValues[1] = group.GroupCode;
                paramValues[2] = group.GroupName;
                paramValues[3] = group.GroupStatus;
                paramValues[4] = group.MEMO;
                paramValues[5] = group.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return false;
                }
                finally
                {
                    broker.Close();
                }
            }
            return true;
        }