Beispiel #1
0
        private static DM_COSOKCB ConvertDmCSKCB(DM_COSOKCB cskcb)
        {
            DM_COSOKCB dmcskcb = new DM_COSOKCB();

            dmcskcb.ID                = cskcb.ID;
            dmcskcb.TEN               = cskcb.TEN;
            dmcskcb.MA                = cskcb.MA;
            dmcskcb.MABHYT            = cskcb.MABHYT;
            dmcskcb.DONVIHANHCHINH_ID = cskcb.DONVIHANHCHINH_ID;
            dmcskcb.DIACHI            = cskcb.DIACHI;
            dmcskcb.HANGBENHVIEN      = cskcb.HANGBENHVIEN;
            dmcskcb.TUYENCMKT         = cskcb.TUYENCMKT;
            dmcskcb.HIEULUC           = cskcb.HIEULUC;
            dmcskcb.STT               = cskcb.STT;
            dmcskcb.MIEUTA            = cskcb.MIEUTA;
            dmcskcb.TINHTHANH_ID      = cskcb.TINHTHANH_ID;
            dmcskcb.DONVI_ID          = cskcb.DONVI_ID;
            dmcskcb.QUANHUYEN_ID      = cskcb.QUANHUYEN_ID;
            dmcskcb.MAQUANHUYEN       = cskcb.MAQUANHUYEN;
            dmcskcb.MATINHTHANH       = cskcb.MATINHTHANH;
            dmcskcb.MADONVI           = cskcb.MADONVI;
            dmcskcb.DM_DONVI          = cskcb.DM_DONVI;
            dmcskcb.MACOSOKCBCHA      = cskcb.MACOSOKCBCHA;
            dmcskcb.COSOKCBCHA_ID     = cskcb.COSOKCBCHA_ID;
            dmcskcb.THANNHANTAO       = cskcb.THANNHANTAO;
            dmcskcb.THAIGHEP          = cskcb.THAIGHEP;
            dmcskcb.LOAIHOPDONG       = cskcb.LOAIHOPDONG;
            dmcskcb.DKKCBBD           = cskcb.DKKCBBD;
            dmcskcb.HINHTHUCTT        = cskcb.HINHTHUCTT;
            dmcskcb.LOAIBENHVIEN      = cskcb.LOAIBENHVIEN;
            dmcskcb.KHAMTREEM         = cskcb.KHAMTREEM;
            dmcskcb.NGAYNGUNGHD       = cskcb.NGAYNGUNGHD;
            dmcskcb.MATAICHINH        = cskcb.MATAICHINH;
            dmcskcb.DIENTHOAI         = cskcb.DIENTHOAI;
            dmcskcb.MASOTHUE          = cskcb.MASOTHUE;
            dmcskcb.EMAIL             = cskcb.EMAIL;
            dmcskcb.FAX               = cskcb.FAX;
            dmcskcb.PKDAKHOA          = cskcb.PKDAKHOA;
            dmcskcb.UNGTHU            = cskcb.UNGTHU;
            dmcskcb.VIEMGAN           = cskcb.VIEMGAN;
            dmcskcb.TEBAOMAUTD        = cskcb.TEBAOMAUTD;
            dmcskcb.KHAMT7            = cskcb.KHAMT7;
            dmcskcb.KHAMCN            = cskcb.KHAMCN;
            dmcskcb.KHAMNGAYLE        = cskcb.KHAMNGAYLE;
            dmcskcb.KIEUBV            = cskcb.KIEUBV;
            dmcskcb.CAPCSKCB_MIN      = cskcb.CAPCSKCB_MIN;
            dmcskcb.SOHOPDONG         = cskcb.SOHOPDONG;
            dmcskcb.COQUANCHUQUAN     = cskcb.COQUANCHUQUAN;
            dmcskcb.TTPHEDUYET        = cskcb.TTPHEDUYET;
            dmcskcb.LYDO              = cskcb.LYDO;
            dmcskcb.TRANGTHAI         = cskcb.TRANGTHAI;
            dmcskcb.NGAYKYHOPDONG     = cskcb.NGAYKYHOPDONG;
            dmcskcb.TUCHU             = cskcb.TUCHU;
            dmcskcb.HANGDICHVU_TD     = cskcb.HANGDICHVU_TD;
            dmcskcb.HANGTHUOC_TD      = cskcb.HANGTHUOC_TD;
            dmcskcb.HANGVATTU_TD      = cskcb.HANGVATTU_TD;
            dmcskcb.BYT               = cskcb.BYT;
            return(dmcskcb);
        }
 public static void HuyDeNghiTamNgung(this DM_COSOKCB model)
 {
     model.HIEULUC    = true;
     model.TRANGTHAI  = 2;
     model.TTPHEDUYET = 7;
 }
 public static void HuyDeNghiActiveLonHon6Thang(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 4;
     model.TTPHEDUYET = 14;
 }
 public static void PheDuyetHopDongLonHon6Thang(this DM_COSOKCB model)
 {
     model.HIEULUC    = true;
     model.TRANGTHAI  = 4;
     model.TTPHEDUYET = 1;
 }
 public static void HuyDuyetDangKy(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 0;
     model.TTPHEDUYET = 2;
 }
 public static bool TrangThaiDuyetDeNghiTamNgung(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 2 && model.TTPHEDUYET == 6 && model.HIEULUC == false);
 }
 public static void ThemMoi(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 0;
     model.TTPHEDUYET = 4;
 }
 public static void ActiveCSKCB(this DM_COSOKCB model)
 {
     model.HIEULUC    = true;
     model.TRANGTHAI  = 1;
     model.TTPHEDUYET = 1;
 }
 public static void DuyetTamNgung(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 2;
     model.TTPHEDUYET = 6;
 }
 public static bool CdActiveHopDongLonHon6Thang(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 4 && model.TTPHEDUYET == 13 && model.HIEULUC == false);
 }
 public static void DuyetDangKyChoActive(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 1;
     model.TTPHEDUYET = 1;
 }
 public static bool TuChoiDuyetCapMoi(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 0 && model.TTPHEDUYET == 2 && model.HIEULUC == false);
 }
 public static bool ChoKichHoat(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 1 && model.TTPHEDUYET == 1 && model.HIEULUC == false);
 }
 public static bool TaoMoi(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 0 && model.TTPHEDUYET == 4 && model.HIEULUC == false);
 }
Beispiel #15
0
 public bool PushNguoiDung(string key, NGUOIDUNG nguoidung)
 {
     try
     {
         //KhoiTao();
         _iDonviService     = IoC.Resolve <IDM_DONVIService>();
         _iDmcosokcbServcie = IoC.Resolve <IDMCOSOKCBService>();
         if (!string.IsNullOrEmpty(key) && nguoidung != null)
         {
             if (nguoidung.COSOKCB != null)
             {
                 nguoidung.COSOKCB.COSOKCBCHA = null;
                 //nguoidung.COSOKCB.DM_DONVIHANHCHINH = null;
                 //nguoidung.COSOKCB.DM_TINHTHANH = null;
                 //nguoidung.COSOKCB.DM_QUANHUYEN = null;
                 if (nguoidung.COSOKCB.DM_DONVI != null)
                 {
                     DM_DONVI donvi = new DM_DONVI();
                     donvi = _iDonviService.Getbykey(nguoidung.COSOKCB.DM_DONVI.ID);
                     if (donvi != null)
                     {
                         donvi.DONVICHA = null;
                         // donvi.TINHTHANH = null;
                         nguoidung.COSOKCB.DM_DONVI = ConvertDmDonVi(donvi);
                     }
                 }
                 nguoidung.COSOKCB.DM_DONVI = null;
             }
             for (int i = 0; i < nguoidung.COSOKCBS.Count; i++)
             {
                 if (nguoidung.COSOKCBS[i].IsProxy())
                 {
                     DM_COSOKCB cskcb = _iDmcosokcbServcie.Getbykey(nguoidung.COSOKCBS[i].ID);
                     if (cskcb != null)
                     {
                         cskcb.COSOKCBCHA = null;
                         //cskcb.DM_DONVIHANHCHINH = null;
                         //cskcb.DM_TINHTHANH = null;
                         //cskcb.DM_QUANHUYEN = null;
                         if (cskcb.DM_DONVI != null)
                         {
                             DM_DONVI donvi = new DM_DONVI();
                             donvi = _iDonviService.Getbykey(nguoidung.COSOKCBS[i].DM_DONVI.ID);
                             if (donvi != null)
                             {
                                 donvi.DONVICHA = null;
                                 //  donvi.TINHTHANH = null;
                                 cskcb.DM_DONVI = ConvertDmDonVi(donvi);
                             }
                         }
                         nguoidung.COSOKCBS[i] = ConvertDmCSKCB(cskcb);
                     }
                 }
                 else
                 {
                     nguoidung.COSOKCBS[i].COSOKCBCHA = null;
                     //nguoidung.COSOKCBS[i].DM_DONVIHANHCHINH = null;
                     //nguoidung.COSOKCBS[i].DM_TINHTHANH = null;
                     //nguoidung.COSOKCBS[i].DM_QUANHUYEN = null;
                     if (nguoidung.COSOKCBS[i].DM_DONVI != null)
                     {
                         if (nguoidung.COSOKCBS[i].DM_DONVI.IsProxy())
                         {
                             DM_DONVI donvi = new DM_DONVI();
                             donvi = _iDonviService.Getbykey(nguoidung.COSOKCBS[i].DM_DONVI.ID);
                             if (donvi != null)
                             {
                                 donvi.DONVICHA = null;
                                 //donvi.TINHTHANH = null;
                                 nguoidung.COSOKCBS[i].DM_DONVI = ConvertDmDonVi(donvi);
                             }
                         }
                         else
                         {
                             nguoidung.COSOKCBS[i].DM_DONVI.DONVICHA = null;
                             // nguoidung.COSOKCBS[i].DM_DONVI.TINHTHANH = null;
                         }
                     }
                 }
             }
             var value = JsonConvert.SerializeObject(nguoidung);
             return(db.StringSet(key, value));
         }
         return(false);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
         return(false);
     }
 }
 public static void DenNghiActiveHopDongNhoHon6Thang(this DM_COSOKCB model)
 {
     model.HIEULUC    = false;
     model.TRANGTHAI  = 3;
     model.TTPHEDUYET = 11;
 }
        public ActionResult BatchEditingUpdateModel(MVCxGridViewBatchUpdateValues <COCAUGIA_THUCTE_CT, int> updateValues)
        {
            /*
             * foreach (var item in updateValues.Update)
             * {
             *  var data = new COCAUGIA_PHATSINH();
             *
             *  data.CHITIET_ID = Convert.ToInt32(item.ID);
             *  data.COSOKCB_ID = Convert.ToInt32(Session["cskcbId"]);
             *  data.SP_HSBA = Convert.ToString(Session["spHsba"]);
             *  data.DONGIA_PS = item.DONGIA_CC;
             *  data.SOLUONG_PS = item.SOLUONG_CC;
             *  data.THANHTIEN_PS = data.SOLUONG_PS * data.DONGIA_PS;
             *
             *  _ICOCAUGIA_PHATSINHService.Save(data);
             * }*/

            long?idThucTe = Session["idThucTe"] as long?;

            // Lấy danh sách các COCAUGIA_THUCTE_CT trong session (được clone từ COCAUGIA_CHITIET)
            var thucTeCts = Session["_GridViewChiTietDichVuPartial"] as List <COCAUGIA_THUCTE_CT>;

            // Tạo dữ liệu mới
            if (idThucTe == null)
            {
                long?idDichVu = Session["idDichVu"] as long?;
                if (idDichVu != null)
                {
                    // Lấy dịch vụ
                    COCAUGIA_DICHVU21 dichvu21 = _ICOCAUGIA_DICHVU21Service.getById(idDichVu.Value).FirstOrDefault();

                    // Lấy cơ sở KCB
                    DM_COSOKCB cskcb = _IDMCOSOKCBService.GetByMa(Session["maCskcb"] as string).FirstOrDefault();

                    // Tạo một bản ghi vào COCAUGIA_THUCTE
                    COCAUGIA_THUCTE thucTe = new COCAUGIA_THUCTE
                    {
                        DICHVU21   = dichvu21,
                        COSOKCB    = cskcb,
                        MA_THE     = Session["maThe"] as string,
                        NGAY_VAO   = DateTime.Parse(Session["ngayVao"] as string),
                        NGAY_RA    = DateTime.Parse(Session["ngayRa"] as string),
                        THUCTE_CTs = new List <COCAUGIA_THUCTE_CT>()
                    };

                    // Ghi đè các phần tử đã được update trong form
                    foreach (var item in updateValues.Update)
                    {
                        int index = thucTeCts.FindIndex(x => x.ID == item.ID);
                        thucTeCts[index].SO_LUONG_NEW  = item.SO_LUONG_NEW;
                        thucTeCts[index].DONGIA_NEW    = item.DONGIA_NEW;
                        thucTeCts[index].TEN_COCAU_NEW = item.TEN_COCAU_NEW;
                    }

                    // Reset lại id và gán thực tế để insert vào DB
                    foreach (var item in thucTeCts)
                    {
                        item.ID = 0;
                        thucTe.THUCTE_CTs.Add(item);
                        item.THUCTE = thucTe;
                    }

                    _ICOCAUGIA_THUCTEService.Save(thucTe);
                    _ICOCAUGIA_THUCTEService.CommitChanges();
                }
            }
            else // Update lại dữ liệu
            {
                foreach (var item in updateValues.Update)
                {
                    int index = thucTeCts.FindIndex(x => x.ID == item.ID);
                    thucTeCts[index].SO_LUONG_NEW  = item.SO_LUONG_NEW;
                    thucTeCts[index].DONGIA_NEW    = item.DONGIA_NEW;
                    thucTeCts[index].TEN_COCAU_NEW = item.TEN_COCAU_NEW;

                    _ICOCAUGIA_THUCTE_CTService.Save(thucTeCts[index]);
                }

                _ICOCAUGIA_THUCTE_CTService.CommitChanges();
            }

            return(_GridViewChiTietDichVuFilter(
                       Session["maCskcb"] as string,
                       Session["maThe"] as string,
                       Session["ngayVao"] as string,
                       Session["ngayRa"] as string,
                       Session["maDichVu"] as string));
        }
 public static bool TrangThaiTuChoiDuyetDieuChinhThongTin(this DM_COSOKCB model)
 {
     return(model.TRANGTHAI == 0 && model.TTPHEDUYET == 10);
 }