Example #1
0
        public int Update(OAPersonContractModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new OAPersonContractBLL().Update(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Example #2
0
        public OAPersonContractModel GetOAPersonContract(int Code)
        {
            OAPersonContractModel model = new OAPersonContractModel();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    model = new OAPersonContractBLL().GetModel(Code, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(model);
        }
Example #3
0
        public List <OAPersonContractModel> GetOAPersonContractListOne(int Code)
        {
            List <OAPersonContractModel> list = new List <OAPersonContractModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    OAPersonContractBLL tbll = new OAPersonContractBLL();
                    list.Add(tbll.GetModel(Code, connection));
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(list);
        }
Example #4
0
        public List <OAPersonContractModel> GetOAPersonContractList(OAPersonContractQueryModel QueryModel)
        {
            List <OAPersonContractModel> models = new List <OAPersonContractModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    if (QueryModel == null)
                    {
                        QueryModel = new OAPersonContractQueryModel();
                    }
                    models = new OAPersonContractBLL().GetModels(QueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Example #5
0
        public List <OAPersonContractModel> GetOAPersonContractList(string SortColumns, int StartRecord, int MaxRecords, string PersonIDEqual)
        {
            List <OAPersonContractModel> models        = new List <OAPersonContractModel>();
            OAPersonContractQueryModel   objQueryModel = new OAPersonContractQueryModel();

            objQueryModel.StartRecord   = StartRecord;
            objQueryModel.MaxRecords    = MaxRecords;
            objQueryModel.SortColumns   = SortColumns;
            objQueryModel.PersonIDEqual = PersonIDEqual;
            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    models = new OAPersonContractBLL().GetModels(objQueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }