Esempio n. 1
0
        public bool UpdateBulkDFNPData(DataTable data, int DataCaptYM)
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

                data.Columns.Remove("EmpDept");
                sqlParamDictionary.Add("FinInfoData", data);
                sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _Bulk_Update_DFNP_Data);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                int result = command.ExecuteNonQuery();
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }
Esempio n. 2
0
        public bool UpdateBulkDOFAFormData(DataTable data, int DataCaptYM, string DeptID, string empDept = "")
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();
                sqlParamDictionary.Add("dofaData", data);
                sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
                sqlParamDictionary.Add("DeptID", DeptID);
                sqlParamDictionary.Add("empDept", empDept);
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _Bulk_Update_DOFA_Data);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                int result = command.ExecuteNonQuery();
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="info2"></param>
        /// <returns></returns>
        public bool InsertTostInfo2(stInfo2 info2)
        {
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(info2, _Insert_INFO2);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            command.ExecuteNonQuery();
            DBConnectionHelper.CloseSqlConnection(connection);
            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="info2"></param>
        /// <returns></returns>
        public bool UpdateToLibInfo(LibInfo libInfo)
        {
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(libInfo, _Update_LIBINFO);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            command.ExecuteNonQuery();
            DBConnectionHelper.CloseSqlConnection(connection);
            return(true);
        }
Esempio n. 5
0
        public List <TPDept> GetTPDeptFormDataByID(int DataCaptYM)
        {
            Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

            sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_TPDept_Data);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            List <TPDept> tPDepts = EntityMapper.MapCollection <TPDept>(command.ExecuteReader()).ToList();

            DBConnectionHelper.CloseSqlConnection(connection);
            return(tPDepts);
        }
Esempio n. 6
0
        public FinInfo GetDFNPDataByID(int DataCaptYM, string DeptId)
        {
            Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

            sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
            sqlParamDictionary.Add("DeptID", DeptId);
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_DFNP_Data);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            FinInfo finInfo = EntityMapper.MapSingle <FinInfo>(command.ExecuteReader());

            DBConnectionHelper.CloseSqlConnection(connection);
            return(finInfo);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="DataCaptYM"></param>
        /// <param name="DeptID"></param>
        /// <param name="MenuID"></param>
        /// <returns></returns>
        public stInfo2 GetADIRFormDataByID(int DataCaptYM, string DeptID, string MenuID)
        {
            Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

            sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
            sqlParamDictionary.Add("DeptID", DeptID);
            sqlParamDictionary.Add("MenuID", string.IsNullOrWhiteSpace(MenuID) ? "ADIR" : MenuID);
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_DOAA1_INFO);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            stInfo2 stInfo2 = EntityMapper.MapSingle <stInfo2>(command.ExecuteReader());

            DBConnectionHelper.CloseSqlConnection(connection);
            return(stInfo2);
        }
Esempio n. 8
0
        public List <DofaInfo> GetDOFAFormDataByID(int DataCaptYM, string DeptID, string empDept = "")
        {
            Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

            sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
            sqlParamDictionary.Add("DeptID", DeptID);
            sqlParamDictionary.Add("empDept", empDept);
            IDbCommand    command    = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_DOFA_Data);
            SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection = connection;
            List <DofaInfo> dofaInfos = EntityMapper.MapCollection <DofaInfo>(command.ExecuteReader()).ToList();

            DBConnectionHelper.CloseSqlConnection(connection);
            return(dofaInfos);
        }
Esempio n. 9
0
        public DataTable GetTableDetail(string TableName)
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParameterDictionary = new Dictionary <string, object>();
                sqlParameterDictionary.Add("TableName", TableName);
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParameterDictionary, _get_Table_Detail);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                SqlDataAdapter dataAdapter        = new SqlDataAdapter();
                DataSet        TableDetailDataset = new DataSet();
                dataAdapter.SelectCommand = (SqlCommand)command;
                dataAdapter.Fill(TableDetailDataset);
                return(TableDetailDataset.Tables[0]);
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }
Esempio n. 10
0
        public Tuple <List <InfraDept>, List <InfraInfo> > GetInfraFormDataByID(int DataCaptYM, string DeptId)
        {
            Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();

            sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
            sqlParamDictionary.Add("DeptId", DeptId);
            SqlDataAdapter dataAdapter = new SqlDataAdapter();
            IDbCommand     command     = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_INFRA_Data);
            SqlConnection  connection  = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);

            command.Connection        = connection;
            dataAdapter.SelectCommand = (SqlCommand)command;
            DataSet dataSet = new DataSet();

            dataAdapter.Fill(dataSet);
            DBConnectionHelper.CloseSqlConnection(connection);

            List <InfraDept> infraDepts = EntityMapper.MapCollection <InfraDept>(dataSet.Tables[0]).ToList();
            List <InfraInfo> infraInfos = EntityMapper.MapCollection <InfraInfo>(dataSet.Tables[1]).ToList();

            return(new Tuple <List <InfraDept>, List <InfraInfo> >(infraDepts, infraInfos));
        }
        public RankMesg GetRankMsg()
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParameterDictionary = new Dictionary <string, object>();
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParameterDictionary, _Get_Rank_Info_Msg);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                SqlDataAdapter dataAdapter     = new SqlDataAdapter();
                DataSet        RankMesgDataset = new DataSet();
                dataAdapter.SelectCommand = (SqlCommand)command;
                dataAdapter.Fill(RankMesgDataset);
                List <RankMesg> rankUserMenu1 = EntityMapper.MapCollection <RankMesg>(RankMesgDataset.Tables[0]).ToList();
                RankMesg        rankMesg      = rankUserMenu1.Count > 0 ? rankUserMenu1.FirstOrDefault() : new RankMesg();
                return(rankMesg);
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }
        public List <RankUserMenu> GetCurrentUserMenuByUserId(string UserID)
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParameterDictionary = new Dictionary <string, object>();
                sqlParameterDictionary.Add("UserID", UserID);
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParameterDictionary, _Get_Current_User_Menu);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                SqlDataAdapter dataAdapter         = new SqlDataAdapter();
                DataSet        RankUserMenuDataset = new DataSet();
                dataAdapter.SelectCommand = (SqlCommand)command;
                dataAdapter.Fill(RankUserMenuDataset);
                List <RankUserMenu> rankUserMenu = EntityMapper.MapCollection <RankUserMenu>(RankUserMenuDataset.Tables[0]).ToList();
                return(rankUserMenu);
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }
Esempio n. 13
0
        public bool UpdateBulkInfraFormData(DataTable infraDeptData, DataTable infraInfoData, int DataCaptYM, bool IsSaveInfraInfo)
        {
            SqlConnection connection = null;

            try
            {
                Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>();
                sqlParamDictionary.Add("InfraDeptData", infraDeptData);
                if (infraInfoData != null)
                {
                    sqlParamDictionary.Add("InfraInfoData", infraInfoData);
                }
                sqlParamDictionary.Add("DataCaptYM", DataCaptYM);
                sqlParamDictionary.Add("IsSaveInfraInfo", IsSaveInfraInfo);
                IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _Bulk_Update_INFRA_Data);
                connection         = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString);
                command.Connection = connection;
                int result = command.ExecuteNonQuery();
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DBConnectionHelper.CloseSqlConnection(connection);
            }
        }