コード例 #1
0
        public void ActionAdd(ModHSThanhVienUCSCModel model)
        {
            if (model.RecordID > 0)
            {
                entity = ModHSThanhVienUCSCService.Instance.GetByID(model.RecordID);

                // khoi tao gia tri mac dinh khi update
                entity.UserID1 = Lib.Global.CPLogin.UserID;

                entityDM = ModDauMoiUCSCService.Instance.CreateQuery()
                           .Where(o => o.Activity == true && o.HSThanhVienUCSCID == model.RecordID)
                           .ToSingle();
                entityHTTT = ModHeThongThongTinService.Instance.CreateQuery()
                             .Where(o => o.Activity == true && o.DauMoiUCSCID == entityDM.ID)
                             .ToList();
            }
            else
            {
                entity     = new ModHSThanhVienUCSCEntity();
                entityDM   = new ModDauMoiUCSCEntity();
                entityHTTT = new List <ModHeThongThongTinEntity>();

                // khoi tao gia tri mac dinh khi insert
                entity.MenuID    = model.MenuID;
                entity.UserID    = Lib.Global.CPLogin.UserID;
                entity.Published = DateTime.Now;
                entity.Activity  = CPViewPage.UserPermissions.Approve;
                entity.Order     = GetMaxOrder(model);
            }

            ViewBag.DauMoi = entityDM;
            ViewBag.HTTT   = entityHTTT;
            ViewBag.Data   = entity;
            ViewBag.Model  = model;
        }
コード例 #2
0
 public void ActionSaveNew(ModHSThanhVienUCSCModel model, ModDauMoiUCSCEntity entityDm, MAppend append)
 {
     if (ValidSave(model, entityDm, append))
     {
         SaveNewRedirect(model.RecordID, entity.ID);
     }
 }
コード例 #3
0
 public void ActionSave(ModHSThanhVienUCSCModel model, ModDauMoiUCSCEntity entityDm, MAppend append)
 {
     if (ValidSave(model, entityDm, append))
     {
         SaveRedirect();
     }
 }
コード例 #4
0
        private bool ValidSave(ModHSThanhVienUCSCModel model, ModDauMoiUCSCEntity entityDm, MAppend append)
        {
            TryUpdateModel(entity);

            //chong hack
            entity.ID = model.RecordID;

            ViewBag.Data  = entity;
            ViewBag.Model = model;

            CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error;

            //kiem tra quyen han
            if ((model.RecordID < 1 && !CPViewPage.UserPermissions.Add) || (model.RecordID > 0 && !CPViewPage.UserPermissions.Edit))
            {
                CPViewPage.Message.ListMessage.Add("Quyền hạn chế.");
            }

            //kiem tra ten
            if (entity.Name.Trim() == string.Empty)
            {
                CPViewPage.Message.ListMessage.Add("Nhập tên.");
            }

            //kiem tra chuyen muc
            //if (entity.MenuID < 1)
            //    CPViewPage.Message.ListMessage.Add("Chọn chuyên mục.");

            if (CPViewPage.Message.ListMessage.Count == 0)
            {
                //neu khong nhap code -> tu sinh
                if (entity.Code.Trim() == string.Empty)
                {
                    entity.Code = Data.GetCode(entity.Name);
                }

                //cap nhat state
                entity.State = GetState(model.ArrState);

                //save
                int id = ModHSThanhVienUCSCService.Instance.Save(entity);
                if (model.RecordID > 0)
                {
                    UpdateOther(entity, entityDm, append);
                }
                else
                {
                    SaveOther(id, entityDm, append);
                }

                return(true);
            }

            return(false);
        }
コード例 #5
0
        public void SaveOther(int id, ModDauMoiUCSCEntity entityDm, MAppend append)
        {
            ViewBag.HoSo   = entity;
            ViewBag.DauMoi = entityDm;

            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         = DateTime.Now;
            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);
            }
        }
コード例 #6
0
        public void ActionAdd(ModDauMoiUCSCModel model)
        {
            if (model.RecordID > 0)
            {
                entity = ModDauMoiUCSCService.Instance.GetByID(model.RecordID);

                // khoi tao gia tri mac dinh khi update
            }
            else
            {
                entity = new ModDauMoiUCSCEntity();

                // khoi tao gia tri mac dinh khi insert
                entity.MenuID    = model.MenuID;
                entity.Published = DateTime.Now;
                entity.Activity  = CPViewPage.UserPermissions.Approve;
                entity.Order     = GetMaxOrder(model);
            }

            ViewBag.Data  = entity;
            ViewBag.Model = model;
        }
コード例 #7
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");
        }
コード例 #8
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");
        }
コード例 #9
0
        public void UpdateOther(ModHSThanhVienUCSCEntity entityHs, ModDauMoiUCSCEntity entityDm, MAppend append)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModHSThanhVienUCSCService.Instance.CreateQuery()
                         //.Where(userId > 0, o => o.UserID == userId)
                         .Where(o => o.Code == entityHs.Code)
                         .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      = append.Name1;
                entityDm.Code      = Data.GetCode(append.Name1);
                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 = 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 = 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;
            }
        }
コード例 #10
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");
        }