Exemplo n.º 1
0
        public void ActionAdd(ModProduct_OfficeModel model)
        {
            if (model.RecordID > 0)
            {
                item = ModProduct_OfficeService.Instance.GetByID(model.RecordID);

                // khoi tao gia tri mac dinh khi update

                // Lấy quốc gia
                ModProduct_CityEntity objModProduct_CityEntity = ModProduct_CityService.Instance.GetByID(item.ProductCityId);

                // Lấy danh sách tỉnh thành
                model.DanhSachTinhThanh = model.ShowTinhThanh(objModProduct_CityEntity.ProductNationalId, objModProduct_CityEntity.ID);

                // Lấy danh sách quốc gia
                model.DanhSachQuocGia = model.ShowQuocGia(objModProduct_CityEntity.ProductNationalId);
            }
            else
            {
                item = new ModProduct_OfficeEntity();

                // khoi tao gia tri mac dinh khi insert
                item.Activity = CPViewPage.UserPermissions.Approve;

                // Lấy danh sách quốc gia: Mặc định là 1
                model.DanhSachQuocGia = model.ShowQuocGia(1);

                // Lấy danh sách tỉnh thành: Mặc định là 1
                model.DanhSachTinhThanh = model.ShowTinhThanh(1, 1);
            }

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