예제 #1
0
        public JsonResult EditGenCodeDay(int id)
        {
            SedesolServiceClient proxy = new SedesolServiceClient();
            GencodeDayDTO        data  = proxy.GetGenerationCodeDayById(id);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public GencodeDayDTO Save(GencodeDayDTO dto)
        {
            try
            {
                using (SEDESOLEntities db = new SEDESOLEntities())
                {
                    GEN_CODE_DAY day = db.GEN_CODE_DAY.FirstOrDefault(v => v.Id == dto.Id);
                    if (day != null)
                    {
                        GEN_CODE_DAY day2 = db.GEN_CODE_DAY.FirstOrDefault(v => v.Id_Year == dto.Id_Year && v.Id_Month == dto.Id_Month && v.Id != dto.Id);
                        if (day2 != null)
                        {
                            dto.Message = "Se ha ingresado previamente una fecha para el mes y año seleccionados.";
                        }
                        else
                        {
                            day.Id_Month = dto.Id_Month;
                            day.Id_Year  = dto.Id_Year;
                            day.Day      = dto.Day;
                            if (db.SaveChanges() > 0)
                            {
                                dto.Id      = day.Id;
                                dto.Message = "SUCCESS";
                            }
                        }
                    }
                    else
                    {
                        GEN_CODE_DAY day2 = db.GEN_CODE_DAY.FirstOrDefault(v => v.Id_Year == dto.Id_Year && v.Id_Month == dto.Id_Month);
                        if (day2 != null)
                        {
                            dto.Message = "Se ha ingresado previamente una fecha para el mes y año seleccionados.";
                        }
                        else
                        {
                            day          = new GEN_CODE_DAY();
                            day.Id_Month = dto.Id_Month;
                            day.Id_Year  = dto.Id_Year;
                            day.Day      = dto.Day;
                            db.GEN_CODE_DAY.Add(day);

                            if (db.SaveChanges() > 0)
                            {
                                dto.Id      = day.Id;
                                dto.Message = "SUCCESS";
                            }
                        }
                    }
                    return(dto);
                }
            }
            catch (Exception ex)
            {
                return(new GencodeDayDTO());
            }
        }
예제 #3
0
        public JsonResult SaveGencodeDay(GencodeDayDTO att)
        {
            try
            {
                SedesolServiceClient proxy = new SedesolServiceClient();
                att = proxy.SaveGencodeDay(att);
                List <GencodeDayDTO> listCode = new List <GencodeDayDTO>();

                if (att.Message == "SUCCESS")
                {
                    listCode = proxy.GetGenerationCodeDayAll();
                }

                string viewContent = ConvertViewToString("AvaiDateEdit", listCode);
                return(Json(new { message = att.Message, PartialView = viewContent }));
                //return PartialView("AttendanceList", captureModel.Capture.AttendanceList);
            }
            catch (Exception ex)
            {
                //return PartialView("AttendanceList", null);
                return(Json(new { message = "ERROR" }));
            }
        }
예제 #4
0
        public GencodeDayDTO Save(GencodeDayDTO dto)
        {
            GencodeDayDAO dao = new GencodeDayDAO();

            return(dao.Save(dto));
        }
예제 #5
0
        public GencodeDayDTO SaveGencodeDay(GencodeDayDTO dto)
        {
            GencodeDayDAL dal = new GencodeDayDAL();

            return(dal.Save(dto));
        }