Ejemplo n.º 1
0
        public List <SYS_Catagory> SelectListCombo(string tableName, int ID, string Connection)
        {
            SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess();
            DbConnection connection = _DbHelper.CreateConnection(connect.DecryptSYS_ConfigConnection(Connection));

            connection.Open();
            List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>();
            DbDataReader        reader       = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false));
                para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false));

                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectListCombo]", (DbParameter[])para.ToArray());
                if (reader.HasRows)
                {
                    SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_CatagoryDataAccess.SelectListCombo: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(SYS_Catagory);
        }
Ejemplo n.º 2
0
        public List <SYS_Catagory> SelectSYS_CatagoryByIdNhanSuXa(int ID, DbConnection connection)
        {
            SYS_ConfigConnectionDataAccess connect      = new SYS_ConfigConnectionDataAccess();
            List <SYS_Catagory>            SYS_Catagory = new List <SYS_Catagory>();
            //DbConnection connection = _DbHelper.CreateConnection(Common.ConnectionString);


            DbDataReader reader = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter("IDNhanSu", ID, false));


                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectByIdNhanSuXa]", para.ToArray());
                if (reader.HasRows)
                {
                    SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CatagoryDataAccess.SelectSYS_CatagoryByIdNhanSuXáS: {0}", ex.Message));
            }
            //finally
            //{
            //    if (reader != null)
            //        reader.Close();
            //    connection.Close();
            //}
            return(SYS_Catagory);
        }
Ejemplo n.º 3
0
        public List <SYS_Organization> SelectAllSYS_Organization(string connect)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();

            connect = connectionDataAccess.DecryptSYS_ConfigConnection(connect);
            DbConnection conn = _DbHelper.CreateConnection(connect);

            conn.Open();
            List <SYS_Organization> sys_organization = new List <SYS_Organization>();
            DbDataReader            reader           = null;

            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Organization_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_OrganizationDataAccess.SetListSYS_OrganizationInfo(ref reader, ref sys_organization);
                }
                return(sys_organization);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_OrganizationDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Ejemplo n.º 4
0
        public SYS_Language SelectSYS_Language(int sys_LanguageId, string connect)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();

            connect = connectionDataAccess.DecryptSYS_ConfigConnection(connect);
            SYS_Language sys_language = new SYS_Language();
            DbDataReader reader       = null;
            DbConnection connection   = _DbHelper.CreateConnection(connect);

            connection.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_ID, sys_LanguageId, false));

                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Language_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_LanguageDataAccess.SetSYS_LanguageInfo(reader, ref sys_language);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_LanguageDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(sys_language);
        }
Ejemplo n.º 5
0
        public List <SYS_Right> GetAllRightsByUser(SYS_User user, string connect)
        {
            List <SYS_Right> result = new List <SYS_Right>();
            DbDataReader     reader = null;
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();

            connect = connectionDataAccess.DecryptSYS_ConfigConnection(connect);
            DbConnection dbConnection = Common.CreateConnection(connect);

            dbConnection.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter("UserName", user.UserName, false));
                reader = _DbHelper.ExecuteReader(dbConnection, Common.DatabaseSchema + "[SYS_ALLRight_GetByUser]", para.ToArray());
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        SYS_Right temp = new SYS_Right();
                        SetSYS_RightInfo(reader, ref temp);
                        temp.IsApprove = Boolean.Parse(reader[FIELD_APPROVE].ToString());
                        temp.IsDelete  = Boolean.Parse(reader[FIELD_DELETE].ToString());
                        temp.IsCreate  = Boolean.Parse(reader[FIELD_CREATE].ToString());
                        temp.IsUpdate  = Boolean.Parse(reader[FIELD_UPDATE].ToString());
                        temp.ModuleID  = int.Parse(reader[FIELD_MODULEID] + "");
                        result.Add(temp);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_RightDataAccess.GetRightsByUser: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                dbConnection.Close();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sử dụng cho các bảng về VTHCPD
        /// </summary>
        /// <param name="TableNotIn"></param>
        /// <param name="IDDonVi"></param>
        /// <param name="Year"></param>
        /// <param name="ParentID"></param>
        /// <param name="tableName"></param>
        /// <param name="Connection"></param>
        /// <returns></returns>
        public List <SYS_Catagory> SelectSYS_CatagoryByParentIDNotInTable(string TableNotIn, int IDDonVi, int IDChungLoai, int Year, string ParentID, string tableName, string Connection)
        {
            SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess();

            Connection = connect.DecryptSYS_ConfigConnection(Connection);
            DbConnection connection = _DbHelper.CreateConnection(Connection);

            connection.Open();
            List <SYS_Catagory> SYS_Catagory = new List <SYS_Catagory>();
            DbDataReader        reader       = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_PARENTID, ParentID, false));
                para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false));
                para.Add(_DbHelper.CreateParameter("TableNotIn", TableNotIn, false));
                para.Add(_DbHelper.CreateParameter("IDDonVi", IDDonVi, false));
                para.Add(_DbHelper.CreateParameter("DBYear", Year, false));
                para.Add(_DbHelper.CreateParameter("IDChungLoai", IDChungLoai, false));

                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectByParentIdNotInTable]", para.ToArray());
                if (reader.HasRows)
                {
                    SYS_CatagoryDataAccess.SetListSYS_CatagoryInfo(ref reader, ref SYS_Catagory);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CatagoryDataAccess.SelectByIdNotInTable: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(SYS_Catagory);
        }
Ejemplo n.º 7
0
        public List <SYS_Organization> SelectByCodeType(string Code)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            List <SYS_Organization> sys_organization = new List <SYS_Organization>();
            DbDataReader            reader           = null;

            try
            {
                if (!string.IsNullOrEmpty(Code))
                {
                    List <DbParameter> para = new List <DbParameter>();
                    para.Add(_DbHelper.CreateParameter("Code", Code, false));
                    reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Organization_SelectByCodeType]", para.ToArray());
                }
                else
                {
                    reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Organization_SelectByCodeType]",
                                                     (DbParameter[])null);
                }
                if (reader.HasRows)
                {
                    SYS_OrganizationDataAccess.SetListSYS_OrganizationInfo(ref reader, ref sys_organization);
                }
                return(sys_organization);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_OrganizationDataAccess.SelectByCodeType: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Ejemplo n.º 8
0
        public SYS_UserConfig SelectByUserID_UserConfigByStrCn(string connect, int UserId)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();

            connect = connectionDataAccess.DecryptSYS_ConfigConnection(connect);
            DbConnection conn = _DbHelper.CreateConnection(connect);

            conn.Open();
            SYS_UserConfig userConfig = new SYS_UserConfig();
            DbDataReader   reader     = null;

            List <DbParameter> para = new List <DbParameter>();

            para.Add(_DbHelper.CreateParameter(FIELD_USERID, UserId, false));
            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_UserConfig_SelectByUserId]", para.ToArray());
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        SetSYS_UserConfigInfo(reader, ref userConfig);
                    }
                }

                return(userConfig);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_UserConfigDataAccess.SYS_UserConfig_SelectByUserId: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Ejemplo n.º 9
0
        public void DeleteSYS_Catagory(SYS_Catagory SYS_Catagory, string tableName, string Connection)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();
            DbConnection connection = Common.CreateConnection(connectionDataAccess.DecryptSYS_ConfigConnection(Connection));

            connection.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_ID, SYS_Catagory.ID, false));
                para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false));

                _DbHelper.ExecuteNonQuery(connection, Common.DatabaseSchema + "[SYS_Catagory_Delete]",
                                          para.ToArray());
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CatagoryDataAccess.DeleteSYS_Catagory: {0}", ex.Message));
            }
            finally
            {
                connection.Close();
            }
        }
Ejemplo n.º 10
0
        public SYS_Catagory SelectSYS_CatagoryByName(string Name, string tableName)
        {
            SYS_ConfigConnectionDataAccess connect = new SYS_ConfigConnectionDataAccess();

            DbConnection connection = _DbHelper.CreateConnection(Common.ConnectionString);

            connection.Open();
            SYS_Catagory SYS_Catagory = new SYS_Catagory();
            DbDataReader reader       = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_NAME, Name, false));
                para.Add(_DbHelper.CreateParameter(FIELD_TABLENAME, tableName, false));

                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Catagory_SelectByName]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_CatagoryDataAccess.SetSYS_CatagoryInfo(reader, ref SYS_Catagory);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CatagoryDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(SYS_Catagory);
        }
Ejemplo n.º 11
0
        public List <SYS_Organization> SelectAllSYS_Organization_GetByUserID(int ID, string connect)
        {
            SYS_ConfigConnectionDataAccess connectionDataAccess = new SYS_ConfigConnectionDataAccess();

            connect = connectionDataAccess.DecryptSYS_ConfigConnection(connect);
            DbConnection conn = _DbHelper.CreateConnection(connect);

            conn.Open();
            List <SYS_Organization> sys_organization = new List <SYS_Organization>();
            DbDataReader            reader           = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Organization_GetByUserID]", para.ToArray());
                if (reader.HasRows)
                {
                    SYS_OrganizationDataAccess.SetListSYS_OrganizationInfo(ref reader, ref sys_organization);
                }
                return(sys_organization);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_OrganizationDataAccess.SelectByUserId: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }