public ActionResult Post(bool IsNew, Detalle_Pagos_EmpresaModel varDetalle_Pagos_Empresa) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Pagos_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Pagos_EmpresaInfo = new Detalle_Pagos_Empresa { Folio = varDetalle_Pagos_Empresa.Folio , Suscripcion = varDetalle_Pagos_Empresa.Suscripcion , Concepto_de_Pago = varDetalle_Pagos_Empresa.Concepto_de_Pago , Fecha_de_Suscripcion = (!String.IsNullOrEmpty(varDetalle_Pagos_Empresa.Fecha_de_Suscripcion)) ? DateTime.ParseExact(varDetalle_Pagos_Empresa.Fecha_de_Suscripcion, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Numero_de_Pago = varDetalle_Pagos_Empresa.Numero_de_Pago , De_Total_de_Pagos = varDetalle_Pagos_Empresa.De_Total_de_Pagos , Fecha_Limite_de_Pago = (!String.IsNullOrEmpty(varDetalle_Pagos_Empresa.Fecha_Limite_de_Pago)) ? DateTime.ParseExact(varDetalle_Pagos_Empresa.Fecha_Limite_de_Pago, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Recordatorio_dias = varDetalle_Pagos_Empresa.Recordatorio_dias , Forma_de_Pago = varDetalle_Pagos_Empresa.Forma_de_Pago , Fecha_de_Pago = (!String.IsNullOrEmpty(varDetalle_Pagos_Empresa.Fecha_de_Pago)) ? DateTime.ParseExact(varDetalle_Pagos_Empresa.Fecha_de_Pago, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Estatus = varDetalle_Pagos_Empresa.Estatus }; result = !IsNew? _IDetalle_Pagos_EmpresaApiConsumer.Update(Detalle_Pagos_EmpresaInfo, null, null).Resource.ToString() : _IDetalle_Pagos_EmpresaApiConsumer.Insert(Detalle_Pagos_EmpresaInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44411); ViewBag.Permission = permission; var varDetalle_Pagos_Empresa = new Detalle_Pagos_EmpresaModel(); ViewBag.ObjectId = "44411"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Pagos_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Pagos_EmpresaData = _IDetalle_Pagos_EmpresaApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Pagos_Empresas[0]; if (Detalle_Pagos_EmpresaData == null) { return(HttpNotFound()); } varDetalle_Pagos_Empresa = new Detalle_Pagos_EmpresaModel { Folio = (int)Detalle_Pagos_EmpresaData.Folio , Suscripcion = Detalle_Pagos_EmpresaData.Suscripcion , SuscripcionNombre_del_Plan = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Suscripcion), "Planes_de_Suscripcion") ?? (string)Detalle_Pagos_EmpresaData.Suscripcion_Planes_de_Suscripcion.Nombre_del_Plan , Concepto_de_Pago = Detalle_Pagos_EmpresaData.Concepto_de_Pago , Fecha_de_Suscripcion = (Detalle_Pagos_EmpresaData.Fecha_de_Suscripcion == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_de_Suscripcion).ToString(ConfigurationProperty.DateFormat)) , Numero_de_Pago = Detalle_Pagos_EmpresaData.Numero_de_Pago , De_Total_de_Pagos = Detalle_Pagos_EmpresaData.De_Total_de_Pagos , Fecha_Limite_de_Pago = (Detalle_Pagos_EmpresaData.Fecha_Limite_de_Pago == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_Limite_de_Pago).ToString(ConfigurationProperty.DateFormat)) , Recordatorio_dias = Detalle_Pagos_EmpresaData.Recordatorio_dias , Forma_de_Pago = Detalle_Pagos_EmpresaData.Forma_de_Pago , Forma_de_PagoNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Forma_de_Pago), "Formas_de_Pago") ?? (string)Detalle_Pagos_EmpresaData.Forma_de_Pago_Formas_de_Pago.Nombre , Fecha_de_Pago = (Detalle_Pagos_EmpresaData.Fecha_de_Pago == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_de_Pago).ToString(ConfigurationProperty.DateFormat)) , Estatus = Detalle_Pagos_EmpresaData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Estatus), "Estatus_de_Pago") ?? (string)Detalle_Pagos_EmpresaData.Estatus_Estatus_de_Pago.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IPlanes_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token); var Planes_de_Suscripcions_Suscripcion = _IPlanes_de_SuscripcionApiConsumer.SelAll(true); if (Planes_de_Suscripcions_Suscripcion != null && Planes_de_Suscripcions_Suscripcion.Resource != null) { ViewBag.Planes_de_Suscripcions_Suscripcion = Planes_de_Suscripcions_Suscripcion.Resource.Where(m => m.Nombre_del_Plan != null).OrderBy(m => m.Nombre_del_Plan).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Planes_de_Suscripcion", "Nombre_del_Plan") ?? m.Nombre_del_Plan.ToString(), Value = Convert.ToString(m.Folio) }).ToList(); } _IFormas_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var Formas_de_Pagos_Forma_de_Pago = _IFormas_de_PagoApiConsumer.SelAll(true); if (Formas_de_Pagos_Forma_de_Pago != null && Formas_de_Pagos_Forma_de_Pago.Resource != null) { ViewBag.Formas_de_Pagos_Forma_de_Pago = Formas_de_Pagos_Forma_de_Pago.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Formas_de_Pago", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IEstatus_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_de_Pagos_Estatus = _IEstatus_de_PagoApiConsumer.SelAll(true); if (Estatus_de_Pagos_Estatus != null && Estatus_de_Pagos_Estatus.Resource != null) { ViewBag.Estatus_de_Pagos_Estatus = Estatus_de_Pagos_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_de_Pago", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Pagos_Empresa)); }
public ActionResult AddDetalle_Pagos_Empresa(int rowIndex = 0, int functionMode = 0, int id = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44411); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Pagos_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Pagos_EmpresaModel varDetalle_Pagos_Empresa = new Detalle_Pagos_EmpresaModel(); if (id.ToString() != "0") { var Detalle_Pagos_EmpresasData = _IDetalle_Pagos_EmpresaApiConsumer.ListaSelAll(0, 1000, "Detalle_Pagos_Empresa.Folio=" + id, "").Resource.Detalle_Pagos_Empresas; if (Detalle_Pagos_EmpresasData != null && Detalle_Pagos_EmpresasData.Count > 0) { var Detalle_Pagos_EmpresaData = Detalle_Pagos_EmpresasData.First(); varDetalle_Pagos_Empresa = new Detalle_Pagos_EmpresaModel { Folio = Detalle_Pagos_EmpresaData.Folio , Suscripcion = Detalle_Pagos_EmpresaData.Suscripcion , SuscripcionNombre_del_Plan = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Suscripcion), "Planes_de_Suscripcion") ?? (string)Detalle_Pagos_EmpresaData.Suscripcion_Planes_de_Suscripcion.Nombre_del_Plan , Concepto_de_Pago = Detalle_Pagos_EmpresaData.Concepto_de_Pago , Fecha_de_Suscripcion = (Detalle_Pagos_EmpresaData.Fecha_de_Suscripcion == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_de_Suscripcion).ToString(ConfigurationProperty.DateFormat)) , Numero_de_Pago = Detalle_Pagos_EmpresaData.Numero_de_Pago , De_Total_de_Pagos = Detalle_Pagos_EmpresaData.De_Total_de_Pagos , Fecha_Limite_de_Pago = (Detalle_Pagos_EmpresaData.Fecha_Limite_de_Pago == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_Limite_de_Pago).ToString(ConfigurationProperty.DateFormat)) , Recordatorio_dias = Detalle_Pagos_EmpresaData.Recordatorio_dias , Forma_de_Pago = Detalle_Pagos_EmpresaData.Forma_de_Pago , Forma_de_PagoNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Forma_de_Pago), "Formas_de_Pago") ?? (string)Detalle_Pagos_EmpresaData.Forma_de_Pago_Formas_de_Pago.Nombre , Fecha_de_Pago = (Detalle_Pagos_EmpresaData.Fecha_de_Pago == null ? string.Empty : Convert.ToDateTime(Detalle_Pagos_EmpresaData.Fecha_de_Pago).ToString(ConfigurationProperty.DateFormat)) , Estatus = Detalle_Pagos_EmpresaData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Pagos_EmpresaData.Estatus), "Estatus_de_Pago") ?? (string)Detalle_Pagos_EmpresaData.Estatus_Estatus_de_Pago.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IPlanes_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token); var Planes_de_Suscripcions_Suscripcion = _IPlanes_de_SuscripcionApiConsumer.SelAll(true); if (Planes_de_Suscripcions_Suscripcion != null && Planes_de_Suscripcions_Suscripcion.Resource != null) { ViewBag.Planes_de_Suscripcions_Suscripcion = Planes_de_Suscripcions_Suscripcion.Resource.Where(m => m.Nombre_del_Plan != null).OrderBy(m => m.Nombre_del_Plan).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Planes_de_Suscripcion", "Nombre_del_Plan") ?? m.Nombre_del_Plan.ToString(), Value = Convert.ToString(m.Folio) }).ToList(); } _IFormas_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var Formas_de_Pagos_Forma_de_Pago = _IFormas_de_PagoApiConsumer.SelAll(true); if (Formas_de_Pagos_Forma_de_Pago != null && Formas_de_Pagos_Forma_de_Pago.Resource != null) { ViewBag.Formas_de_Pagos_Forma_de_Pago = Formas_de_Pagos_Forma_de_Pago.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Formas_de_Pago", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IEstatus_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_de_Pagos_Estatus = _IEstatus_de_PagoApiConsumer.SelAll(true); if (Estatus_de_Pagos_Estatus != null && Estatus_de_Pagos_Estatus.Resource != null) { ViewBag.Estatus_de_Pagos_Estatus = Estatus_de_Pagos_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_de_Pago", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_Pagos_Empresa", varDetalle_Pagos_Empresa)); }