public async Task <SaveResult> UpdateAsync(CongViecQuaTrinhXuLyResult entity)
        {
            return(await ExecuteDbWithHandle(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.CongViec_QuaTrinhXuLy
                                 .Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.GioBanHanh = entity.GioBanHanh;
                    update.PhutBanHanh = entity.PhutBanHanh;
                    update.NgayBanHanh = entity.NgayBanHanh;
                    update.NguoiThem = entity.NguoiThem;
                    update.NhacNho = entity.NhacNho;
                    update.NoiDung = entity.NoiDung;
                    update.HoSoCongViecId = entity.HoSoCongViecId;
                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 2
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <TacNghiepYKienCoQuanResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    TacNghiep_YKienCoQuan add;
                    foreach (var entity in entities)
                    {
                        add = context.TacNghiep_YKienCoQuan.Create();

                        add.NoiDung = entity.NoiDung;
                        add.TacNghiepId = entity.TacNghiepId;
                        add.CoQuanId = entity.CoQuanId;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
        public async Task <SaveResult> AddAsync(CongViecQuaTrinhXuLyResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var add = context.CongViec_QuaTrinhXuLy.Create();

                    add.HoSoCongViecId = entity.HoSoCongViecId;
                    add.GioBanHanh = entity.GioBanHanh;
                    add.PhutBanHanh = entity.PhutBanHanh;
                    add.NgayBanHanh = entity.NgayBanHanh;
                    add.NguoiThem = entity.NguoiThem;
                    add.NhacNho = entity.NhacNho;
                    add.NoiDung = entity.NoiDung;

                    add.IsDeleted = entity.IsDeleted;
                    add.CreatedBy = entity.CreatedBy;
                    add.CreateDate = DateTime.Now;

                    context.Entry(add).State = EntityState.Added;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Adds the range asynchronous.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public async Task <SaveResult> AddRangeAsync(IEnumerable <UserResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    User add;
                    foreach (var entity in entities)
                    {
                        add = context.Users.Create();

                        add.UserName = entity.UserName;
                        add.Password = AppCipher.EncryptCipher(entity.Password);
                        add.IsLocked = entity.IsLocked;
                        add.HoVaTen = entity.HoVaTen;
                        add.ChucVuId = entity.ChucVuId;
                        add.CoQuanId = entity.CoQuanId;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 5
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <TapTinThuTucResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    TapTinThuTuc add;
                    foreach (var entity in entities)
                    {
                        add = context.TapTinThuTucs.Create();

                        add.Url = entity.Url;
                        add.UserUploadId = entity.UserUploadId;
                        add.ThuTucId = entity.ThuTucId;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 6
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <CongViecVanBanResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    foreach (var entity in entities)
                    {
                        var add = context.CongViec_VanBan.Create();

                        add.HoSoCongViecId = entity.HoSoCongViecId;
                        add.NgayBanHanh = entity.NgayBanHanh;
                        add.NoiDung = entity.NoiDung;
                        add.SoVanBan = entity.SoVanBan;
                        add.CoQuanId = entity.CoQuanId;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 7
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <MucDoHoanThanhResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    MucDoHoanThanh add;
                    foreach (var entity in entities)
                    {
                        add = context.MucDoHoanThanhs.Create();

                        add.Ten = entity.Ten;
                        add.MoTa = entity.MoTa;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 8
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <TacNghiepTinhHinhThucHienResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    foreach (var entity in entities)
                    {
                        var add = context.TacNghiep_TinhHinhThucHien.Create();

                        add.ThoiGian = entity.ThoiGian;
                        add.MucDoHoanThanhId = entity.MucDoHoanThanhId;
                        add.TacNghiepId = entity.TacNghiepId;
                        add.CoQuanId = entity.CoQuanId;

                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 9
0
        public async Task <SaveResult> UpdateAsync(CoQuanResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.CoQuans.FirstOrDefault(x => x.Id == entity.Id && x.IsDeleted == false);

                    if (update == null)
                    {
                        return SaveResult.FAILURE;
                    }

                    update.Ten = entity.Ten;
                    update.MoTa = entity.MoTa;
                    update.NhomCoQuanId = entity.NhomCoQuanId;
                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 10
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <NewsResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    foreach (var entity in entities)
                    {
                        var add = context.News.Create();

                        add.Title = entity.Title;
                        add.Content = entity.Content;
                        add.Summary = entity.Summary;
                        add.UrlImage = entity.UrlImage;
                        add.NewsCategoryId = entity.NewsCategoryId;
                        add.IsDeleted = entity.IsDeleted;
                        add.CreatedBy = entity.CreatedBy;
                        add.CreateDate = DateTime.Now;

                        context.Entry(add).State = EntityState.Added;
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 11
0
        public async Task <SaveResult> AddAsync(HoSoCongViecResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var add = context.HoSoCongViecs.Create();

                    add.NgayHetHan = entity.NgayHetHan;
                    add.UserPhuTrachId = entity.UserPhuTrachId;
                    add.UserXuLyId = entity.UserXuLyId;
                    add.LinhVucCongViecId = entity.LinhVucCongViecId;
                    add.NoiDung = entity.NoiDung;
                    add.DanhGiaCongViec = entity.DanhGiaCongViec;
                    add.TrangThaiCongViecId = entity.TrangThaiCongViecId;

                    add.IsDeleted = entity.IsDeleted;
                    add.CreatedBy = entity.CreatedBy;
                    add.CreateDate = DateTime.Now;

                    context.Entry(add).State = EntityState.Added;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 12
0
        public async Task <SaveResult> UpdateAsync(HoSoCongViecResult entity)
        {
            return(await ExecuteDbWithHandle(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.HoSoCongViecs.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.NgayHetHan = entity.NgayHetHan;
                    update.UserPhuTrachId = entity.UserPhuTrachId;
                    update.UserXuLyId = entity.UserXuLyId;
                    update.LinhVucCongViecId = entity.LinhVucCongViecId;
                    update.NoiDung = entity.NoiDung;
                    update.DanhGiaCongViec = entity.DanhGiaCongViec;

                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 13
0
 public async Task <SaveResult> AddAsync(TacNghiepResult entity)
 {
     return(await ExecuteDbWithHandleAsync(_logService, async() =>
     {
         using (var context = new TechOfficeEntities())
         {
             entity.AddToDb(context);
             return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
         }
     }));
 }
Ejemplo n.º 14
0
        public async Task <SaveResult> DeleteAsync(VanBanResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var cv = context.VanBans.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    cv.DeleteToDb(context, entity.LastUpdatedBy);
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     Deletes the by asynchronous.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <SaveResult> DeleteByAsync(int id)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var assembly = context.Users.Single(x => x.Id == id && x.IsDeleted == false);
                    assembly.IsDeleted = true;

                    context.Entry(assembly).State = EntityState.Modified;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 16
0
        public async Task <SaveResult> DeleteByAsync(int id)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var tt = context.LinhVucThuTucs.Single(x => x.Id == id && x.IsDeleted == false);

                    tt.DeleteToDb(context);

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 17
0
        public async Task <SaveResult> UpdateAsync(LinhVucThuTucResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.LinhVucThuTucs.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.UpdateToDb(entity, context);

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Resets the password asynchronous.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="newPassword">The new password.</param>
        /// <returns></returns>
        public async Task <SaveResult> ResetPasswordAsync(int id, string newPassword)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.Users.Single(x => x.Id == id && x.IsDeleted == false);

                    update.Password = AppCipher.EncryptCipher(newPassword);

                    context.Entry(update).State = EntityState.Modified;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 19
0
        public async Task <SaveResult> DeleteByAsync(int id)
        {
            return(await ExecuteDbWithHandle(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var cv = context.CongViec_PhoiHop.Single(x => x.Id == id && x.IsDeleted == false);
                    cv.IsDeleted = true;
                    cv.LastUpdated = DateTime.Now;

                    context.Entry(cv).State = EntityState.Modified;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 20
0
        public async Task <SaveResult> DeleteByAsync(int id)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var cv = context.TacNghiep_TinhHinhThucHien.Single(x => x.Id == id && x.IsDeleted == false);
                    cv.IsDeleted = true;

                    context.Entry(cv).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 21
0
        public async Task <SaveResult> AddRangeAsync(IEnumerable <LinhVucThuTucResult> entities)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    foreach (var entity in entities)
                    {
                        entity.AddToDb(context);
                    }

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 22
0
        /// <summary>
        ///     Deletes the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task <SaveResult> DeleteAsync(RoleResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var role = context.Roles.Single(x => x.Id == entity.Id && x.IsDeleted == false);
                    role.IsDeleted = true;
                    role.LastUpdated = DateTime.Now;
                    role.LastUpdatedBy = entity.LastUpdatedBy;

                    context.Entry(role).State = EntityState.Modified;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 23
0
        public async Task <SaveResult> AddAsync(ThuTucResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    using (var transaction = context.BeginTransaction())
                    {
                        entity.AddToDb(context);
                        var result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;

                        transaction.Commit();

                        return result;
                    }
                }
            }));
        }
Ejemplo n.º 24
0
        public async Task <SaveResult> DeleteAsync(TacNghiepYKienCoQuanResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var cv = context.TacNghiep_YKienCoQuan.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    cv.IsDeleted = true;
                    cv.LastUpdatedBy = entity.LastUpdatedBy;
                    cv.LastUpdated = DateTime.Now;

                    context.Entry(cv).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 25
0
        public async Task <SaveResult> AddAsync(ChucVuResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var add = context.ChucVus.Create();

                    add.Ten = entity.Ten;
                    add.MoTa = entity.MoTa;
                    add.IsDeleted = entity.IsDeleted;
                    add.CreatedBy = entity.CreatedBy;
                    add.CreateDate = DateTime.Now;

                    context.Entry(add).State = EntityState.Added;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 26
0
        public async Task <SaveResult> UpdateAsync(MucDoHoanThanhResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.MucDoHoanThanhs.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.Ten = entity.Ten;
                    update.MoTa = entity.MoTa;
                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
        public async Task <SaveResult> AddAsync(TapTinYKienCoQuanResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var add = context.TapTinYKienCoQuans.Create();

                    add.Url = entity.Url;
                    add.UserUploadId = entity.UserUploadId;
                    add.YKiencoQuanTacNghiepId = entity.YKienCoQuanId;

                    add.IsDeleted = entity.IsDeleted;
                    add.CreatedBy = entity.CreatedBy;
                    add.CreateDate = DateTime.Now;

                    context.Entry(add).State = EntityState.Added;
                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
        public async Task <SaveResult> UpdateAsync(TapTinYKienCoQuanResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.TapTinYKienCoQuans.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.Url = entity.Url;
                    update.UserUploadId = entity.UserUploadId;
                    update.YKiencoQuanTacNghiepId = entity.YKienCoQuanId;
                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 29
0
        public async Task <SaveResult> UpdateAsync(CongViecPhoiHopResult entity)
        {
            return(await ExecuteDbWithHandle(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var update = context.CongViec_PhoiHop
                                 .Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    update.UserId = entity.UserId;
                    update.HoSoCongViecId = entity.HoSoCongViecId;
                    update.IsDeleted = entity.IsDeleted;
                    update.LastUpdatedBy = entity.LastUpdatedBy;
                    update.LastUpdated = DateTime.Now;

                    context.Entry(update).State = EntityState.Modified;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }
Ejemplo n.º 30
0
        public async Task <SaveResult> AddAsync(CongViecPhoiHopResult entity)
        {
            return(await ExecuteDbWithHandleAsync(_logService, async() =>
            {
                using (var context = new TechOfficeEntities())
                {
                    var add = context.CongViec_PhoiHop.Create();

                    add.HoSoCongViecId = entity.HoSoCongViecId;
                    add.UserId = entity.UserId;

                    add.IsDeleted = entity.IsDeleted;
                    add.CreatedBy = entity.CreatedBy;
                    add.CreateDate = DateTime.Now;

                    context.Entry(add).State = EntityState.Added;

                    return await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }));
        }