Beispiel #1
0
        public int Update(FileTemplateModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new FileTemplateBLL().Update(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Beispiel #2
0
        public List <FileTemplateModel> GetFileTemplateList(string SortColumns, int StartRecord, int MaxRecords, int CodeEqual, int FileTemplateTypeCodeEqual, string FileTemplateNameEqual)
        {
            List <FileTemplateModel> models        = new List <FileTemplateModel>();
            FileTemplateQueryModel   objQueryModel = new FileTemplateQueryModel();

            objQueryModel.StartRecord = StartRecord;
            objQueryModel.MaxRecords  = MaxRecords;
            objQueryModel.SortColumns = SortColumns;
            objQueryModel.CodeEqual   = CodeEqual;
            objQueryModel.FileTemplateTypeCodeEqual = FileTemplateTypeCodeEqual;
            objQueryModel.FileTemplateNameEqual     = FileTemplateNameEqual;
            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    models = new FileTemplateBLL().GetModels(objQueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Beispiel #3
0
        public FileTemplateModel GetFileTemplate(int Code)
        {
            FileTemplateModel model = new FileTemplateModel();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    model = new FileTemplateBLL().GetModel(Code, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(model);
        }
Beispiel #4
0
        public List <FileTemplateModel> GetFileTemplateListOne(int Code)
        {
            List <FileTemplateModel> list = new List <FileTemplateModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    FileTemplateBLL ebll = new FileTemplateBLL();
                    list.Add(ebll.GetModel(Code, connection));
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(list);
        }
Beispiel #5
0
        public List <FileTemplateModel> GetFileTemplateList(FileTemplateQueryModel QueryModel)
        {
            List <FileTemplateModel> models = new List <FileTemplateModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    if (QueryModel == null)
                    {
                        QueryModel = new FileTemplateQueryModel();
                    }
                    models = new FileTemplateBLL().GetModels(QueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }