public void ActionAdd(SysMenuModel model)
        {
            if (model.RecordID > 0)
            {
                entity = WebMenuService.Instance.GetByID(model.RecordID);

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

                // khoi tao gia tri mac dinh khi insert
                entity.ParentID = model.ParentID;
                entity.Activity = true;
                entity.LangID = model.LangID;
                entity.Order = GetMaxOrder(model);

                if (model.ParentID > 0)
                    entity.Type = WebMenuService.Instance.GetByID(model.ParentID).Type;
                else
                    entity.Type = "News";
            }

            ViewBag.Data = entity;
            ViewBag.Model = model;
        }
Example #2
0
        public static string GetURL(int MenuID, string Code)
        {
            string Key_Cache = "Lib.App.ViewPage.GetURL." + MenuID;

            string _MapCode = null;
            object obj      = HL.Core.Web.Cache.GetValue(Key_Cache);

            if (obj != null)
            {
                _MapCode = obj.ToString();
            }
            else
            {
                SysPageEntity _NewPage = null;

                while (MenuID > 0)
                {
                    _NewPage = SysPageService.Instance.CreateQuery()
                               .Where(o => o.MenuID == MenuID && o.Activity == true)
                               .ToSingle_Cache();

                    if (_NewPage != null)
                    {
                        break;
                    }

                    WebMenuEntity _Menu = WebMenuService.Instance.GetByID_Cache(MenuID);

                    if (_Menu == null || (_Menu != null && _Menu.ParentID == 0))
                    {
                        break;
                    }

                    MenuID = _Menu.ParentID;
                }

                if (_NewPage != null)
                {
                    _MapCode = "/" + SysPageService.Instance.GetMapCode_Cache(_NewPage) + "/" + Code + ".aspx";
                }
                else
                {
                    _MapCode = string.Empty;
                }

                HL.Core.Web.Cache.SetValue(Key_Cache, _MapCode);
            }

            return(_MapCode);
        }
Example #3
0
        public bool Exists(string Code, int MenuID)
        {
            if (!this.IsValid())
            {
                return(true);
            }

            WebMenuEntity _Menu = WebMenuService.Instance.GetByID(MenuID);

            if (_Menu == null)
            {
                return(true);
            }

            string listID = WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID, _Menu.LangID);

            return(ModNewsService.Instance.CreateQuery()
                   .Count()
                   .Where(o => o.Code == Code)
                   .WhereIn(o => o.MenuID, listID)
                   .ToValue().ToBool());
        }
Example #4
0
        public void ActionAdd(SysMenuModel model)
        {
            if (model.RecordID > 0)
            {
                _item = WebMenuService.Instance.GetByID(model.RecordID);

                //khoi tao gia tri mac dinh khi update
            }
            else
            {
                //khoi tao gia tri mac dinh khi insert
                _item = new WebMenuEntity
                {
                    LangID   = model.LangID,
                    ParentID = model.ParentID,
                    Type     = model.ParentID > 0 ? WebMenuService.Instance.GetByID(model.ParentID).Type : "News",
                    Order    = GetMaxOrder(model),
                    Activity = true
                };
            }

            ViewBag.Data  = _item;
            ViewBag.Model = model;
        }
Example #5
0
        private bool ValidSave(ModProduct_GroupsModel model)
        {
            TryUpdateModel(item);

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

            ViewBag.Data  = item;
            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ế.");
            }

            if (CPViewPage.Message.ListMessage.Count == 0)
            {
                // Kiểm tra mã xem có trùng với mã nào khác đã có không
                string sMessError = string.Empty;
                if (ModProduct_GroupsService.Instance.DuplicateCode(item.Code, model.RecordID, ref sMessError))
                {
                    if (string.IsNullOrEmpty(sMessError))
                    {
                        CPViewPage.Message.ListMessage.Add(CPViewControl.ShowMessDuplicate("Mã nhóm sản phẩm", item.Code));
                    }
                    else
                    {
                        CPViewPage.Message.ListMessage.Add("Lỗi phát sinh: " + sMessError);
                    }
                    return(false);
                }

                //neu khong nhap code -> tu sinh
                if (item.Code.Trim() == string.Empty)
                {
                    item.Code = Data.GetCode(item.Name);
                }

                #region Tạo mới chuyên mục
                // Tạo mới Chuyên mục
                WebMenuEntity objWebMenuEntity = null;

                // Lấy thông tin của chủng loại Cha
                var dbQuery = ModProduct_GroupsService.Instance.CreateQuery()
                              .Where(o => o.ID == item.ParentId).ToList();

                if (dbQuery != null && dbQuery.Count > 0)
                {
                    // Parent ID mới của chuyên mục
                    item.Web_MenuParentId = dbQuery[0].Web_MenuId;

                    // Nếu tạo mới
                    if (item.ID <= 0)
                    {
                        objWebMenuEntity = new WebMenuEntity();
                        // Thêm mới nhận vào là MEnu cha
                        objWebMenuEntity.ParentID = dbQuery[0].Web_MenuId;
                    }
                    else
                    {
                        var dbQueryWebMenu = WebMenuService.Instance.CreateQuery()
                                             .Where(o => o.ID == item.Web_MenuId).ToList();

                        if (dbQueryWebMenu != null && dbQueryWebMenu.Count > 0)
                        {
                            objWebMenuEntity = dbQueryWebMenu[0];
                        }
                        else
                        {
                            objWebMenuEntity = new WebMenuEntity();
                        }

                        // Cập nhật lại ID cha
                        objWebMenuEntity.ParentID = item.Web_MenuParentId;
                    }

                    objWebMenuEntity.Name     = item.Name;
                    objWebMenuEntity.Code     = Data.GetCode(item.Name);
                    objWebMenuEntity.Type     = "Product_Info";
                    objWebMenuEntity.Activity = true;
                    objWebMenuEntity.LangID   = model.LangID;
                    objWebMenuEntity.Order    = Convert.ToInt32(DateTime.Now.ToString("yyyyMMmmss"));

                    try
                    {
                        // Tạo mới chuyên mục thành công
                        WebMenuService.Instance.Save(objWebMenuEntity);
                    }
                    catch (Exception ex)
                    {
                        // Tạo mới chuyên mục thất bại
                        CPViewPage.Message.ListMessage.Add(ex.Message);
                    }
                }
                #endregion

                // Lấy thông tin chuyên mục cho chủng loại
                item.Web_MenuId = objWebMenuEntity.ID;
                item.ShowHide   = true;

                try
                {
                    //save
                    ModProduct_GroupsService.Instance.Save(item);

                    string sArrPropertiesGroupsIn = model.PropertiesGroupsInId.Trim();

                    // update

                    UpdateProductGroups_PropertiesGroups(item.ID, sArrPropertiesGroupsIn);
                }
                catch (Exception ex)
                {
                    Global.Error.Write(ex);
                    CPViewPage.Message.ListMessage.Add(ex.Message);
                    return(false);
                }

                return(true);
            }

            return(false);
        }
Example #6
0
        public void ActionExport(ModBaoCaoSuCoModel model)
        {
            // sap xep tu dong
            string orderBy = AutoSort(model.Sort);

            DateTime?dFrom = null;
            DateTime?dTo   = null;
            DateTime?f     = HL.Core.Global.Convert.ToDateTime(model.From, DateTime.MinValue);
            DateTime?t     = HL.Core.Global.Convert.ToDateTime(model.To, DateTime.MaxValue);
            DateTime?from  = f != DateTime.MinValue ? f : dFrom != null ? dFrom : null;
            DateTime?to    = t != DateTime.MaxValue ? t : dTo != null ? dTo : null;

            model.From = from != null?HL.Core.Global.Convert.ToDateTime(from).ToShortDateString() : "";

            model.To = to != null?HL.Core.Global.Convert.ToDateTime(to).ToShortDateString() : "";

            // Search theo user
            var user = CPUserService.Instance.CreateQuery()
                       .Where(!string.IsNullOrEmpty(model.SearchText), o => o.LoginName.Contains(model.SearchText))
                       .ToList();
            string s = "";

            if (user != null)
            {
                s = string.Join(",", user.Select(o => o.ID).ToArray());
            }

            // Lay user chiu trach nhiem xu ly su co
            int userTrachNhiem = 0;

            if (CPLogin.CurrentUser.IsAdministrator == false)
            {
                userTrachNhiem = CPLogin.CurrentUser.ID;
            }

            // tao danh sach
            var dbQuery = ModBaoCaoSuCoService.Instance.CreateQuery()
                          .Where(!string.IsNullOrEmpty(model.SearchText) && string.IsNullOrEmpty(s), o => o.Title.Contains(model.SearchText))
                          .WhereIn(!string.IsNullOrEmpty(s), o => o.UserID, s)
                          .Where(model.State > 0, o => (o.State & model.State) == model.State)
                          .Where(userTrachNhiem > 0, o => o.UserID2 == userTrachNhiem)
                          .Where(model.ThanhVienID > 0, o => o.UserID == model.ThanhVienID)
                          .Where(model.MenuID1 > 0, o => o.MenuID1 == model.MenuID1)
                          .Where(from != null, o => o.Published >= from)
                          .Where(to != null, o => o.Published <= to)
                          .WhereIn(o => o.MenuID, WebMenuService.Instance.GetChildIDForCP("BaoCaoSuCo", model.MenuID, model.LangID))
                          .Take(model.PageSize)
                          .OrderBy(orderBy);
            var listEntity = dbQuery.ToList();

            if (listEntity == null)
            {
                CPViewPage.SetMessage("Không có dữ liệu.");
                return;
            }

            //khai báo tập hợp bản ghi excel
            List <List <object> > list = new List <List <object> >();
            //khai báo 1 dòng excel
            List <object> _list = null;

            for (int i = 0; listEntity != null && listEntity.Count > 0 && i < listEntity.Count; i++)
            {
                var user1 = CPUserService.Instance.GetByID(listEntity[i].UserID);
                var user2 = CPUserService.Instance.GetByID(listEntity[i].UserID2);
                _list = new List <object>();
                _list.Add(user2?.LoginName);
                _list.Add(user1?.LoginName);

                // Loai su co
                WebMenuEntity menu1 = WebMenuService.Instance.GetByID(listEntity[i].MenuID1);
                _list.Add(menu1?.Name);

                // Trang thai
                WebMenuEntity menu = WebMenuService.Instance.GetByID(listEntity[i].MenuID);
                _list.Add(menu?.Name);

                _list.Add(listEntity[i].Title);
                _list.Add(listEntity[i].Name);
                _list.Add(listEntity[i].Code);
                _list.Add(listEntity[i].Address);
                _list.Add(listEntity[i].Phone);
                _list.Add(listEntity[i].Email);
                _list.Add(string.Format("{0:dd/MM/yyyy}", listEntity[i].Published));
                list.Add(_list);
            }

            //ghi exel
            string temp_file = CPViewPage.Server.MapPath("~/Data/upload/files/Excel/BaoCaoSuCo_" +
                                                         string.Format("{0:yyyy_MM_dd}", DateTime.Now) + ".xlsx");
            string filePath = CPViewPage.Server.MapPath("~/TTPortal/Templates/Export_BaoCaoSuCo.xlsx");

            Excel.Export(list, 1, filePath, temp_file);
            //CPViewPage.Response.Write("Here!6");


            CPViewPage.Response.Clear();
            CPViewPage.Response.ContentType = "application/excel";
            CPViewPage.Response.AppendHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(temp_file));
            CPViewPage.Response.WriteFile(temp_file);
            CPViewPage.Response.End();

            //CPViewPage.Response.Write("Here!");
        }
Example #7
0
        public void ActionDetail(string endCode)
        {
            string layout = "";
            string ec     = endCode.ToLower();

            if (ec == "them-ho-so-ung-cuu-su-co")
            {
                layout = "HoSoUCSC";
            }
            else if (ec == "sua-ho-so-ung-cuu-su-co")
            {
                layout = "HoSoUCSC";
            }
            else if (ec == "ho-so-ung-cuu-su-co")
            {
                layout = "Index";
            }
            else if (ec == "dang-xuat")
            {
                string currUrl = ViewPage.Request.RawUrl;
                CPLogin.Logout();
                ViewPage.Response.Redirect(currUrl);
            }
            if (!string.IsNullOrEmpty(layout))
            {
                RenderView(layout);
            }
            else
            {
                int userId = HL.Lib.Global.CPLogin.UserIDOnWeb;
                var entity = ModHSThanhVienUCSCService.Instance.CreateQuery()
                             //.Where(o => o.Activity == true)
                             .Where(userId > 0, o => o.UserID == userId)
                             .Where(o => o.Code == endCode)
                             //.WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("HSThanhVienUCSC", MenuID, ViewPage.CurrentLang.ID))
                             .ToSingle();

                if (entity != null)
                {
                    ViewBag.Other = ModHSThanhVienUCSCService.Instance.CreateQuery()
                                    .Where(o => o.Activity == true)
                                    .Where(o => o.Order < entity.Order)
                                    .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("HSThanhVienUCSC", MenuID, ViewPage.CurrentLang.ID))
                                    .OrderByDesc(o => o.Order)
                                    .Take(PageSize)
                                    .ToList();

                    ViewBag.Data           = entity;
                    SetObject["view.Meta"] = entity;

                    ViewBag.HoSo = entity;
                    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();
                    ViewBag.DauMoi = dm;

                    WebMenuEntity menu1 = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "DuPhong").ToSingle();
                    if (menu1 != null)
                    {
                        var dmDuPhong = ModDauMoiUCSCService.Instance.CreateQuery()
                                        .Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID && o.MenuID == menu1.ID)
                                        .ToSingle();
                        ViewBag.DauMoiDuPhong = dmDuPhong;
                    }

                    ViewBag.HTTT = ModHeThongThongTinService.Instance.CreateQuery()
                                   .Where(o => o.Activity == true && o.DauMoiUCSCID == dm.ID)
                                   .ToList();
                    ViewBag.HTTT1 = ModHeThongThongTinService.Instance.CreateQuery()
                                    .Where(o => o.Activity == true && o.DonDangKyUCSCID == entity.ID)
                                    .ToList();
                    ViewBag.NhanLuc = ModNhanLucUCSCService.Instance.CreateQuery()
                                      .Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID)
                                      .ToList();
                    ViewBag.EndCode = endCode;

                    ViewBag.ListTongHopNhanLucLVDT     = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "LinhVucDaoDao");
                    ViewBag.ListTongHopNhanLucTDDT     = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "TrinhDoDaoTao");
                    ViewBag.ListTongHopNhanLucCC       = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "ChungChi");
                    ViewBag.ListTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "QuanLyATTT");
                    ViewBag.ListTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatPhongThu");
                    ViewBag.ListTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatBaoVe");
                    ViewBag.ListTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatKiemTra");

                    RenderView("../MInfo/HoSoUCSC");
                }
                else
                {
                    ViewPage.Error404();
                }
            }
        }
Example #8
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");
        }
Example #9
0
        //public void ExportToPDF(ModIncidentModel model)
        //{
        //    RenderView("Index");

        //    //lấy danh sách thuật ngữ
        //    var listEntity = ModIncidentService.Instance.CreateQuery()
        //                //.Where(o => o.Activity == true)
        //                .ToList();

        //    //khai báo tập hợp bản ghi excel
        //    List<List<object>> list = new List<List<object>>();
        //    //khai báo 1 dòng excel
        //    List<object> _list = null;
        //    string cityname = "";
        //    for (int i = 0; listEntity != null && listEntity.Count > 0 && i < listEntity.Count; i++)
        //    {
        //        _list = new List<object>();
        //        //add 1 dòng excel
        //        // _list.Add(i + 1);
        //        _list.Add(listEntity[i].Name);
        //        _list.Add(cityname);
        //        _list.Add(listEntity[i].Published);
        //        list.Add(_list);
        //    }

        //    //ghi exel
        //    string temp_file = CPViewPage.Server.MapPath("~/Data/upload/files/Excel/DanhSachSuCo_" +
        //    string.Format("{0:dd_MM_yyyy}", DateTime.Now) + ".xls");
        //    string filePath = CPViewPage.Server.MapPath("~/TTPortal/Templates/DanhSachSuCo.xlsx");



        //    CPViewPage.Response.ContentType = "application/pdf";
        //    CPViewPage.Response.AddHeader("content-disposition", "attachment;filename=DataTable.pdf");
        //    CPViewPage.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        //    StringWriter sw = new StringWriter();
        //    HtmlTextWriter hw = new HtmlTextWriter(sw);
        //    GridView1.RenderControl(hw);
        //    StringReader sr = new StringReader(sw.ToString());
        //    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
        //    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
        //    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
        //    pdfDoc.Open();
        //    htmlparser.Parse(sr);
        //    pdfDoc.Close();
        //    CPViewPage.Response.Write(pdfDoc);
        //    CPViewPage.Response.End();
        //}

        public void ActionSendMail(EmailEntity emailEntity)
        {
            // Lay danh sach su co
            ModIncidentEntity        suCoParent = ModIncidentService.Instance.CreateQuery().Where(o => o.ID == emailEntity.RecordID).ToSingle();
            List <ModIncidentEntity> suCos = null;
            WebMenuEntity            menuIncident = null;
            string sSuCo = string.Empty, isp = string.Empty, ip = string.Empty;
            string s2 = string.Empty, s3 = string.Empty, s4 = string.Empty, sName = string.Empty;

            //{2}: (giả mạo (phishing), nhiễm mã độc  (malware), (thay đổi giao diện) Deface )
            //{3}: , và các cố {2}
            // {4}: {2} + {3}
            if (suCoParent != null)
            {
                suCos  = ModIncidentService.Instance.CreateQuery().Where(o => o.Resolve == false && o.ParentID == suCoParent.ID).ToList();
                sSuCo += "<b><span>" + suCoParent.Path + "</span></b>";
                isp    = suCoParent.ISP;
                ip     = suCoParent.IP;
            }
            if (suCos != null && suCos.Count > 0)
            {
                int countSuCo = suCos.Count;
                for (int i = 0; i < countSuCo; i++)
                {
                    menuIncident = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "Incident" && o.ID == suCos[i].MenuID).ToSingle();
                    if (menuIncident != null)
                    {
                        sName = menuIncident.Code == "Phishing" ? "giả mạo (Phishing)" : menuIncident.Code == "Malware" ? "nhiễm mã độc(Malware)" : "thay đổi giao diện (Deface)";
                        if (i == 0)
                        {
                            s2 = sName;
                        }
                        else
                        {
                            s3 += sName;
                            if (i < countSuCo - 1)
                            {
                                s3 += ", ";
                            }
                        }
                    }
                    sSuCo += "<br />&nbsp;&nbsp;&nbsp;&nbsp;" + suCos[i].Path + "<br />";
                }
            }
            sSuCo += ip;

            // Lay template
            ModEmailTemplateEntity emailTemp = ModEmailTemplateService.Instance.CreateQuery().Where(o => o.Activity == true && o.Code == "Type1").ToSingle();

            // Lay email gui di theo ISP
            ModISPEntity ispEntity = ModISPService.Instance.CreateQuery().Where(o => o.Activity == true && o.Name == isp).ToSingle();

            if (emailTemp != null)
            {
                if (ispEntity != null)
                {
                    emailEntity.To = ispEntity.Email;
                }
                emailEntity.Cc      = "*****@*****.**";
                emailEntity.Subject = string.Format(emailTemp.Subject, isp);
                emailEntity.Body    = string.Format(emailTemp.Content, isp, sSuCo, s2, (!string.IsNullOrEmpty(s3) ? ", và các sự cố " + s3 : ""), s2 + (!string.IsNullOrEmpty(s3) ? ", " + s3 : ""));
            }

            ViewBag.Data = emailEntity;
        }
Example #10
0
        private bool ValidSave(SysMenuModel model)
        {
            if (!string.IsNullOrEmpty(model.Value))
            {
                var parent = WebMenuService.Instance.GetByID(model.ParentID);
                if (parent == null)
                {
                    return(false);
                }

                var ArrItem = model.Value.Split('\n');

                foreach (var t in ArrItem)
                {
                    if (string.IsNullOrEmpty(t.Trim()) || t.StartsWith("//"))
                    {
                        continue;
                    }

                    _item = new WebMenuEntity {
                        Name = t.Trim(), Url = Data.GetCode(t.Trim())
                    };

                    var exists = WebMenuService.Instance.CreateQuery()
                                 .Where(o => o.Url == _item.Url && o.Type == parent.Type && o.LangID == parent.LangID)
                                 .Count()
                                 .ToValue()
                                 .ToBool();

                    if (exists)
                    {
                        continue;
                    }

                    _item.Type = parent.Type;

                    _item.ParentID = model.ParentID;
                    _item.LangID   = parent.LangID;
                    if (!exists)
                    {
                        WebMenuService.Instance.Save(_item);
                    }
                    _item.Levels = _item.Parent.Levels + "-" + _item.ID;

                    _item.Order    = GetMaxOrder(model);
                    _item.Activity = true;


                    WebMenuService.Instance.Save(_item);
                }

                return(true);
            }
            else
            {
                TryUpdateModel(_item);

                _item.ID = model.RecordID;

                ViewBag.Data  = _item;
                ViewBag.Model = model;

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

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

                if (CPViewPage.Message.ListMessage.Count != 0)
                {
                    return(false);
                }

                //neu code khong duoc nhap -> tu dong tao ra khi them moi
                if (_item.Url == string.Empty)
                {
                    _item.Url = Data.GetCode(_item.Name);
                }


                try
                {
                    //neu di chuyen thi cap nhat lai Type va Order
                    if (model.RecordID > 0 && _item.ParentID != model.ParentID)
                    {
                        //cap nhat Type
                        if (_item.ParentID != 0)
                        {
                            _item.Type = WebMenuService.Instance.GetByID(_item.ParentID).Type;
                        }

                        //cap nhat Order
                        _item.Order = GetMaxOrder(model);
                    }
                    if (_item.ParentID > 0 && _item.ID > 0)
                    {
                        _item.Levels = !string.IsNullOrEmpty(_item.Parent.Levels) ? _item.Parent.Levels + "-" + _item.ID : _item.ID.ToString();
                    }
                    else if (_item.ID < 1)
                    {
                        WebMenuService.Instance.Save(_item);
                        _item.Levels = !string.IsNullOrEmpty(_item.Parent.Levels) ? _item.Parent.Levels + "-" + _item.ID : _item.ID.ToString();
                    }
                    //save
                    WebMenuService.Instance.Save(_item);

                    //neu di chuyen thi cap nhat lai Type cua chuyen muc con
                    if (model.RecordID > 0 && _item.ParentID != model.ParentID && _item.ParentID != 0)
                    {
                        //lay danh sach chuyen muc con
                        var list = new List <int>();
                        GetMenuIDChild(ref list, model.RecordID);

                        //cap nhat Type cho danh sach chuyen muc con
                        if (list.Count > 1)
                        {
                            WebMenuService.Instance.Update("[ID] IN (" + Core.Global.Array.ToString(list.ToArray()) + ")",
                                                           "@Type", WebMenuService.Instance.GetByID(_item.ParentID).Type);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Error.Write(ex);
                    CPViewPage.Message.ListMessage.Add(ex.Message);
                    return(false);
                }

                return(true);
            }
        }
Example #11
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");
        }
Example #12
0
        private bool ValidSave(SysMenuModel model)
        {
            TryUpdateModel(item);

            ViewBag.Data  = item;
            ViewBag.Model = model;
            WebMenuEntity objWebMenuEntity_Parent = null;

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

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

            if (CPViewPage.Message.ListMessage.Count == 0)
            {
                // neu code khong duoc nhap -> tu dong tao ra khi them moi
                if (item.Code == string.Empty)
                {
                    item.Code = Data.GetCode(item.Name);
                }

                if (model.ModProductAreaId <= 0)
                {
                    item.ProductAreaId = null;
                }
                else
                {
                    item.ProductAreaId = model.ModProductAreaId;
                }

                try
                {
                    //neu di chuyen thi cap nhat lai Type va Order
                    if (model.RecordID > 0 && item.ParentID != model.ParentID_Save) // !=model.ParentID
                    {
                        // cap nhat Type
                        if (item.ParentID != 0)
                        {
                            objWebMenuEntity_Parent = WebMenuService.Instance.GetByID(item.ParentID);

                            // Nếu thay đổi Cha ==> Cập nhật lại mã phân cấp
                            if (item.ParentCode != objWebMenuEntity_Parent.CurrentCode)
                            {
                                string sMaPhanCapCu  = item.CurrentCode;
                                string sMaPhanCapMoi = LayMaPhanCap(objWebMenuEntity_Parent.CurrentCode);

                                // Lấy cha mới
                                item.ParentCode = objWebMenuEntity_Parent.CurrentCode;

                                // Lấy mã phân cấp mới
                                item.CurrentCode = sMaPhanCapMoi;

                                // Cập nhật các mã phân cấp con (Nếu có)
                                CapNhatMaPhanCap(sMaPhanCapCu, sMaPhanCapMoi);
                            }

                            item.Type = objWebMenuEntity_Parent.Type;
                        }

                        // Bắt buộc cha !=0 nên sẽ ko có else

                        //cap nhat Order
                        item.Order = GetMaxOrder(model);
                    }
                    else
                    // Tạo mới
                    if (model.RecordID <= 0)
                    {
                        // Nếu Thêm mới ==> Sinh mã phân cấp
                        if (item.ParentID <= 0)
                        {
                            item.CurrentCode = LayMaPhanCap("0");
                            item.ParentCode  = "0";
                        }
                        else
                        {
                            objWebMenuEntity_Parent = WebMenuService.Instance.GetByID(item.ParentID);
                            item.CurrentCode        = LayMaPhanCap(objWebMenuEntity_Parent.CurrentCode);
                            item.ParentCode         = objWebMenuEntity_Parent.CurrentCode;
                        }
                    }

                    //save
                    WebMenuService.Instance.Save(item);


                    //neu di chuyen thi cap nhat lai Type cua chuyen muc con
                    // Comment by CanTV
                    //if (model.RecordID > 0 && item.ParentID != model.ParentID && item.ParentID != 0)
                    if (model.RecordID > 0 && item.ParentID != model.ParentID_Save && model.ParentID_Save != 0)
                    {
                        // lay danh sach chuyen muc con
                        List <int> list = new List <int>();
                        GetMenuIDChild(ref list, model.RecordID);

                        //cap nhat Type cho danh sach chuyen muc con
                        if (list.Count > 1)
                        {
                            WebMenuService.Instance.Update("[ID] IN (" + VSW.Core.Global.Array.ToString(list.ToArray()) + ")",
                                                           "@Type", WebMenuService.Instance.GetByID(item.ParentID).Type);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Global.Error.Write(ex);
                    CPViewPage.Message.ListMessage.Add(ex.Message);
                    return(false);
                }

                return(true);
            }

            return(false);
        }
Example #13
0
        /// <summary>
        /// Danh sách các thuộc tính của sản phẩm
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private string ThuocTinh(ModProduct_InfoEntity item)
        {
            string sData = string.Empty;

            // Lấy thông tin chủng loại
            WebMenuEntity objWebMenuService = WebMenuService.Instance.GetByID(item.MenuID);

            List <ModProduct_Area_PropretyGroupEntity> lstArea_PropretyGroup_All = ModProduct_Area_PropretyGroupService.Instance
                                                                                   .CreateQuery().Where(p => p.ProductAreaId == objWebMenuService.ProductAreaId).ToList();

            #region Lấy tất cả các dữ liệu nhóm theo lĩnh vực
            // Lấy danh sách các nhóm thuộc tính
            if (lstArea_PropretyGroup_All == null || lstArea_PropretyGroup_All.Count <= 0)
            {
                return(sData);
            }

            // Lấy danh sách các chuỗi Nhóm thuộc tính
            string sListPropretyGroupId_All = string.Empty;
            var    Area_PropretyGroup_All   = lstArea_PropretyGroup_All.Select(o => o.PropertiesGroupId).ToList();
            if (Area_PropretyGroup_All != null)
            {
                foreach (var itemString in Area_PropretyGroup_All)
                {
                    sListPropretyGroupId_All += "," + itemString;
                }

                sListPropretyGroupId_All = sListPropretyGroupId_All.Trim(',');
            }

            // Lấy tất cả nhóm thuộc tính
            List <ModProduct_PropertiesGroupsEntity> lstPropretyGroup_All = ModProduct_PropertiesGroupsService.Instance.CreateQuery()
                                                                            .Where(p => p.Activity == true)
                                                                            .WhereIn(p => p.ID, sListPropretyGroupId_All).OrderByAsc(o => o.Order).ToList();
            if (lstPropretyGroup_All == null || lstPropretyGroup_All.Count <= 0)
            {
                return(sData);
            }

            // Lấy tất cả thuộc tính thuộc các nhóm trên
            List <ModProduct_PropertiesListEntity> lstPropreties_All = ModProduct_PropertiesListService.Instance.CreateQuery()
                                                                       .Where(p => p.Activity == true)
                                                                       .WhereIn(p => p.PropertiesGroupsId, sListPropretyGroupId_All)
                                                                       .OrderByAsc(o => o.Order).ToList();
            if (lstPropreties_All == null)
            {
                lstPropreties_All = new List <ModProduct_PropertiesListEntity>();
            }

            string sPropertiesListId = string.Empty;
            string sListPropretyGroupId_ByPropertiesListId = string.Empty;
            foreach (var itemString in lstPropreties_All)
            {
                sPropertiesListId += "," + itemString.ID;
                sListPropretyGroupId_ByPropertiesListId += "," + itemString.PropertiesGroupsId;
            }

            sPropertiesListId = sPropertiesListId.Trim(',');
            sListPropretyGroupId_ByPropertiesListId = sListPropretyGroupId_ByPropertiesListId.Trim(',');

            // Lấy tất cả những giá trị cũ của các thuộc tính
            List <ModProduct_PropertiesList_ValuesEntity> lstPropertiesList_Values_All = null;
            if (!string.IsNullOrEmpty(sPropertiesListId))
            {
                lstPropertiesList_Values_All = ModProduct_PropertiesList_ValuesService.Instance.CreateQuery().WhereIn(p => p.PropertiesListId, sPropertiesListId).ToList();
            }

            if (lstPropertiesList_Values_All == null)
            {
                lstPropertiesList_Values_All = new List <ModProduct_PropertiesList_ValuesEntity>();
            }
            #endregion


            // Lấy danh sách các giá trị của nhóm thuộc tính
            List <ModProduct_Info_DetailsEntity> lstProduct_Info_Details = ModProduct_Info_DetailsService.Instance.CreateQuery()
                                                                           .Where(p => p.ProductInfoId == item.ID)
                                                                           .WhereIn(p => p.PropertiesGroupsId, sListPropretyGroupId_All)
                                                                           .ToList();
            if (lstProduct_Info_Details == null)
            {
                lstProduct_Info_Details = new List <ModProduct_Info_DetailsEntity>();
            }

            int iProperties = -1;
            int iSTT        = 0;
            List <ModProduct_PropertiesListEntity> lstPropreties_Filter = null;

            sData = "<table class='tbl-properties'>";

            foreach (var itemPropertiesGroup in lstPropretyGroup_All)
            {
                // Quyết định màu của dòng
                iProperties++;

                // Dòng Nhóm thuộc tính
                #region Dòng Nhóm thuộc tính
                sData += "<tr class='row" + iProperties % 2 + "'>";
                sData += "<td colspan='4'>";
                sData += "<div class='div-properties-group'><span>" + itemPropertiesGroup.Name + "</span></div>";
                sData += "</td></tr>";
                #endregion

                lstPropreties_Filter = lstPropreties_All.Where(p => p.PropertiesGroupsId == itemPropertiesGroup.ID)
                                       .OrderBy(o => o.Order)
                                       .ToList();
                if (lstPropreties_Filter == null || lstPropreties_Filter.Count <= 0)
                {
                    continue;
                }

                foreach (ModProduct_PropertiesListEntity itemPropertiesList in lstPropreties_Filter)
                {
                    // Quyết định màu của dòng
                    iProperties++;

                    sData += "<tr class='row" + iProperties % 2 + "'>";

                    sData += "<td align='center' class='td-stt'>";
                    sData += "</td>";

                    // Tên thuộc tính
                    sData += "<td align='left' nowrap='nowrap' class='td-label'>";
                    sData += "<label>" + itemPropertiesList.Name + "</label>";
                    sData += "</td>";

                    sData += "<td class='td-space'>:";
                    sData += "</td>";

                    // Ô nhập giá trị cho thuộc tính
                    sData += "<td class='td-value'>";
                    sData += GetValue_PropertiesValue(lstProduct_Info_Details, itemPropertiesList.ID);

                    // Đơn vị tính
                    if (!string.IsNullOrEmpty(itemPropertiesList.Unit))
                    {
                        sData += "&nbsp;<span>(" + itemPropertiesList.Unit + ")</span>";
                    }
                    sData += "</td>";

                    sData += "</tr>";
                }
            }

            sData += "</table>";

            return(sData);
        }
Example #14
0
        private static void SendMail()
        {
            // Khai bao bien
            List <ModIncidentEntity> incidents;
            EmailEntity   emailEntity;
            DateTime      dateNow = DateTime.Now;
            DateTime      ngayDauTuan;
            TimeSpan      subtract;
            WebMenuEntity menuIncident = null;
            WebMenuEntity chuKyGuiMail = null;
            bool          allowSend = false;
            string        sSuCo = string.Empty, isp = string.Empty, ip = string.Empty;
            string        s2 = string.Empty, s3 = string.Empty, s4 = string.Empty, sName = string.Empty;
            string        tempFolderConfig = ConfigurationManager.AppSettings.Get("TempFolder");
            string        exportTemp       = ConfigurationManager.AppSettings.Get("ExportTemp");
            string        exportConfig     = ConfigurationManager.AppSettings.Get("Export");

            if (string.IsNullOrEmpty(tempFolderConfig))
            {
                Console.WriteLine("ERROR: Ban chua cau hinh cho key TempFolder.");
                Console.WriteLine("===== Ket thuc chuong trinh =====");
                Logger.Error($"Ban chua cau hinh cho key TempFolder.");
                return;
            }
            if (string.IsNullOrEmpty(exportConfig))
            {
                Console.WriteLine("ERROR: Ban chua cau hinh cho key Export.");
                Console.WriteLine("===== Ket thuc chuong trinh =====");
                Logger.Error($"Ban chua cau hinh cho key Export.");
                return;
            }
            if (string.IsNullOrEmpty(exportTemp))
            {
                Console.WriteLine("ERROR: Ban chua cau hinh cho key ExportTemp.");
                Console.WriteLine("===== Ket thuc chuong trinh =====");
                Logger.Error($"Ban chua cau hinh cho key ExportTemp.");
                return;
            }

            // Lay ds Dich vu canh bao
            List <ModDichVuCanhBaoEntity> dvs = ModDichVuCanhBaoService.Instance.CreateQuery()
                                                .Where(o => o.Activity == true)
                                                .ToList();

            if (dvs == null)
            {
                Console.WriteLine("INFO: Khong co dich vu canh bao nao.");
                Console.WriteLine("===== Ket thuc chuong trinh =====");
                Logger.Info($"Khong co dich vu canh bao nao.");
                return;
            }

            // Lay template
            ModEmailTemplateEntity emailTemp = ModEmailTemplateService.Instance.CreateQuery().Where(o => o.Activity == true && o.Code == "Type2").ToSingle();

            if (emailTemp == null)
            {
                Console.WriteLine("FAILED: Khong co Email template.");
                Console.WriteLine("===== Ket thuc chuong trinh =====");
                Logger.Error($"Khong co Email template.");
                return;
            }

            // Duyet qua cac ban ghi dv canh bao va thuc hien gui mail tuong ung
            foreach (ModDichVuCanhBaoEntity dv in dvs)
            {
                // Lay log gui mail
                string incidentIds = string.Empty;
                ModSendMailLogsEntity sendMailLog = ModSendMailLogsService.Instance.CreateQuery().Where(o => o.Activity == true && o.DichVuCanhBaoID == dv.ID).OrderByDesc(o => o.Publish).ToSingle();
                if (sendMailLog != null)
                {
                    // Neu dich vu canh bao da gui mail trong ngay hom nay roi thi khong thuc hien gui mail nua
                    if (sendMailLog.Publish.Date == dateNow.Date)
                    {
                        continue;
                    }
                    incidentIds = sendMailLog.IncidentIDs.Trim(',');
                }

                incidents = ModIncidentService.Instance.CreateQuery()
                            .Where(o => o.Activity == true && o.Resolve == false)
                            .WhereIn(incidentIds != "", o => o.ID, incidentIds)
                            .ToList();

                if (incidents == null)
                {
                    continue;
                }

                // Lay chu ky gui mail
                chuKyGuiMail = WebMenuService.Instance.CreateQuery()
                               .Where(o => o.Activity == true && o.ID == dv.MenuID)
                               .ToSingle();
                if (chuKyGuiMail == null)
                {
                    Console.WriteLine("WARN: Dich vu canh bao co ID = " + dv.ID + " khong co chu ky gui mail.");
                    Logger.Warn($"Dich vu canh bao co ID = {dv.ID} khong co chu ky gui mail.");
                    continue;
                }

                allowSend = false;
                subtract  = dv.Time.Subtract(dateNow.TimeOfDay);
                switch (chuKyGuiMail.Code)
                {
                case "Nam":
                    if (dateNow.Day.ToString() == "1" && dateNow.Month.ToString() == "1")
                    {
                        if (subtract.Hours == 0 && subtract.Minutes <= 5)
                        {
                            allowSend = true;
                        }
                    }
                    break;

                case "Quy":
                    if (dateNow.Day.ToString() == "1" && dateNow.Month.ToString() == "4" ||
                        dateNow.Day.ToString() == "1" && dateNow.Month.ToString() == "7" ||
                        dateNow.Day.ToString() == "1" && dateNow.Month.ToString() == "10" ||
                        dateNow.Day.ToString() == "1" && dateNow.Month.ToString() == "1")
                    {
                        if (subtract.Hours == 0 && subtract.Minutes <= 5)
                        {
                            allowSend = true;
                        }
                    }
                    break;

                case "Thang":
                    if (dateNow.Day.ToString() == "1")
                    {
                        if (subtract.Hours == 0 && subtract.Minutes <= 5)
                        {
                            allowSend = true;
                        }
                    }
                    break;

                case "Tuan":
                    ngayDauTuan = GetFirstDayOfWeek(dateNow);
                    if (ngayDauTuan == dateNow)
                    {
                        if (subtract.Hours == 0 && subtract.Minutes <= 5)
                        {
                            allowSend = true;
                        }
                    }
                    break;

                case "Ngay":
                    if (subtract.Hours == 0 && subtract.Minutes <= 5)
                    {
                        allowSend = true;
                    }
                    break;

                default:
                    allowSend = false;
                    break;
                }

                if (allowSend == false)
                {
                    continue;
                }

                try
                {
                    if (incidents != null && incidents.Count > 0)
                    {
                        int countSuCo = incidents.Count;
                        for (int i = 0; i < countSuCo; i++)
                        {
                            menuIncident = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "Incident" && o.ID == incidents[i].MenuID).ToSingle();
                            if (menuIncident != null)
                            {
                                sName = menuIncident.Code == "Phishing" ? "giả mạo (Phishing)" : menuIncident.Code == "Malware" ? "nhiễm mã độc(Malware)" : "thay đổi giao diện (Deface)";
                                if (i == 0)
                                {
                                    s2 = sName;
                                }
                                else
                                {
                                    s3 += sName;
                                    if (i < countSuCo - 1)
                                    {
                                        s3 += ", ";
                                    }
                                }
                            }
                            //sSuCo += "<br />&nbsp;&nbsp;&nbsp;&nbsp;" + incidents[i].Path + "<br />";
                        }
                    }

                    emailEntity = new EmailEntity
                    {
                        To      = dv.ToEmails,
                        Cc      = string.IsNullOrEmpty(dv.CcEmails) ? "*****@*****.**" : dv.CcEmails,
                        Subject = string.Format(emailTemp.Subject, dv.Name),
                        Body    = string.Format(emailTemp.Content, dv.Name, s2 + (!string.IsNullOrEmpty(s3) ? ", " + s3 : "")),
                        Attach  = Export(dv, incidents, "Word")
                    };

                    // Goi ham send mail
                    Console.WriteLine("INFO: Thuc hien gui mail...");
                    string sendResult = Mail.SendMailUseSMTP(emailEntity.To, emailEntity.Cc, emailEntity.Subject, emailEntity.Body, emailEntity.Attach);
                    Console.Write("INFO: Ket qua gui mail:\n" + sendResult);
                    Logger.Info($"Ket qua gui mail: {sendResult}");

                    // Ghi lai log gui mail
                    ModSendMailLogsEntity logEntity = new ModSendMailLogsEntity()
                    {
                        DichVuCanhBaoID = dv.ID,
                        EmailTo         = emailEntity.To,
                        EmailCc         = emailEntity.Cc,
                        Subject         = emailEntity.Subject,
                        Body            = emailEntity.Body,
                        IncidentIDs     = incidentIds + "," + string.Join(",", incidents.Select(o => o.ID).ToArray()),
                        SendSuccess     = string.IsNullOrEmpty(sendResult) ? true : false,
                        Publish         = DateTime.Now,
                        Activity        = true
                    };
                    ModSendMailLogsService.Instance.Save(logEntity);
                }
                catch (Exception ex)
                {
                    Logger.Error($"Failed: {ex.Message}\n {ex.StackTrace}");
                    Console.WriteLine("Exception: " + ex.Message);
                }
            }
        }
Example #15
0
        public override void OnLoad()
        {
            // Lay thong tin user dang nhap
            int          loaiTV = 0, userId = 0;
            CPUserEntity user = CPLogin.CurrentUserOnWeb;

            if (user != null)
            {
                loaiTV = user.MenuID;
                userId = user.ID;
            }

            // Lay id chuyen muc la "Tin noi bo"
            int           tinNoiBoId = 0;
            WebMenuEntity menu       = WebMenuService.Instance.CreateQuery()
                                       .Where(o => o.Activity == true && o.Code == "TinNoiBo")
                                       .ToSingle();

            if (menu != null)
            {
                tinNoiBoId = menu.ID;
            }

            ViewBag.Data = ModNewsService.Instance.CreateQuery()
                           .Where(o => o.Activity == true && o.WarnNews != true && o.MenuID != tinNoiBoId)
                           .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID, ViewPage.CurrentLang.ID))
                           .Where(State > 0, o => (o.State & State) == State)
                           .OrderByDesc(o => o.Order)
                           .Take(PageSize)
                           .ToList();

            ViewBag.Data2 = ModNewsService.Instance.CreateQuery()
                            .Where(o => o.Activity == true && o.WarnNews != true && o.MenuID != tinNoiBoId)
                            .WhereIn(MenuID2 > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID2, ViewPage.CurrentLang.ID))
                            .Where(State > 0, o => (o.State & State) == State)
                            .OrderByDesc(o => o.Order)
                            .Take(PageSize)
                            .ToList();

            ViewBag.HotNews = ModNewsService.Instance.CreateQuery()
                              .Where(o => o.Activity == true && o.WarnNews != true && o.MenuID != tinNoiBoId)
                              .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID, ViewPage.CurrentLang.ID))
                              .Where(State > 0, o => (o.State & State) == State)
                              .OrderByDesc(o => o.Order)
                              .Take(PageSize)
                              .ToSingle();

            var dbQueryTinNoiBo = ModNewsService.Instance.CreateQuery()
                                  .Where(o => o.Activity == true)
                                  .Where(o => o.MenuID == tinNoiBoId && o.LoaiThanhVienID == loaiTV)
                                  .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID, ViewPage.CurrentLang.ID))
                                  .Where(State > 0, o => (o.State & State) == State)
                                  .OrderByDesc(o => o.Order)
                                  .Take(PageSize);

            ViewBag.TinNoiBo = dbQueryTinNoiBo.ToList();

            var    tmp = ModNewsService.Instance.CreateQuery().Where(a => a.Activity == true && a.WarnUserIDs != "" && a.WarnUserIDs != null).ToList();
            string s   = "";

            if (tmp != null)
            {
                s = string.Join(";", tmp.Select(o => o.WarnUserIDs).ToArray());
            }
            var dbQueryTinCanhBao = ModNewsService.Instance.CreateQuery()
                                    .Where(o => o.Activity == true && o.WarnNews == true)
                                    .Where(userId > 0, o => o.WarnUserIDs.Contains(userId.ToString()))
                                    .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("News", MenuID, ViewPage.CurrentLang.ID))
                                    .Where(State > 0, o => (o.State & State) == State)
                                    .OrderByDesc(o => o.Order)
                                    .Take(PageSize);

            ViewBag.TinCanhBao = dbQueryTinCanhBao.ToList();

            ViewBag.Title  = Title;
            ViewBag.Title2 = Title2;

            SysPageEntity page1 = SysPageService.Instance.CreateQuery().Where(o => o.MenuID == MenuID).ToSingle();

            if (page1 != null)
            {
                ViewBag.Url1 = ViewPage.GetPageURL(page1);
            }
            SysPageEntity page2 = SysPageService.Instance.CreateQuery().Where(o => o.MenuID == MenuID2).ToSingle();

            if (page2 != null)
            {
                ViewBag.Url2 = ViewPage.GetPageURL(page2);
            }

            ViewBag.Video = ModVideoService.Instance.CreateQuery()
                            .Where(o => o.Activity == true)
                            //.Where(State > 0, o => (o.State & State) == State)
                            //.WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("Video", MenuID, ViewPage.CurrentLang.ID))
                            .OrderByDesc(o => o.Order)
                            .Take(4)
                            .ToList_Cache();

            ViewBag.Album = ModAlbumService.Instance.CreateQuery()
                            .Where(o => o.Activity == true)
                            .OrderByDesc(o => o.Order)
                            .Take(4)
                            .ToList_Cache();
        }
        public void ActionAdd(ModProduct_Info_DetailsModel model)
        {
            if (model.ProductInfoId > 0)
            {
                // khoi tao gia tri mac dinh khi update
                // Lấy thông tin sản phẩm
                ModProduct_InfoEntity objModProduct_InfoEntity = ModProduct_InfoService.Instance.GetByID(model.ProductInfoId);

                // Lấy thông tin chủng loại
                WebMenuEntity objWebMenuEntity = WebMenuService.Instance.GetByID(objModProduct_InfoEntity.MenuID);

                // Lưu lại Nhóm thuộc tính ID
                model.PropertiesGroupsId = (int)objWebMenuEntity.ProductAreaId;

                if (objWebMenuEntity.ProductAreaId <= 0)
                {
                    CPViewPage.Message.ListMessage.Add("Sản phẩm chưa có nhóm thuộc tính nào. Yêu cầu chọn các nhóm cho Sản phẩm để có thể nhập thông tin");
                    ViewBag.Data = item;
                    ViewBag.Model = model;
                    return;
                }

                model.GetPropertiesList_Value = ModProduct_Info_DetailsService.Instance.CreateQuery()
                    .Where(o => o.PropertiesGroupsId == objWebMenuEntity.ProductAreaId && o.ProductInfoId == model.ProductInfoId)
                    .ToList();

                // Where In Lấy danh sách nhóm thuộc tính chứa thuộc tính SP
                model.PropertiesGroup = ModProduct_PropertiesGroupsService.Instance.CreateQuery()
                    .Where(o => o.ID == objWebMenuEntity.ProductAreaId && o.Activity == true)
                    .OrderByAsc(o => o.Order).ToSingle();

                // Lấy danh sách thuộc tính thuộc nhóm bên trên
                model.GetPropertiesList = ModProduct_PropertiesListService.Instance.CreateQuery()
                    .Where(o => o.PropertiesGroupsId == objWebMenuEntity.ProductAreaId && o.Activity == true)
                    .OrderByAsc(o => o.Order)
                    .ToList();

                // Lấy danh sách thứ tự thuộc tính để cập nhật dữ liệu theo thứ tự này
                string sThuTu = string.Empty;

                foreach (var itemProperties in model.GetPropertiesList)
                {
                    sThuTu += itemProperties.ID + ",";
                }
                model.DanhSachThuTuThuocTinh = sThuTu.Trim(',');

                // Lấy danh sách các giá trị của các thuộc tính có sẵn
                List<ModProduct_PropertiesList_ValuesEntity> lstModProduct_PropertiesList_Values= ModProduct_PropertiesList_ValuesService.Instance.CreateQuery().WhereIn(o => o.PropertiesListId, model.DanhSachThuTuThuocTinh).ToList();
                if (lstModProduct_PropertiesList_Values == null)
                    lstModProduct_PropertiesList_Values = new List<ModProduct_PropertiesList_ValuesEntity>();

                model.GetProduct_PropertiesList_Values = lstModProduct_PropertiesList_Values;
            }
            else
            {
                item = new ModProduct_Info_DetailsEntity();

                // khoi tao gia tri mac dinh khi insert
            }

            ViewBag.Data = item;
            ViewBag.Model = model;
        }