Esempio n. 1
0
        public DataTable QuerySwitch2(QueryType QT, ArrayList ParameterList)
        {
            DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);
            DataTable Dt;

            try
            {
                Dt = Program.doQueryByFind2(ParameterList);
                return Dt;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = Program.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = Program.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = Program.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = Program.doQueryByFind(ParameterList);
                        break;
                    case QueryType.Duplicate:
                        Dt = Program.doQueryDuplicate(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 public DataTable QueryRow(ArrayList ParameterList, bool likeSearch)
 {
     try
     {
         DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);
         if (likeSearch)
         {
             ParameterList[0] = ParameterList[0] + "%"; //code
             ParameterList[1] = ParameterList[1] + "%"; //name
             ParameterList[2] = ParameterList[2];       //createdate_s
             ParameterList[3] = ParameterList[3];       //createdate_e
             ParameterList[4] = ParameterList[4] + "%"; //createuid
             ParameterList[5] = ParameterList[5];       //updatedate_s
             ParameterList[6] = ParameterList[6];       //updatedate_e
             ParameterList[7] = ParameterList[7] + "%"; //updateuid
             ParameterList[8] = ParameterList[8] + "%"; //DESCRIPTION
             ParameterList[9] = ParameterList[9] + "%"; //SYSTEMCODE
             ParameterList[10] = ParameterList[10] + "%"; //PARENTCODE
             ParameterList[11] = ParameterList[11] + "%"; //LINKURL
             ParameterList[12] = ParameterList[12] ; //OPERATOR
             ParameterList[13] = ParameterList[13] ; //DISPLAYORDER
             ParameterList[14] = ParameterList[14] + "%"; //PROGRAMTYPE
             ParameterList[15] = ParameterList[15]; //ISVISUAL
             ParameterList[16] = ParameterList[16]; //ENABLE
             ParameterList[17] = ParameterList[17]; //rownum
         }
         return Program.QueryRow(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 基本表單刪除BCO
        /// </summary>
        /// <param name="ParameterList">刪除變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <returns>回傳影響筆數</returns>
        public int DeleteProgramReturn(ArrayList ParameterList,
                                      DbTransaction RootDBT
                                      )
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);

                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                int DeleteRecord = Program.doDeleteReturn(ParameterList, DBT);                

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }
                return DeleteRecord;

                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }


        }
Esempio n. 5
0
 public DataTable QueryByLikeForSLP(ArrayList ParameterList)
 {
     try
     {
         DBO.SYS_ProgramDBO User = new SYS_ProgramDBO(ref USEDB);
         ParameterList[0] = ParameterList[0] + "%"; //CODE
         ParameterList[1] = ParameterList[1] + "%"; //NAME
         return User.doQueryByLikeForSLP(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
 public DataTable QueryForSLP(ArrayList ParameterList)
 {
     try
     {
         DBO.SYS_ProgramDBO User = new SYS_ProgramDBO(ref USEDB);
         return User.doQueryForSLP(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 抓出系統第一層級的程式清單
 /// </summary>
 /// <param name="ParameterList">輸入變數</param>
 /// <returns>回傳第一層的程式清單</returns>
 public DataTable QueryFirstLevelProgram(ArrayList ParameterList)
 {
     try
     {
         DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);
         return Program.doQueryFirstLevelProgram(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        /// <summary>
        /// 列出所有程式並依使用者判斷可否使用
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <returns></returns>
        public DataTable QueryAllProgramForUser(ArrayList ParameterList)
        {
            try
            {
                int i = 0;
                int j = 0;
                SYS_ProgramDBO prog = new SYS_ProgramDBO(ref USEDB);
                SYS_ROLEPROGAUTHRELDBO rolepg = new SYS_ROLEPROGAUTHRELDBO(ref USEDB);
                SYS_USERPROGAUTHRELDBO userpg = new SYS_USERPROGAUTHRELDBO(ref USEDB);
                //抓取目前所有程式
                DataTable ProgramDt = prog.doQueryAllWithStatus();
                //抓取目前使用者所屬角色所有程式
                DataTable RolePGDt = rolepg.doQueryByUserID(ParameterList);

                //列出角色權限與功能列表相符清單
                for (i = 0; i < ProgramDt.Rows.Count; i++)
                {
                    for (j = 0; j < RolePGDt.Rows.Count; j++)
                    {
                        //角色權限與功能列表相符
                        if (ProgramDt.Rows[i]["CODE"].ToString() == RolePGDt.Rows[j]["PROGRAMCODE"].ToString())
                        {
                            //如果未被設定開啟
                            if (ProgramDt.Rows[i]["Status"].ToString() == "0")
                            {
                                ProgramDt.Rows[i]["Status"] = 1;
                            }
                        }
                    }
                }

                //列出使用者權限與功能列表相符清單
                DataTable UserPGDt = userpg.doQueryByUserID(ParameterList);

                for (i = 0; i < ProgramDt.Rows.Count; i++)
                {
                    for (j = 0; j < UserPGDt.Rows.Count; j++)
                    {
                        //人員權限與功能列表相符
                        if (ProgramDt.Rows[i]["CODE"].ToString() == UserPGDt.Rows[j]["PROGRAMCODE"].ToString())
                        {
                            //如果未被設定開啟
                            if (ProgramDt.Rows[i]["Status"].ToString() == "0")
                            {
                                ProgramDt.Rows[i]["Status"] = 1;
                            }
                        }
                    }
                }

                return ProgramDt;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Esempio n. 9
0
 public DataTable QueryModule()
 {
     try
     {
         DBO.SYS_ProgramDBO Program = new SYS_ProgramDBO(ref USEDB);
         return Program.doQueryModule();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }