示例#1
0
        public void ActionIndex(MHSThanhVienUCSCModel model)
        {
            if (ViewPage.CurrentPage.MenuID > 0)
            {
                MenuID = ViewPage.CurrentPage.MenuID;
            }
            int userId = HL.Lib.Global.CPLogin.UserIDOnWeb;

            var dbQuery = ModHSThanhVienUCSCService.Instance.CreateQuery()
                          //.Where(o => o.Activity == true)
                          .Where(userId > 0, o => o.UserID == userId)
                          .Where(State > 0, o => (o.State & State) == State)
                          .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("HSThanhVienUCSC", MenuID, ViewPage.CurrentLang.ID))
                          .OrderByDesc(o => o.Order)
                          .Take(PageSize)
                          .Skip(PageSize * model.Page);

            ViewBag.Data      = dbQuery.ToList();
            model.TotalRecord = dbQuery.TotalRecord;
            model.PageSize    = PageSize;
            ViewBag.Model     = model;
        }
示例#2
0
        public void ActionUpdateDangKyUCSC(ModDonDangKyUCSCEntity entityDk, MAppend append, MHSThanhVienUCSCModel model, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserIDOnWeb;
            var entity = ModDonDangKyUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date = DateTime.Now;

                entityDk.ID         = entity.ID;
                entityDk.UserID     = entity.UserID;
                entityDk.UserID1    = userId;
                entityDk.MenuID     = entity.MenuID;
                entityDk.State      = entity.State;
                entityDk.Name       = entity.Name;
                entityDk.Code       = entity.Code;
                entityDk.Order      = entity.Order;
                entityDk.Published  = entity.Published;
                entityDk.Published1 = date;
                entityDk.Activity   = false;
                ModDonDangKyUCSCService.Instance.Save(entityDk);

                //He thong thong tin
                var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DonDangKyUCSCID == entity.ID).ToList();
                if (httt != null)
                {
                    ModHeThongThongTinService.Instance.Delete(httt);
                }
                var arr = model.M.Split('|');
                List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>();
                for (int i = 0; i < arr.Length; i++)
                {
                    if (string.IsNullOrEmpty(arr[i]))
                    {
                        continue;
                    }
                    var tmp = arr[i].Split('_');
                    int m   = HL.Core.Global.Convert.ToInt(tmp[0], 0);
                    if (m <= 0 || tmp.Length != 2)
                    {
                        continue;
                    }
                    string sName = tmp[1];

                    if (string.IsNullOrEmpty(sName))
                    {
                        continue;
                    }
                    var entityTmp = new ModHeThongThongTinEntity
                    {
                        DonDangKyUCSCID = entity.ID,
                        MenuID          = m,
                        Name            = sName,
                        Code            = Data.GetCode(sName),
                        Published       = DateTime.Now,
                        Order           = GetMaxOrder_HTTT(),
                        Activity        = true
                    };
                    entityHTTT.Add(entityTmp);
                    ModHeThongThongTinService.Instance.Save(entityHTTT);
                }

                // Nhan luc
                string[] arrNhanLucInString = append.NhanLuc.Split('|');
                List <ModNhanLucUCSCEntity> lstNhanLucInViewBag = ViewBag.NhanLuc as List <ModNhanLucUCSCEntity> ?? new List <ModNhanLucUCSCEntity>();
                List <ModNhanLucUCSCEntity> lstNhanLucMoi       = new List <ModNhanLucUCSCEntity>();

                for (int i = 0; i < arrNhanLucInString.Length; i++)
                {
                    if (string.IsNullOrEmpty(arrNhanLucInString[i]))
                    {
                        continue;
                    }
                    var nhanLuc  = arrNhanLucInString[i].Split('_');
                    int cNhanLuc = nhanLuc.Length;
                    if (cNhanLuc != 10)
                    {
                        continue;
                    }

                    // Parse Nam/Thang tot nghiệp
                    int      iThang = 0;
                    int      iNam   = 0;
                    string[] arrNamThangTotNghiep = nhanLuc[9].Split('/');
                    if (arrNamThangTotNghiep.Length == 2)
                    {
                        iThang = Int32.Parse(arrNamThangTotNghiep[0], 0);
                        iNam   = Int32.Parse(arrNamThangTotNghiep[1], 0);
                    }

                    var item = new ModNhanLucUCSCEntity()
                    {
                        DonDangKyUCSCID         = entityDk.ID,
                        Name                    = nhanLuc[0],
                        School                  = nhanLuc[1],
                        MenuIDs_LinhVucDT       = nhanLuc[2],
                        MenuIDs_TrinhDoDT       = nhanLuc[3],
                        MenuIDs_ChungChi        = nhanLuc[4],
                        MenuIDs_QuanLyATTT      = nhanLuc[5],
                        MenuIDs_KyThuatPhongThu = nhanLuc[6],
                        MenuIDs_KyThuatBaoVe    = nhanLuc[7],
                        MenuIDs_KyThuatKiemTra  = nhanLuc[8],
                        ThangTotNghiep          = iThang,
                        NamTotNghiep            = iNam,
                        Activity                = true,
                        Published               = DateTime.Now,
                        Order                   = GetMaxOrder_NhanLuc()
                    };
                    lstNhanLucMoi.Add(item);
                }
                ModNhanLucUCSCService.Instance.Delete(lstNhanLucInViewBag);
                ModNhanLucUCSCService.Instance.Save(lstNhanLucMoi);
                ViewBag.NhanLuc = lstNhanLucMoi;

                ViewBag.DangKy = entityDk;
                ViewBag.HTTT1  = entityHTTT;

                // LinhVucDaoDao
                string[] tongHopNhanLucs = append.TongHopNhanLucLVDT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "LinhVucDaoDao");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucLVDT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucLVDT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucLVDT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value <= 0));

                // TrinhDoDaoTao
                tongHopNhanLucs = append.TongHopNhanLucTDDT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "TrinhDoDaoTao");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucTDDT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucTDDT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucTDDT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value <= 0));

                // ChungChi
                tongHopNhanLucs = append.TongHopNhanLucCC.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "ChungChi");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucCC.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucCC[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucCC[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value <= 0));

                // QuanLyATTT
                tongHopNhanLucs = append.TongHopNhanLucNhomATTT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "QuanLyATTT");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomATTT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomATTT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomATTT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value <= 0));

                //KyThuatPhongThu
                tongHopNhanLucs = append.TongHopNhanLucNhomKTPT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatPhongThu");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTPT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTPT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTPT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value <= 0));

                // KyThuatBaoVe
                tongHopNhanLucs = append.TongHopNhanLucNhomKTBV.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatBaoVe");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTBV.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTBV[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTBV[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value <= 0));

                tongHopNhanLucs = append.TongHopNhanLucNhomKTKT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatKiemTra");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTKT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTKT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTKT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value <= 0));

                ViewPage.Alert("Cập nhật đăng ký thành công! Chúng tôi sẽ xem xét và phê duyệt đăng ký của bạn sớm nhất có thể.");
                string url = "/vn/Thanh-vien/DS-dang-ky-ung-cuu-su-co.aspx";
                if (ViewPage.CurrentPage.LangID == 2)
                {
                    url = "/en/Member/DS-dang-ky-ung-cuu-su-co.aspx";
                }
                ViewPage.Navigate(url);
            }
        }
        public void ActionUpdateDangKyUCSC(ModDonDangKyUCSCEntity entityDk, MHSThanhVienUCSCModel model, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModDonDangKyUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date = DateTime.Now;

                entityDk.ID         = entity.ID;
                entityDk.UserID     = entity.UserID;
                entityDk.UserID1    = entity.UserID1;
                entityDk.MenuID     = entity.MenuID;
                entityDk.State      = entity.State;
                entityDk.Name       = entity.Name;
                entityDk.Code       = entity.Code;
                entityDk.Order      = entity.Order;
                entityDk.Published  = entity.Published;
                entityDk.Published1 = date;
                entityDk.Activity   = false;
                ModDonDangKyUCSCService.Instance.Save(entityDk);

                //He thong thong tin
                var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DonDangKyUCSCID == entity.ID).ToList();
                if (httt != null)
                {
                    ModHeThongThongTinService.Instance.Delete(httt);
                }
                var arr = model.M.Split(';');
                List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>();
                for (int i = 0; i < arr.Length; i++)
                {
                    if (string.IsNullOrEmpty(arr[i]))
                    {
                        continue;
                    }
                    var tmp = arr[i].Split('_');
                    int m   = HL.Core.Global.Convert.ToInt(tmp[0], 0);
                    if (m <= 0 || tmp.Length != 2)
                    {
                        continue;
                    }
                    var lstName = tmp[1].Split(',');

                    for (int j = 0; j < lstName.Length; j++)
                    {
                        if (string.IsNullOrEmpty(lstName[j]))
                        {
                            continue;
                        }
                        var entityTmp = new ModHeThongThongTinEntity
                        {
                            DonDangKyUCSCID = entity.ID,
                            MenuID          = m,
                            Name            = lstName[j],
                            Code            = Data.GetCode(lstName[j]),
                            Published       = DateTime.Now,
                            Order           = GetMaxOrder_HTTT(),
                            Activity        = true
                        };
                        entityHTTT.Add(entityTmp);
                    }
                    ModHeThongThongTinService.Instance.Save(entityHTTT);
                }

                // Nhan luc
                var nhanLucs  = model.NhanLuc.Split('|');
                var cNhanLucs = nhanLucs.Length;
                List <ModNhanLucUCSCEntity> entityNhanLuc = new List <ModNhanLucUCSCEntity>();
                for (int i = 0; i < cNhanLucs; i++)
                {
                    if (string.IsNullOrEmpty(nhanLucs[i]))
                    {
                        continue;
                    }
                    var nhanLuc  = nhanLucs[i].Split('_');
                    int cNhanLuc = nhanLuc.Length;
                    if (cNhanLuc != 10)
                    {
                        continue;
                    }

                    // Xoa nhan luc hien tai
                    var lst = ModNhanLucUCSCService.Instance.CreateQuery()
                              .Where(o => o.DonDangKyUCSCID == entity.ID)
                              .ToList();
                    if (lst != null && lst.Count > 0)
                    {
                        lst.ForEach(o => o.Activity = false);
                        ModNhanLucUCSCService.Instance.Save(lst);
                    }

                    // Them nhan luc moi
                    var item = new ModNhanLucUCSCEntity()
                    {
                        DonDangKyUCSCID         = entity.ID,
                        Name                    = nhanLuc[0],
                        School                  = nhanLuc[1],
                        MenuIDs_LinhVucDT       = nhanLuc[2],
                        MenuIDs_TrinhDoDT       = nhanLuc[3],
                        MenuIDs_ChungChi        = nhanLuc[4],
                        MenuIDs_QuanLyATTT      = nhanLuc[5],
                        MenuIDs_KyThuatPhongThu = nhanLuc[6],
                        MenuIDs_KyThuatBaoVe    = nhanLuc[7],
                        MenuIDs_KyThuatKiemTra  = nhanLuc[8],
                        NamTotNghiep            = HL.Core.Global.Convert.ToInt(nhanLuc[9], 0),
                        Activity                = true,
                        Published               = DateTime.Now,
                        Order                   = GetMaxOrder_NhanLuc()
                    };
                    entityNhanLuc.Add(item);
                }
                ViewBag.NhanLuc = entityNhanLuc;
                ModNhanLucUCSCService.Instance.Save(entityNhanLuc);

                ViewBag.DangKy = entityDk;
                ViewBag.HTTT1  = entityHTTT;

                ViewPage.Alert("Cập nhật đăng ký thành công! Chúng tôi sẽ xem xét và phê duyệt đăng ký của bạn sớm nhất có thể.");
                ViewPage.Navigate("/vn/Thanh-vien/DS-dang-ky-ung-cuu-su-co.aspx");
            }
        }
示例#4
0
        public void ActionUpdateHoSoUCSC(ModHSThanhVienUCSCEntity entityHs, MAppend append, ModDauMoiUCSCEntity entityDm, MHSThanhVienUCSCModel model, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserIDOnWeb;
            var entity = ModHSThanhVienUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date = DateTime.Now;

                //Thong tin chung
                entityHs.ID         = entity.ID;
                entityHs.UserID     = entity.UserID;
                entityHs.UserID1    = userId;
                entityHs.MenuID     = entity.MenuID;
                entityHs.State      = entity.State;
                entityHs.Name       = entity.Name;
                entityHs.Code       = entity.Code;
                entityHs.Order      = entity.Order;
                entityHs.Published  = entity.Published;
                entityHs.Published1 = date;
                entityHs.Activity   = false;
                ModHSThanhVienUCSCService.Instance.Save(entityHs);

                //Dau moi UCSC
                WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle();
                var           dm   = ModDauMoiUCSCService.Instance.CreateQuery().Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID && o.MenuID == menu.ID).ToSingle();
                //entityDm.ID = dm.ID;
                //entityDm.HSThanhVienUCSCID = dm.HSThanhVienUCSCID;
                //entityDm.MenuID = dm.MenuID;
                //entityDm.State = dm.State;
                //entityDm.Name = dm.Name;
                //entityDm.Code = dm.Code;
                //entityDm.Order = dm.Order;
                //entityDm.Published = entity.Published;
                //entityDm.Activity = dm.Activity;
                dm.Name        = entityDm.Name;
                dm.ChucVu      = entityDm.ChucVu;
                dm.DiaChi      = entityDm.DiaChi;
                dm.DienThoaiDD = entityDm.DienThoaiDD;
                dm.DienThoai   = entityDm.DienThoai;
                dm.Fax         = entityDm.Fax;
                dm.Email       = entityDm.Email;
                ModDauMoiUCSCService.Instance.Save(dm);

                ModDauMoiUCSCEntity dmDuPhong = null;
                WebMenuEntity       menu1     = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "DuPhong").ToSingle();
                if (menu1 != null)
                {
                    dmDuPhong             = ModDauMoiUCSCService.Instance.CreateQuery().Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID && o.MenuID == menu1.ID).ToSingle();
                    dmDuPhong.Name        = append.Name1;
                    dmDuPhong.ChucVu      = append.ChucVu1;
                    dmDuPhong.DiaChi      = append.DiaChi1;
                    dmDuPhong.DienThoaiDD = append.DienThoaiDD1;
                    dmDuPhong.DienThoai   = append.DienThoai1;
                    dmDuPhong.Fax         = append.Fax1;
                    dmDuPhong.Email       = append.Email1;
                    ModDauMoiUCSCService.Instance.Save(dmDuPhong);
                }

                //He thong thong tin
                var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DauMoiUCSCID == dm.ID).ToList();
                if (httt != null)
                {
                    ModHeThongThongTinService.Instance.Delete(httt);
                }
                var arr = model.M.Split('|');
                List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>();
                for (int i = 0; i < arr.Length; i++)
                {
                    if (string.IsNullOrEmpty(arr[i]))
                    {
                        continue;
                    }
                    var tmp = arr[i].Split('_');
                    int m   = HL.Core.Global.Convert.ToInt(tmp[0], 0);
                    if (m <= 0 || tmp.Length != 2)
                    {
                        continue;
                    }
                    string sName = tmp[1];

                    if (string.IsNullOrEmpty(sName))
                    {
                        continue;
                    }
                    var entityTmp = new ModHeThongThongTinEntity
                    {
                        DauMoiUCSCID    = dm.ID,
                        MenuID          = m,
                        Name            = sName,
                        Code            = Data.GetCode(sName),
                        Published       = DateTime.Now,
                        Order           = GetMaxOrder_HTTT(),
                        Activity        = true,
                        DonDangKyUCSCID = entityHs.ID
                    };
                    entityHTTT.Add(entityTmp);
                    ModHeThongThongTinService.Instance.Save(entityHTTT);
                }

                ViewBag.HoSo          = entityHs;
                ViewBag.DauMoi        = entityDm;
                ViewBag.DauMoiDuPhong = dmDuPhong;
                ViewBag.HTTT          = entityHTTT;


                /* =======================================================*/
                /* =======================================================*/
                #region ITT UPDATE
                string[] arrNhanLucInString = append.NhanLuc.Split('|');
                List <ModNhanLucUCSCEntity> lstNhanLucInViewBag = ViewBag.NhanLuc as List <ModNhanLucUCSCEntity> ?? new List <ModNhanLucUCSCEntity>();
                List <ModNhanLucUCSCEntity> lstNhanLucMoi       = new List <ModNhanLucUCSCEntity>();

                for (int i = 0; i < arrNhanLucInString.Length; i++)
                {
                    if (string.IsNullOrEmpty(arrNhanLucInString[i]))
                    {
                        continue;
                    }
                    var nhanLuc  = arrNhanLucInString[i].Split('_');
                    int cNhanLuc = nhanLuc.Length;
                    if (cNhanLuc != 10)
                    {
                        continue;
                    }

                    // Parse Nam/Thang tot nghiệp
                    int      iThang = 0;
                    int      iNam   = 0;
                    string[] arrNamThangTotNghiep = nhanLuc[9].Split('/');
                    if (arrNamThangTotNghiep.Length == 2)
                    {
                        iThang = Int32.Parse(arrNamThangTotNghiep[0], 0);
                        iNam   = Int32.Parse(arrNamThangTotNghiep[1], 0);
                    }

                    var item = new ModNhanLucUCSCEntity()
                    {
                        HSThanhVienUCSCID = entityHs.ID,
                        Name                    = nhanLuc[0],
                        School                  = nhanLuc[1],
                        MenuIDs_LinhVucDT       = nhanLuc[2],
                        MenuIDs_TrinhDoDT       = nhanLuc[3],
                        MenuIDs_ChungChi        = nhanLuc[4],
                        MenuIDs_QuanLyATTT      = nhanLuc[5],
                        MenuIDs_KyThuatPhongThu = nhanLuc[6],
                        MenuIDs_KyThuatBaoVe    = nhanLuc[7],
                        MenuIDs_KyThuatKiemTra  = nhanLuc[8],
                        ThangTotNghiep          = iThang,
                        NamTotNghiep            = iNam,
                        Activity                = true,
                        Published               = DateTime.Now,
                        Order                   = GetMaxOrder_NhanLuc()
                    };
                    lstNhanLucMoi.Add(item);
                }
                ModNhanLucUCSCService.Instance.Delete(lstNhanLucInViewBag);
                ModNhanLucUCSCService.Instance.Save(lstNhanLucMoi);
                ViewBag.NhanLuc = lstNhanLucMoi;

                // LinhVucDaoDao
                string[] tongHopNhanLucs = append.TongHopNhanLucLVDT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "LinhVucDaoDao");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucLVDT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucLVDT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucLVDT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value <= 0));

                // TrinhDoDaoTao
                tongHopNhanLucs = append.TongHopNhanLucTDDT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "TrinhDoDaoTao");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucTDDT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucTDDT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucTDDT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value <= 0));

                // ChungChi
                tongHopNhanLucs = append.TongHopNhanLucCC.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "ChungChi");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucCC.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucCC[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucCC[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value <= 0));

                // QuanLyATTT
                tongHopNhanLucs = append.TongHopNhanLucNhomATTT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "QuanLyATTT");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomATTT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomATTT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomATTT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value <= 0));

                //KyThuatPhongThu
                tongHopNhanLucs = append.TongHopNhanLucNhomKTPT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatPhongThu");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTPT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTPT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTPT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value <= 0));

                // KyThuatBaoVe
                tongHopNhanLucs = append.TongHopNhanLucNhomKTBV.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatBaoVe");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTBV.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTBV[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTBV[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value <= 0));

                tongHopNhanLucs = append.TongHopNhanLucNhomKTKT.Split('|');
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatKiemTra");
                for (int i = 0; i < tongHopNhanLucs.Length; i++)
                {
                    if (string.IsNullOrEmpty(tongHopNhanLucs[i]))
                    {
                        continue;
                    }
                    string[] thnl         = tongHopNhanLucs[i].Split('_');
                    int      menuId       = Int32.Parse(thnl[0], 0);
                    int      menuId_value = Int32.Parse(thnl[1], 0);
                    if (menuId == 0)
                    {
                        continue;
                    }

                    // REPLACE OR ADD TO LIST
                    int index = lstTongHopNhanLucNhomKTKT.FindIndex(ind => ind.MenuID == menuId);
                    lstTongHopNhanLucNhomKTKT[index].MenuID_Value = menuId_value;
                    lstTongHopNhanLucNhomKTKT[index].UpdatedDate  = DateTime.Now;
                }
                ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value > 0));
                ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value <= 0));

                #endregion
                ViewPage.Alert("Cập nhật hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể.");
                string url = "/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx";
                if (ViewPage.CurrentPage.LangID == 2)
                {
                    url = "/en/Member/Ho-so-ung-cuu-su-co.aspx";
                }
                ViewPage.Navigate(url);
            }

            //DateTime date = DateTime.Now;
            //string code = "HSUCSC" + ModHSThanhVienUCSCService.Instance.GetMaxID();
            //entity.Name = code;
            //entity.Code = Data.GetCode(code);
            //entity.UserID = Lib.Global.CPLogin.UserIDOnWeb;
            //entity.Published = date;
            //entity.Activity = false;
            //int id = ModHSThanhVienUCSCService.Instance.Save(entity);

            //WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle();
            //entityDm.HSThanhVienUCSCID = id;
            //entityDm.MenuID = menu.ID;
            //entityDm.Published = date;
            //entityDm.Activity = true;
            //ModDauMoiUCSCService.Instance.Save(entityDm);

            //ViewPage.Alert("Tạo mới hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể.");
            //ViewPage.Navigate("/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx");
        }
示例#5
0
        public void ActionUpdateHoSoUCSC(ModHSThanhVienUCSCEntity entityHs, ModDauMoiUCSCEntity entityDm, MHSThanhVienUCSCModel model, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModHSThanhVienUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date = DateTime.Now;

                //Thong tin chung
                entityHs.ID         = entity.ID;
                entityHs.UserID     = entity.UserID;
                entityHs.UserID1    = entity.UserID1;
                entityHs.MenuID     = entity.MenuID;
                entityHs.State      = entity.State;
                entityHs.Name       = entity.Name;
                entityHs.Code       = entity.Code;
                entityHs.Order      = entity.Order;
                entityHs.Published  = entity.Published;
                entityHs.Published1 = date;
                entityHs.Activity   = false;
                ModHSThanhVienUCSCService.Instance.Save(entityHs);

                //Dau moi UCSC
                var dm = ModDauMoiUCSCService.Instance.CreateQuery().Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID).ToSingle();
                entityDm.ID = dm.ID;
                entityDm.HSThanhVienUCSCID = dm.HSThanhVienUCSCID;
                entityDm.MenuID            = dm.MenuID;
                entityDm.State             = dm.State;
                entityDm.Name      = dm.Name;
                entityDm.Code      = dm.Code;
                entityDm.Order     = dm.Order;
                entityDm.Published = entity.Published;
                entityDm.Activity  = dm.Activity;
                ModDauMoiUCSCService.Instance.Save(entityDm);

                //He thong thong tin
                var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DauMoiUCSCID == dm.ID).ToList();
                if (httt != null)
                {
                    ModHeThongThongTinService.Instance.Delete(httt);
                }
                var arr = model.M.Split(';');
                List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>();
                for (int i = 0; i < arr.Length; i++)
                {
                    if (string.IsNullOrEmpty(arr[i]))
                    {
                        continue;
                    }
                    var tmp = arr[i].Split('_');
                    int m   = HL.Core.Global.Convert.ToInt(tmp[0], 0);
                    if (m <= 0 || tmp.Length != 2)
                    {
                        continue;
                    }
                    var lstName = tmp[1].Split(',');

                    for (int j = 0; j < lstName.Length; j++)
                    {
                        if (string.IsNullOrEmpty(lstName[j]))
                        {
                            continue;
                        }
                        var entityTmp = new ModHeThongThongTinEntity
                        {
                            DauMoiUCSCID = dm.ID,
                            MenuID       = m,
                            Name         = lstName[j],
                            Code         = Data.GetCode(lstName[j]),
                            Published    = DateTime.Now,
                            Order        = GetMaxOrder_HTTT(),
                            Activity     = true
                        };
                        entityHTTT.Add(entityTmp);
                    }
                    ModHeThongThongTinService.Instance.Save(entityHTTT);
                }

                ViewBag.HoSo   = entityHs;
                ViewBag.DauMoi = entityDm;
                ViewBag.HTTT   = entityHTTT;

                ViewPage.Alert("Cập nhật hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể.");
                ViewPage.Navigate("/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx");
            }

            //DateTime date = DateTime.Now;
            //string code = "HSUCSC" + ModHSThanhVienUCSCService.Instance.GetMaxID();
            //entity.Name = code;
            //entity.Code = Data.GetCode(code);
            //entity.UserID = Lib.Global.CPLogin.UserID;
            //entity.Published = date;
            //entity.Activity = false;
            //int id = ModHSThanhVienUCSCService.Instance.Save(entity);

            //WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle();
            //entityDm.HSThanhVienUCSCID = id;
            //entityDm.MenuID = menu.ID;
            //entityDm.Published = date;
            //entityDm.Activity = true;
            //ModDauMoiUCSCService.Instance.Save(entityDm);

            //ViewPage.Alert("Tạo mới hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể.");
            //ViewPage.Navigate("/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx");
        }