Пример #1
0
        public void ActionAddBCKetThucUCSC(ModBaoCaoKetThucSuCoEntity entity, MAppend append)
        {
            DateTime date            = DateTime.Now;
            string   ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut;
            string   code            = "BCKTSC" + ModBaoCaoKetThucSuCoService.Instance.GetMaxID();

            entity.Name   = code;
            entity.Code   = Data.GetCode(code);
            entity.UserID = Lib.Global.CPLogin.UserID;
            if (!string.IsNullOrEmpty(ngayGioPhatHien))
            {
                entity.NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien);
            }
            else
            {
                entity.NgayGioPhatHien = DateTime.MinValue;
            }
            entity.Order     = GetMaxOrder_BCKetThuc();
            entity.Published = date;
            entity.Activity  = false;
            int id = ModBaoCaoKetThucSuCoService.Instance.Save(entity);

            ViewBag.BaoCao = entity;

            ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
            ViewPage.Navigate("/vn/Thanh-vien/DS-bc-ket-thuc-su-co.aspx");
        }
Пример #2
0
        public void ActionXoaBaoCao(string baoCaoId)
        {
            int bcId   = HL.Core.Global.Convert.ToInt(baoCaoId, 0);
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModBaoCaoBanDauSuCoService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(bcId > 0, o => o.ID == bcId)
                         .ToSingle();

            if (entity != null)
            {
                var entityInfoMagic = ModInfoMagicService.Instance.CreateQuery().Where(o => o.BaoCaoBanDauSuCoID == entity.ID).ToList();
                if (entityInfoMagic != null)
                {
                    ModInfoMagicService.Instance.Delete(entityInfoMagic);
                }

                ModBaoCaoBanDauSuCoService.Instance.Delete(entity.ID);

                ViewPage.Alert("Xóa báo cáo thành công.");
                ViewPage.Navigate(ViewPage.CurrentURL);
            }
            else
            {
                ViewPage.Alert("Bạn không có quyền thao tác trên báo cáo này.");
            }
        }
Пример #3
0
        public void ActionXoaHoSo(string hoSoId)
        {
            int hsId   = HL.Core.Global.Convert.ToInt(hoSoId, 0);
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModHSThanhVienUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(hsId > 0, o => o.ID == hsId)
                         .ToSingle();

            if (entity != null)
            {
                var dm = ModDauMoiUCSCService.Instance.CreateQuery()
                         .Where(o => o.HSThanhVienUCSCID == entity.ID)
                         .ToSingle();
                ModHSThanhVienUCSCService.Instance.Delete(entity.ID);
                if (dm != null)
                {
                    var httt = ModHeThongThongTinService.Instance.CreateQuery()
                               .Where(o => o.DauMoiUCSCID == dm.ID)
                               .ToList();
                    if (httt != null)
                    {
                        ModHeThongThongTinService.Instance.Delete(httt);
                    }
                    ModDauMoiUCSCService.Instance.Delete(dm);
                }

                ViewPage.Alert("Xóa hồ sơ thành công.");
                ViewPage.Navigate(ViewPage.CurrentURL);
            }
            else
            {
                ViewPage.Alert("Bạn không có quyền thao tác trên hồ sơ này.");
            }
        }
Пример #4
0
        public void ActionUpdateBaoCaoUCSC(ModBaoCaoKetThucSuCoEntity entityBc, MAppend append, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModBaoCaoKetThucSuCoService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date            = DateTime.Now;
                string   ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut;
                if (!string.IsNullOrEmpty(ngayGioPhatHien))
                {
                    entityBc.NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien);
                }
                else
                {
                    entityBc.NgayGioPhatHien = DateTime.MinValue;
                }

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

                ViewBag.BaoCao = entityBc;

                ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
                string url = "/vn/Thanh-vien/DS-bc-ket-thuc-su-co.aspx";
                if (ViewPage.CurrentPage.LangID == 2)
                {
                    url = "/en/Member/DS-bc-ket-thuc-su-co.aspx";
                }
                ViewPage.Navigate(url);
            }
        }
Пример #5
0
        public void ActionXoaDangKy(string dangKyId)
        {
            int dkId   = HL.Core.Global.Convert.ToInt(dangKyId, 0);
            int userId = HL.Lib.Global.CPLogin.UserIDOnWeb;
            var entity = ModDonDangKyUCSCService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(dkId > 0, o => o.ID == dkId)
                         .ToSingle();

            if (entity != null)
            {
                var httt = ModHeThongThongTinService.Instance.CreateQuery()
                           .Where(o => o.DonDangKyUCSCID == entity.ID)
                           .ToList();

                var nhanLuc = ModNhanLucUCSCService.Instance.CreateQuery()
                              .Where(o => o.DonDangKyUCSCID == entity.ID)
                              .ToList();

                ModDonDangKyUCSCService.Instance.Delete(entity.ID);
                if (httt != null)
                {
                    ModHeThongThongTinService.Instance.Delete(httt);
                }
                if (nhanLuc != null)
                {
                    ModNhanLucUCSCService.Instance.Delete(nhanLuc);
                }
                // Xoa tong hop nhan luc
                List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLuc = ModTongHopNhanLucUCSCService.Instance.GetByDonDangKyUCSCID(dkId);
                if (lstTongHopNhanLuc != null)
                {
                    ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLuc);
                }

                ViewPage.Alert("Xóa đăng ký thành công.");
                ViewPage.Navigate(ViewPage.CurrentURL);
            }
            else
            {
                ViewPage.Alert("Bạn không có quyền thao tác trên bản đăng ký này.");
            }
        }
Пример #6
0
        public void ActionChangePassPOST(PasswordModel model)
        {
            var obj = CPUserService.Instance.CreateQuery().Where(o => o.ID == CPLogin.UserID).Select(o => new { o.Password, o.ID }).ToSingle();

            if (model.PassCur.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("Nhập mật khẩu hiện tại");
            }
            else if (Security.GetPass(model.PassCur.Trim()) != obj.Password)
            {
                ViewPage.Message.ListMessage.Add("Mật khẩu hiện tại không đúng !");
            }

            if (model.PassNew.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("Nhập mật khẩu mới");
            }
            else if (model.PassNew.Trim() != model.RePass.Trim())
            {
                ViewPage.Message.ListMessage.Add("Mật khẩu nhắc lại không đúng");
            }

            if (ViewPage.Message.ListMessage.Count > 0)
            {
                string s = @"Các thông tin nhập còn thiếu hoặc sai chính xác \r\n";
                for (int i = 0; i < ViewPage.Message.ListMessage.Count; i++)
                {
                    s += @"\r\n" + ViewPage.Message.ListMessage[i];
                }
                ViewPage.Alert(s);
            }
            else
            {
                obj.Password = Security.GetPass(model.PassNew);
                CPUserService.Instance.Save(obj, o => o.Password);
                ViewPage.Alert("Cập nhật mật khẩu thành công !");
                ViewPage.Navigate("/");
            }
            ViewBag.ChangePass = model;
        }
Пример #7
0
        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");
            }
        }
Пример #8
0
        public void ActionAddBCTongHopUCSC(ModBaoCaoTongHopEntity entity, MSoLuongSuCoModel entitySuCo)
        {
            ViewBag.BaoCao = entity;

            DateTime date = DateTime.Now;
            string   code = "BCTHSC" + ModBaoCaoTongHopService.Instance.GetMaxID();

            entity.Name      = code;
            entity.Code      = Data.GetCode(code);
            entity.UserID    = Lib.Global.CPLogin.UserID;
            entity.Order     = GetMaxOrder_BCTongHop();
            entity.Published = date;
            entity.Activity  = false;

            int c = entitySuCo.MN.Length;

            for (int i = 0; i < c; i++)
            {
                var  suCo = new ModSoLuongSuCoEntity();
                bool flag = false;
                if (entitySuCo.SoLuong[i] > 0)
                {
                    suCo.SoLuong = entitySuCo.SoLuong[i];
                    flag         = true;
                }
                if (entitySuCo.TuXuLy[i] > 0)
                {
                    suCo.TuXuLy = entitySuCo.TuXuLy[i];
                    flag        = true;
                }
                if (entitySuCo.ToChucHoTro[i] > 0)
                {
                    suCo.ToChucHoTro = entitySuCo.ToChucHoTro[i];
                    flag             = true;
                }
                if (entitySuCo.ToChucNuocNgoaiHoTro[i] > 0)
                {
                    suCo.ToChucNuocNgoaiHoTro = entitySuCo.ToChucNuocNgoaiHoTro[i];
                    flag = true;
                }
                if (entitySuCo.DeNghi[i] > 0)
                {
                    suCo.DeNghi = entitySuCo.DeNghi[i];
                    flag        = true;
                }
                if (entitySuCo.ThietHaiUocTinh[i] > 0)
                {
                    suCo.ThietHaiUocTinh = entitySuCo.ThietHaiUocTinh[i];
                    flag = true;
                }
                if (flag == true)
                {
                    int id = ModBaoCaoTongHopService.Instance.Save(entity);
                    suCo.BaoCaoTongHopID = id;
                    suCo.MenuID          = entitySuCo.MN[i];
                    suCo.Published       = date;
                    suCo.Order           = GetMaxOrder_SoSuCo();
                    suCo.Activity        = true;

                    ModSoLuongSuCoService.Instance.Save(suCo);
                }
            }

            ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
            ViewPage.Navigate("/vn/Thanh-vien/DS-bc-tong-hop-su-co.aspx");
        }
Пример #9
0
        public void ActionAddBCBanDauUCSC(ModBaoCaoBanDauSuCoEntity entity, MInfoMagicModel modelInfo, MAppend append)
        {
            DateTime date            = DateTime.Now;
            string   ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut;

            string[] arr = append.ThoiGian.Split('/');
            string   thoiGianThucHien = "";

            if (arr.Length == 5)
            {
                thoiGianThucHien = arr[0] + "/" + arr[1] + "/" + arr[2] + " " + arr[3] + ":" + arr[4];
            }
            string code = "BCBDSC" + ModBaoCaoBanDauSuCoService.Instance.GetMaxID();

            entity.Name   = code;
            entity.Code   = Data.GetCode(code);
            entity.UserID = Lib.Global.CPLogin.UserID;
            if (!string.IsNullOrEmpty(ngayGioPhatHien))
            {
                entity.ChiTiet_NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien);
            }
            else
            {
                entity.ChiTiet_NgayGioPhatHien = DateTime.MinValue;
            }
            if (!string.IsNullOrEmpty(thoiGianThucHien))
            {
                entity.ThoiGianThucHien = HL.Core.Global.Convert.ToDateTime(thoiGianThucHien);
            }
            else
            {
                entity.ThoiGianThucHien = DateTime.MinValue;
            }
            entity.Order     = GetMaxOrder_BCBanDau();
            entity.Published = date;
            entity.Activity  = false;
            int id = ModBaoCaoBanDauSuCoService.Instance.Save(entity);

            //Cach thuc phat hien
            int num = modelInfo.chkCachThuc != null ? modelInfo.chkCachThuc.Length : 0;

            for (int i = 0; i < num; i++)
            {
                string[] tmp = modelInfo.chkCachThuc[i].Split('_');
                if (tmp.Length == 3)
                {
                    ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                    {
                        BaoCaoBanDauSuCoID = id,
                        Order     = GetMaxOrder_InfoMagic(),
                        Published = date,
                        Activity  = true
                    };
                    entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                    if (tmp[0] == "1")
                    {
                        int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                        if (modelInfo.txtCachThuc != null && modelInfo.txtCachThuc.Length >= idx)
                        {
                            entityTmp.Name = modelInfo.txtCachThuc[idx];
                            entityTmp.Code = Data.GetCode(modelInfo.txtCachThuc[idx]);
                        }
                    }
                    ModInfoMagicService.Instance.Save(entityTmp);
                }
            }

            //Da gui thong bao su co
            num = modelInfo.chkThongBao != null ? modelInfo.chkThongBao.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string[] tmp = modelInfo.chkThongBao[i].Split('_');
                if (tmp.Length == 3)
                {
                    ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                    {
                        BaoCaoBanDauSuCoID = id,
                        Order     = GetMaxOrder_InfoMagic(),
                        Published = date,
                        Activity  = true
                    };
                    entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                    if (tmp[0] == "1")
                    {
                        int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                        if (modelInfo.txtThongBao != null && modelInfo.txtThongBao.Length >= idx)
                        {
                            entityTmp.Name = modelInfo.txtThongBao[idx];
                            entityTmp.Code = Data.GetCode(modelInfo.txtThongBao[idx]);
                        }
                    }
                    ModInfoMagicService.Instance.Save(entityTmp);
                }
            }

            //Dich vu
            num = modelInfo.chkDichVu != null ? modelInfo.chkDichVu.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string[] tmp = modelInfo.chkDichVu[i].Split('_');
                if (tmp.Length == 3)
                {
                    ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                    {
                        BaoCaoBanDauSuCoID = id,
                        Order     = GetMaxOrder_InfoMagic(),
                        Published = date,
                        Activity  = true
                    };
                    entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                    if (tmp[0] == "1")
                    {
                        int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                        if (modelInfo.txtDichVu != null && modelInfo.txtDichVu.Length >= idx)
                        {
                            entityTmp.Name = modelInfo.txtDichVu[idx];
                            entityTmp.Code = Data.GetCode(modelInfo.txtDichVu[idx]);
                        }
                    }
                    ModInfoMagicService.Instance.Save(entityTmp);
                }
            }

            //Bien phap
            num = modelInfo.chkBienPhap != null ? modelInfo.chkBienPhap.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string[] tmp = modelInfo.chkBienPhap[i].Split('_');
                if (tmp.Length == 3)
                {
                    ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                    {
                        BaoCaoBanDauSuCoID = id,
                        Order     = GetMaxOrder_InfoMagic(),
                        Published = date,
                        Activity  = true
                    };
                    entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                    if (tmp[0] == "1")
                    {
                        int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                        if (modelInfo.txtBienPhap != null && modelInfo.txtBienPhap.Length >= idx)
                        {
                            entityTmp.Name = modelInfo.txtBienPhap[idx];
                            entityTmp.Code = Data.GetCode(modelInfo.txtBienPhap[idx]);
                        }
                    }
                    ModInfoMagicService.Instance.Save(entityTmp);
                }
            }

            //Thong tin gui kem
            num = modelInfo.chkThongTinGuiKem != null ? modelInfo.chkThongTinGuiKem.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string[] tmp = modelInfo.chkThongTinGuiKem[i].Split('_');
                if (tmp.Length == 3)
                {
                    ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                    {
                        BaoCaoBanDauSuCoID = id,
                        Order     = GetMaxOrder_InfoMagic(),
                        Published = date,
                        Activity  = true
                    };
                    entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                    if (tmp[0] == "1")
                    {
                        int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                        if (modelInfo.txtThongTinGuiKem != null && modelInfo.txtThongTinGuiKem.Length >= idx)
                        {
                            entityTmp.Name = modelInfo.txtThongTinGuiKem[idx];
                            entityTmp.Code = Data.GetCode(modelInfo.txtThongTinGuiKem[idx]);
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }
            }

            ViewBag.BaoCao = entity;

            ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
            ViewPage.Navigate("/vn/Thanh-vien/DS-bc-ban-dau-su-co.aspx");
        }
Пример #10
0
        public void ActionAddDangKyUCSC(ModDonDangKyUCSCEntity entity, MAppend append)
        {
            string alert = string.Empty;

            ViewBag.DangKy = entity;

            DateTime date = DateTime.Now;
            string   code = "DKUCSC" + ModDonDangKyUCSCService.Instance.GetMaxID();

            entity.Name   = code;
            entity.Code   = Data.GetCode(code);
            entity.UserID = Lib.Global.CPLogin.UserID;
            entity.Order  = GetMaxOrder_DangKy();

            string folder = "/Data/upload/files/DKUCSC/" + CPLogin.CurrentUser.ID.ToString() + "_" + CPLogin.CurrentUser.LoginName + "/";

            Lib.Global.Directory.Create(HL.Core.Global.Application.BaseDirectory + folder);
            entity.File = Utils.Upload("Atack", entity.File, folder, ref alert, true);

            entity.Published = date;
            entity.Activity  = false;
            int id = ModDonDangKyUCSCService.Instance.Save(entity);

            //He thong thong tin
            var arr = append.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 = 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  = append.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;
                }
                var item = new ModNhanLucUCSCEntity()
                {
                    DonDangKyUCSCID         = 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);

            if (alert != string.Empty)
            {
                ViewPage.Message.ListMessage.Add(alert);
            }

            ViewPage.Alert("Tạo mới đă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");
        }
Пример #11
0
        public void ActionChangeInfoPOST(CPUserEntity entity)
        {
            string alert = string.Empty;

            //if (entity.Name.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("+ Nhập tên.");
            string file = Utils.Upload("Avatar", entity.File, "/Data/upload/images/User/" + entity.Email.Replace("@", "_").Trim(), ref alert);

            entity.File = string.IsNullOrEmpty(file) ? entity.File : file;


            if (entity.LoginName.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập tên truy cập.");
            }

            //if (entity.CityID.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Nhập tên thành phố.");

            if (Utils.GetEmailAddress(entity.Email) == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Địa chỉ email thiếu hoặc không chính xác.");
            }
            else
            {
                var loginName = entity.LoginName.Trim();
                var user      = CPUserService.Instance.CreateQuery().Where(o => o.LoginName == loginName).ToSingle();
                if (user.Email.Trim() != entity.Email.Trim() && CPUserService.Instance.exits(entity.Email))
                {
                    ViewPage.Message.ListMessage.Add("Địa chỉ email đã được sử dụng.");
                }
            }

            //if (entity.Year < 0)
            //    ViewPage.Message.ListMessage.Add("Chọn năm sinh.");

            //if (entity.Note.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Nhập lý do tham gia.");

            if (entity.Phone == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập số điện thoại.");
            }

            if (alert != string.Empty)
            {
                ViewPage.Message.ListMessage.Add(alert);
            }
            if (ViewPage.Message.ListMessage.Count > 0)
            {
                string s = @"Thông tin nhập còn thiếu hoặc sai chính xác: \r\n";
                for (int i = 0; i < ViewPage.Message.ListMessage.Count; i++)
                {
                    s += @"\r\n" + ViewPage.Message.ListMessage[i];
                }
                ViewPage.Alert(s);
            }
            else
            {
                entity.ID = CPLogin.UserID;
                CPUserService.Instance.Save(entity, o => new { o.Name, o.Phone, o.Note, o.LoginName, o.Email, o.File, o.Sex, o.Year, o.CityID });
                ViewPage.Alert("Cập nhật thông tin thành công!");
                ViewPage.Navigate(ViewPage.Request.RawUrl);
            }
            ViewBag.Data = entity;
        }
Пример #12
0
        public void ActionRegisterPOST(CPUserEntity entity, MUserModel model)
        {
            if (entity.LoginName.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập tên truy cập.");
            }

            //if (entity.Name.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Nhập tên.");

            //if (entity.CityID.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Chọn Tỉnh/Thành phố.");

            if (Utils.GetEmailAddress(entity.Email) == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Địa chỉ email thiếu hoặc không chính xác.");
            }
            else
            {
                if (CPUserService.Instance.exits(entity.Email))
                {
                    ViewPage.Message.ListMessage.Add("Địa chỉ email đã được sử dụng.");
                }
            }

            //if (entity.Year < 0)
            //    ViewPage.Message.ListMessage.Add("Chọn năm sinh.");

            if (entity.Phone == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập số điện thoại.");
            }

            //if (entity.Note.Trim() == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Nhập lý do tham gia.");

            if (entity.Password.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập mật khẩu.");
            }

            if (model.RePassword.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("+ Nhập lại mật khẩu.");
            }
            else if (model.RePassword.Trim() != entity.Password)
            {
                ViewPage.Message.ListMessage.Add("+ Mật khẩu nhắc lại không đúng.");
            }

            //if (entity.Address == string.Empty)
            //    ViewPage.Message.ListMessage.Add("Nhập địa chỉ.");

            //if (model.Agree != 1)
            //    ViewPage.Message.ListMessage.Add("Bạn cần đồng ý điều khoản để trở thành thành viên.");


            if (ViewPage.Message.ListMessage.Count > 0)
            {
                ViewBag.DataRes = entity;
                string s = @"Các thông tin nhập còn thiếu hoặc chưa chính xác: \r\n";
                for (int i = 0; i < ViewPage.Message.ListMessage.Count; i++)
                {
                    s += @"\r\n" + ViewPage.Message.ListMessage[i];
                }
                ViewPage.Alert(s);
            }
            else
            {
                entity.Password = Lib.Global.Security.GetPass(entity.Password.Trim());
                //entity.Password = HL.Lib.Global.Security.MD5(entity.Password.Trim());
                entity.Created    = DateTime.Now;
                entity.NgayActive = DateTime.Now;
                entity.Activity   = true;
                entity.ClientIP   = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

                CPUserService.Instance.Save(entity);
                CPUserRoleService.Instance.Save(new CPUserRoleEntity()
                {
                    UserID = entity.ID, RoleID = 2
                });
                // xoa trang
                entity = new CPUserEntity();

                //ViewPage.Alert("Bạn đã đăng kí thành công! Bạn vui lòng chờ đợi Ban Quản trị chấp thuận. Thân chào."); ViewPage.Navigate("/");
                ViewPage.Alert("Chào mừng bạn đăng ký thành công và đã được kích hoạt"); ViewPage.Navigate("/");
            }
            ViewBag.DataRes = entity;
        }
Пример #13
0
        public void ActionUpdateBaoCaoUCSC(ModBaoCaoBanDauSuCoEntity entityBc, MInfoMagicModel modelInfo, MAppend append, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModBaoCaoBanDauSuCoService.Instance.CreateQuery()
                         .Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == endCode)
                         .ToSingle();

            if (entity != null)
            {
                DateTime date             = DateTime.Now;
                string   ngayGioPhatHien  = append.Ngay + " " + append.Gio + ":" + append.Phut;
                string[] arr              = append.ThoiGian.Split('/');
                string   thoiGianThucHien = "";
                if (arr.Length == 5)
                {
                    thoiGianThucHien = arr[0] + "/" + arr[1] + "/" + arr[2] + " " + arr[3] + ":" + arr[4];
                }
                if (!string.IsNullOrEmpty(ngayGioPhatHien))
                {
                    entityBc.ChiTiet_NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien);
                }
                else
                {
                    entityBc.ChiTiet_NgayGioPhatHien = DateTime.MinValue;
                }
                if (!string.IsNullOrEmpty(thoiGianThucHien))
                {
                    entityBc.ThoiGianThucHien = HL.Core.Global.Convert.ToDateTime(thoiGianThucHien);
                }
                else
                {
                    entityBc.ThoiGianThucHien = DateTime.MinValue;
                }

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

                //Xoa toan bo thong tin InfoMagic cua Bao cao ban dau su co
                var lstInfoMagic = ModInfoMagicService.Instance.CreateQuery()
                                   .Where(o => o.BaoCaoBanDauSuCoID == entity.ID)
                                   .ToList();
                if (lstInfoMagic != null)
                {
                    ModInfoMagicService.Instance.Delete(lstInfoMagic);
                }

                //Cach thuc phat hien
                int num = modelInfo.chkCachThuc != null ? modelInfo.chkCachThuc.Length : 0;
                for (int i = 0; i < num; i++)
                {
                    string[] tmp = modelInfo.chkCachThuc[i].Split('_');
                    if (tmp.Length == 3)
                    {
                        ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                        {
                            BaoCaoBanDauSuCoID = entity.ID,
                            Order     = GetMaxOrder_InfoMagic(),
                            Published = date,
                            Activity  = true
                        };
                        entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                        if (tmp[0] == "1")
                        {
                            int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                            if (modelInfo.txtCachThuc != null && modelInfo.txtCachThuc.Length >= idx)
                            {
                                entityTmp.Name = modelInfo.txtCachThuc[idx];
                                entityTmp.Code = Data.GetCode(modelInfo.txtCachThuc[idx]);
                            }
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }

                //Da gui thong bao su co
                num = modelInfo.chkThongBao != null ? modelInfo.chkThongBao.Length : 0;
                for (int i = 0; i < num; i++)
                {
                    string[] tmp = modelInfo.chkThongBao[i].Split('_');
                    if (tmp.Length == 3)
                    {
                        ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                        {
                            BaoCaoBanDauSuCoID = entity.ID,
                            Order     = GetMaxOrder_InfoMagic(),
                            Published = date,
                            Activity  = true
                        };
                        entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                        if (tmp[0] == "1")
                        {
                            int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                            if (modelInfo.txtThongBao != null && modelInfo.txtThongBao.Length >= idx)
                            {
                                entityTmp.Name = modelInfo.txtThongBao[idx];
                                entityTmp.Code = Data.GetCode(modelInfo.txtThongBao[idx]);
                            }
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }

                //Dich vu
                num = modelInfo.chkDichVu != null ? modelInfo.chkDichVu.Length : 0;
                for (int i = 0; i < num; i++)
                {
                    string[] tmp = modelInfo.chkDichVu[i].Split('_');
                    if (tmp.Length == 3)
                    {
                        ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                        {
                            BaoCaoBanDauSuCoID = entity.ID,
                            Order     = GetMaxOrder_InfoMagic(),
                            Published = date,
                            Activity  = true
                        };
                        entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                        if (tmp[0] == "1")
                        {
                            int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                            if (modelInfo.txtDichVu != null && modelInfo.txtDichVu.Length >= idx)
                            {
                                entityTmp.Name = modelInfo.txtDichVu[idx];
                                entityTmp.Code = Data.GetCode(modelInfo.txtDichVu[idx]);
                            }
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }

                //Bien phap
                num = modelInfo.chkBienPhap != null ? modelInfo.chkBienPhap.Length : 0;
                for (int i = 0; i < num; i++)
                {
                    string[] tmp = modelInfo.chkBienPhap[i].Split('_');
                    if (tmp.Length == 3)
                    {
                        ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                        {
                            BaoCaoBanDauSuCoID = entity.ID,
                            Order     = GetMaxOrder_InfoMagic(),
                            Published = date,
                            Activity  = true
                        };
                        entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                        if (tmp[0] == "1")
                        {
                            int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                            if (modelInfo.txtBienPhap != null && modelInfo.txtBienPhap.Length >= idx)
                            {
                                entityTmp.Name = modelInfo.txtBienPhap[idx];
                                entityTmp.Code = Data.GetCode(modelInfo.txtBienPhap[idx]);
                            }
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }

                //Thong tin gui kem
                num = modelInfo.chkThongTinGuiKem != null ? modelInfo.chkThongTinGuiKem.Length : 0;
                for (int i = 0; i < num; i++)
                {
                    string[] tmp = modelInfo.chkThongTinGuiKem[i].Split('_');
                    if (tmp.Length == 3)
                    {
                        ModInfoMagicEntity entityTmp = new ModInfoMagicEntity()
                        {
                            BaoCaoBanDauSuCoID = entity.ID,
                            Order     = GetMaxOrder_InfoMagic(),
                            Published = date,
                            Activity  = true
                        };
                        entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]);
                        if (tmp[0] == "1")
                        {
                            int idx = HL.Core.Global.Convert.ToInt(tmp[1]);
                            if (modelInfo.txtThongTinGuiKem != null && modelInfo.txtThongTinGuiKem.Length >= idx)
                            {
                                entityTmp.Name = modelInfo.txtThongTinGuiKem[idx];
                                entityTmp.Code = Data.GetCode(modelInfo.txtThongTinGuiKem[idx]);
                            }
                        }
                        ModInfoMagicService.Instance.Save(entityTmp);
                    }
                }

                ViewBag.BaoCao = entityBc;

                ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
                string url = "/vn/Thanh-vien/DS-bc-ban-dau-su-co.aspx";
                if (ViewPage.CurrentPage.LangID == 2)
                {
                    url = "/en/Member/DS-bc-ban-dau-su-co.aspx";
                }
                ViewPage.Navigate(url);
            }
        }
Пример #14
0
        public void ActionCheckOut(ModProduct_CheckoutModel model)
        {
            List <ModProduct_Order_DetailsEntity> lstOrder_Details = new List <ModProduct_Order_DetailsEntity>();
            ModProduct_Order_DetailsEntity        objOrder_Detail  = null;
            int    iQuantityProduct = 0;
            int    iQuantityTotal   = 0;
            double dTotalFriceFirst = 0;

            #region Thêm thông tin đơn hàng
            ModProduct_OrderEntity objModProduct_Order = new ModProduct_OrderEntity();

            objModProduct_Order.TransportId           = model.TransportId;
            objModProduct_Order.PaymentId             = model.PaymentId;
            objModProduct_Order.CustomersCode         = null;
            objModProduct_Order.IP                    = VSW.Core.Web.HttpRequest.IP;
            objModProduct_Order.Code                  = "[Order]" + VSW.Lib.Global.Utils.GetRandString();
            objModProduct_Order.NguoiDat_FullName     = model.NguoiDat_FullName;
            objModProduct_Order.NguoiDat_Sex          = model.NguoiDat_Sex;
            objModProduct_Order.NguoiDat_Address      = model.NguoiDat_Address;
            objModProduct_Order.NguoiDat_Email        = model.NguoiDat_Email;
            objModProduct_Order.NguoiDat_PhoneNumber  = model.NguoiDat_PhoneNumber;
            objModProduct_Order.NguoiNhan_FullName    = model.NguoiNhan_FullName;
            objModProduct_Order.NguoiNhan_Sex         = model.NguoiNhan_Sex;
            objModProduct_Order.NguoiNhan_Address     = model.NguoiNhan_Address;
            objModProduct_Order.NguoiNhan_Email       = model.NguoiNhan_Email;
            objModProduct_Order.NguoiNhan_PhoneNumber = model.NguoiNhan_PhoneNumber;
            objModProduct_Order.Note                  = model.Note;
            objModProduct_Order.Status                = (int)Global.EnumValue.OrderStatus.MOI;
            objModProduct_Order.CreateDate            = DateTime.Now;

            ModProduct_OrderService.Instance.Save(objModProduct_Order);
            #endregion

            #region Lấy thông tin giỏ hàng - Chi tiết đơn hàng
            Global.Cart _Cart = new Global.Cart();
            foreach (var itemCart in _Cart.Items)
            {
                // Số lượng tất cả
                iQuantityTotal += itemCart.Quantity;

                // số lượng từng loại
                iQuantityProduct++;

                objOrder_Detail = new ModProduct_Order_DetailsEntity();

                objOrder_Detail.OrderId       = objModProduct_Order.ID;
                objOrder_Detail.ProductInfoId = itemCart.ProductID;

                objOrder_Detail.MenuID            = itemCart.MenuID;
                objOrder_Detail.LangID            = itemCart.LangID;
                objOrder_Detail.Code              = itemCart.Code;
                objOrder_Detail.Name              = itemCart.Name;
                objOrder_Detail.File              = itemCart.File;
                objOrder_Detail.Quantity          = itemCart.Quantity;
                objOrder_Detail.FriceInput        = itemCart.Price;
                objOrder_Detail.Frice             = itemCart.Price;
                objOrder_Detail.PriceSale         = itemCart.PriceSale;
                objOrder_Detail.VAT               = itemCart.VAT;
                objOrder_Detail.SaleOffType       = itemCart.SaleOffType;
                objOrder_Detail.PriceTextSaleView = itemCart.PriceTextSaleView;
                objOrder_Detail.TotalFrice        = itemCart.TotalFrice;
                objOrder_Detail.Gifts             = itemCart.Gifts;
                objOrder_Detail.Attach            = itemCart.Attach;
                objOrder_Detail.Note              = itemCart.Note;

                dTotalFriceFirst += itemCart.TotalFrice;

                // Thêm vào danh sách
                lstOrder_Details.Add(objOrder_Detail);
            }

            // thêm thông tin chi tiết
            ModProduct_Order_DetailsService.Instance.Save(lstOrder_Details);
            #endregion

            // Cập nhật lại thông tin đơn hàng
            objModProduct_Order.QuantityProduct = iQuantityProduct;
            objModProduct_Order.QuantityTotal   = iQuantityTotal;
            objModProduct_Order.Discount        = 0;

            // Số tiền tính được (Bao gồm cả VAT nếu có)
            objModProduct_Order.TotalFriceFirst = dTotalFriceFirst;

            // Sau khi đã giảm trừ (Giả sử từ cho 200 khi đặt hàng online)
            objModProduct_Order.TotalFrice = objModProduct_Order.TotalFriceFirst - objModProduct_Order.Discount;

            // Lưu lại
            ModProduct_OrderService.Instance.Save(objModProduct_Order);

            // Xóa dữ liệu của giỏ hàng
            _Cart.RemoveAll();
            _Cart.Save();

            ViewPage.Alert("Đơn hàng đã gửi thành công. Xin cảm ơn quý khách hàng!");
            ViewPage.Navigate("/default.aspx");
        }
Пример #15
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");
        }
Пример #16
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");
        }
Пример #17
0
        public void ActionUpdateBaoCaoUCSC(ModBaoCaoTongHopEntity entityBc, MSoLuongSuCoModel entitySuCo, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModBaoCaoTongHopService.Instance.CreateQuery()
                        .Where(userId > 0, o => o.UserID == userId)
                        .Where(o => o.Code == endCode)
                        .ToSingle();
            if (entity != null)
            {
                DateTime date = DateTime.Now;

                entityBc.ID = entity.ID;
                entityBc.UserID = entity.UserID;
                entityBc.UserID1 = userId;
                entityBc.MenuID = entity.MenuID;
                entityBc.State = entity.State;
                entityBc.Name = entity.Name;
                entityBc.Code = entity.Code;
                entityBc.Order = entity.Order;
                entityBc.Published = entity.Published;
                entityBc.Published1 = date;
                entityBc.Activity = false;

                var lstSuCo = ModSoLuongSuCoService.Instance.CreateQuery().Where(o => o.BaoCaoTongHopID == entity.ID).ToList();
                if (lstSuCo != null) ModSoLuongSuCoService.Instance.Delete(lstSuCo);
                int c = entitySuCo.MN.Length;
                for (int i = 0; i < c; i++)
                {
                    var suCo = new ModSoLuongSuCoEntity();
                    bool flag = false;
                    if (entitySuCo.SoLuong[i] > 0)
                    {
                        suCo.SoLuong = entitySuCo.SoLuong[i];
                        flag = true;
                    }
                    if (entitySuCo.TuXuLy[i] > 0)
                    {
                        suCo.TuXuLy = entitySuCo.TuXuLy[i];
                        flag = true;
                    }
                    if (entitySuCo.ToChucHoTro[i] > 0)
                    {
                        suCo.ToChucHoTro = entitySuCo.ToChucHoTro[i];
                        flag = true;
                    }
                    if (entitySuCo.ToChucNuocNgoaiHoTro[i] > 0)
                    {
                        suCo.ToChucNuocNgoaiHoTro = entitySuCo.ToChucNuocNgoaiHoTro[i];
                        flag = true;
                    }
                    if (entitySuCo.DeNghi[i] > 0)
                    {
                        suCo.DeNghi = entitySuCo.DeNghi[i];
                        flag = true;
                    }
                    if (entitySuCo.ThietHaiUocTinh[i] > 0)
                    {
                        suCo.ThietHaiUocTinh = entitySuCo.ThietHaiUocTinh[i];
                        flag = true;
                    }
                    if (flag == true)
                    {
                        int id = ModBaoCaoTongHopService.Instance.Save(entityBc);
                        suCo.BaoCaoTongHopID = id;
                        suCo.MenuID = entitySuCo.MN[i];
                        suCo.Published = date;
                        suCo.Order = GetMaxOrder_SoSuCo();
                        suCo.Activity = true;

                        ModSoLuongSuCoService.Instance.Save(suCo);
                    }
                }

                ViewBag.BaoCao = entityBc;

                ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
                ViewPage.Navigate("/vn/Thanh-vien/DS-bc-tong-hop-su-co.aspx");
            }
        }
Пример #18
0
        public void ActionRePassPOST(PasswordModel model)
        {
            if (model.Email.Trim() == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("Bạn chưa nhập Email.");
            }
            else if (Utils.GetEmailAddress(model.Email) == string.Empty)
            {
                ViewPage.Message.ListMessage.Add("Định dạng Email không đúng.");
            }
            else
            {
                entity = CPUserService.Instance.CreateQuery()
                         .Where(o => o.Email == model.Email).Select(o => new { o.ID, o.LoginName, o.Phone, o.TempPassword, o.Email }).ToSingle();
                if (entity == null)
                {
                    ViewPage.Message.ListMessage.Add("Email không tồn tại.");
                }
            }
            if (ViewPage.Message.ListMessage.Count > 0)
            {
                string s = @"Các thông tin còn thiếu hoặc sai chính xác \r\n";
                for (int i = 0; i < ViewPage.Message.ListMessage.Count; i++)
                {
                    s += @"\r\n" + ViewPage.Message.ListMessage[i];
                }
                ViewPage.Alert(s);
            }
            else
            {
                string pas = Utils.GetRandString();
                entity.TempPassword = Security.GetPass(pas);
                CPUserService.Instance.Save(entity, o => o.TempPassword);
                string statesendmail = Mail.SendMailUseSMTP_2(entity.Email.Trim(), Global.Setting.Sys_SiteID + " - Thông báo lấy lại mật khẩu", "Mật khẩu mới của bạn là : <b>" + pas + "</b><br />Email đăng nhập : " + entity.Email + "<br /><b><i>+ Lưu ý: Nếu không phải bạn yêu cầu đổi mật khẩu thì hãy bỏ qua thư này và đăng nhập bằng mật khẩu hiện tại.</i></b>", "");

                var objMailTo = ModConfigSendMailService.Instance.CreateQuery().Where(o => o.Activity == true && o.MailType == 137).ToSingle();
                if (objMailTo != null)
                {
                    string sHTML = string.Empty;
                    sHTML += "<p style='text-align: center;'><span style='font-size: 14px;'><strong>Th&ocirc;ng tin th&agrave;nh vi&ecirc;n reset mật khẩu:</strong></span></p>";
                    sHTML += "<table align='center' border='1' cellpadding='2' cellspacing='0' height='114' width='284'><tbody>";
                    sHTML += "<tr><td style='width: 80px;'><strong>ID</strong></td><td>" + entity.ID + "</td></tr>";
                    sHTML += "<tr><td style='width: 80px;'><strong>T&ecirc;n thảo luận</strong></td><td>" + entity.LoginName + "</td></tr>";
                    sHTML += "<tr><td style='width: 80px;'><strong>Email</strong></td><td>" + entity.Email + "</td></tr>";
                    sHTML += "<tr><td style='width: 80px;'><strong>Thời gian</strong></td><td>" + string.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Now) + "</td></tr>";
                    sHTML += "<tr><td style='width: 80px;'><strong>Mật khẩu mới</strong></td><td>" + pas + "</td></tr>";
                    sHTML += "</tbody></table>";
                    Mail.SendMailUseSMTP_2(objMailTo.ToMail, Global.Setting.Sys_SiteID + " - Thông báo lấy lại mật khẩu", sHTML, "");
                }
                var userresetpass = new ModUserResetPassEntity
                {
                    UserID    = entity.ID,
                    LoginName = entity.LoginName,
                    Phone     = entity.Phone,
                    Email     = entity.Email,
                    TimeReset = DateTime.Now,
                    PassReset = pas,
                    StateSend = string.IsNullOrEmpty(statesendmail)
                };
                ModUserResetPassService.Instance.Save(userresetpass);

                ViewPage.Alert("Hệ thống đã gửi lại mật khẩu mới cho bạn, vui lòng kiểm tra hòm thư !");
                ViewPage.Navigate("/");
            }
            ViewBag.ResetPass = model;
        }
Пример #19
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);
            }
        }
Пример #20
0
        /// <summary>
        /// Them ho so ung cuu su co
        /// </summary>
        /// <param name="entity">HS thanh vien</param>
        /// <param name="entityDm">Dau moi UCSC</param>
        public void ActionAddHoSoUCSC(ModHSThanhVienUCSCEntity entity, ModDauMoiUCSCEntity entityDm, MAppend append)
        {
            ViewBag.HoSo   = entity;
            ViewBag.DauMoi = entityDm;

            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.Order     = GetMaxOrder_HoSo();
            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.Order             = GetMaxOrder_DauMoi();
            entityDm.Published         = date;
            entityDm.Activity          = true;
            int id1 = ModDauMoiUCSCService.Instance.Save(entityDm);

            //He thong thong tin
            var arr = append.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 = id1,
                        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);
            }

            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");
        }