コード例 #1
0
        public ActionResult CreateCreativeExp(CreativeExpDTO creativeExpDTO)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new ReturnFormat(400, "failed", null), JsonRequestBehavior.AllowGet));
            }
            var school = (T_DM_Truong)Session[Constant.SCHOOL_SESSION];

            if (school == null)
            {
                return(Json(new ReturnFormat(403, "access denied", null), JsonRequestBehavior.AllowGet));
            }
            RegistrationCreativeExp registrationCreativeExp = new RegistrationCreativeExp();

            Mapper.Map(creativeExpDTO, registrationCreativeExp);
            registrationCreativeExp.CreatedAt  = DateTime.Now;
            registrationCreativeExp.SchoolId   = school.SchoolID;
            registrationCreativeExp.SchoolName = school.TenTruong;
            using (var creative = new RegistrationReativeExpService())
            {
                RegistrationCreativeExp registrationCreativeExpInserted = creative.SaveRegistrationCreativeExp(registrationCreativeExp);
                //SendMailService sendMailService = new SendMailService();
                //sendMailService.SendMailToTeacherAsyncRegistrationCreative(registrationCreativeExpDetail);
            }
            return(Json(new ReturnFormat(200, "success", null), JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
 public int GetValidStudentQuantity(int programId, int sesstionADay, DateTime date)
 {
     using (var creative = new RegistrationReativeExpService())
     {
         int validQuantity = creative.CheckValidQuantityStudent(programId, sesstionADay, date);
         return(validQuantity);
     }
 }
コード例 #3
0
 public ActionResult GetDetail(int id)
 {
     using (var creative = new RegistrationReativeExpService())
     {
         var creativeExp     = creative.GetRegistrationCreativeExpById(id);
         var creativeExpJson = JsonConvert.SerializeObject(creativeExp,
                                                           Formatting.None,
                                                           new JsonSerializerSettings()
         {
             ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
         });
         return(Json(new ReturnFormat(200, "success", creativeExpJson), JsonRequestBehavior.AllowGet));
     }
 }
コード例 #4
0
        public async Task <ActionResult> ExportExcelCreativeExp(DateTime dateFrom, DateTime dateTo, int programId)
        {
            Account account = (Account)Session[Utils.Constant.MANAGER_SESSION];
            var     school  = (T_User)Session[Utils.Constant.SCHOOL_SESSION];

            if (account == null && school == null)
            {
                return(RedirectToRoute("login"));
            }
            using (var creative = new RegistrationReativeExpService())
            {
                List <RegistrationCreativeExp> registrationCreativeExps = creative.GetRegistrationCreativeExpsByProgramIdAndDateRange(programId, dateFrom, dateTo);
                string fileName = string.Concat("ds-trainghiemsangtao.xlsx");
                string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Utils/Files/" + fileName);
                await Utils.ExportExcel.GenerateXLSRegistrationCreativeExp(registrationCreativeExps, dateFrom, dateTo, filePath);

                return(File(filePath, "application/vnd.ms-excel", fileName));
            }
        }
コード例 #5
0
        public ActionResult GetRegisted(int programId)
        {
            var school = (T_DM_Truong)Session[Constant.SCHOOL_SESSION];

            if (school == null)
            {
                return(RedirectToRoute("login"));
            }
            using (var program = new ProgramsService())
            {
                ViewBag.Programs = program.GetProgramsAll();
            }
            using (var creative = new RegistrationReativeExpService())
            {
                ViewBag.Creatives = creative.GetRegistrationCreativeExpsBySchoolIdAndProgramId(school.SchoolID, programId);
            }
            ViewBag.ProgramId = programId;
            return(View());
        }
コード例 #6
0
        public ActionResult CreativeExp(int programId, DateTime dateFrom, DateTime dateTo)
        {
            var manager = (Account)Session[Constant.MANAGER_SESSION];

            if (manager == null)
            {
                return(RedirectToRoute("quanlylogin"));
            }

            var managerPersmission = (List <UserPermission>)Session[Constant.MANAGER_PERMISSION_SESSION];

            //var permission = 1;
            if (managerPersmission.Where(s => s.PermissionId == 1).FirstOrDefault() == null)
            {
                return(RedirectToRoute("quanlylogin"));
            }
            using (var program = new ProgramsService())
            {
                var programs = program.GetProgramsByAccountId(manager.Id);
                ViewBag.Programs = programs;
                using (var creative = new RegistrationReativeExpService())
                {
                    if (programs.Where(s => s.Id == programId).SingleOrDefault() == null)
                    {
                        ViewBag.Creatives = creative.GetRegistrationCreativeExpsByProgramIdAndDateRange(programs[0].Id, dateFrom, dateTo);
                        programId         = programs[0].Id;
                    }
                    else
                    {
                        ViewBag.Creatives = creative.GetRegistrationCreativeExpsByProgramIdAndDateRange(programId, dateFrom, dateTo);
                    }
                }
                ViewBag.ProgramId = programId;
            }
            ViewBag.DateFrom = dateFrom.ToString("dd-MM-yyyy");
            ViewBag.DateTo   = dateTo.ToString("dd-MM-yyyy");
            return(View());
        }