public ActionResult Router(Int32 IdCustomer, String Option)
        {
            TempData["IDCUSTOMER"] = IdCustomer;

            switch (Option)
            {
            case "NUEVO":
                return(RedirectToAction("Alta"));

            case "MODIFICAR":
                List <CustomerDischarged> data = new List <CustomerDischarged>();

                IRestResponse WSR = Task.Run(() => apiClient.getJArray("Cliente/ListarAltas", "IdCustomer=" + IdCustomer)).Result;
                if (WSR.StatusCode == HttpStatusCode.OK)
                {
                    data = JArray.Parse(WSR.Content).ToObject <List <CustomerDischarged> >();
                }
                TempData["DISCHARGED"] = data.FirstOrDefault();

                return(RedirectToAction("ModificarAlta"));

            case "ELIMINAR":
                return(RedirectToAction("EliminarAlta"));

            default:
                return(RedirectToAction("Index"));
            }
        }
Example #2
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            Customer CustomerInfo = (Customer)Session["CUSTOMERINFO"];
            Account  AccountInfo  = (Account)Session["ACCOUNTINFO"];

            if (CustomerInfo != null)
            {
                IRestResponse WSR = Task.Run(() => apiClient.getJArray("Resolucion/Listar", "IdResolution=null&IdCustomer=" + CustomerInfo.Id
                                                                       + "&IdAccount=" + AccountInfo.Id)).Result;
                if (WSR.StatusCode == HttpStatusCode.OK)
                {
                    return(Json(JArray.Parse(WSR.Content).ToObject <List <Resolution> >().ToDataSourceResult(request)));
                }
                else
                {
                    return(Json(new DataSourceResult {
                        Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                    }));
                }
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = "No cuenta con clientes asignados"
                }));
            }
        }
Example #3
0
        public ActionResult ReadFilteredData([DataSourceRequest] DataSourceRequest request, Boolean UseRegisterDate, DateTime StartDate, DateTime EndDate, Boolean?IsValid)
        {
            Customer CustomerInfo = (Customer)Session["CUSTOMERINFO"];
            Account  AccountInfo  = (Account)Session["ACCOUNTINFO"];

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Transmision/FiltrarData", "IdCustomer=" + CustomerInfo.Id
                                                                   + "&IdAccount=" + AccountInfo.Id
                                                                   + "&UseRegisterDate=" + UseRegisterDate
                                                                   + "&StartDate=" + StartDate.ToString("yyyy-MM-dd")
                                                                   + "&EndDate=" + EndDate.ToString("yyyy-MM-dd"))).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                List <Commons.Transmition.OpaDetail> data = JArray.Parse(WSR.Content).ToObject <List <Commons.Transmition.OpaDetail> >();
                if (IsValid != null)
                {
                    data = data.Where(x => x.IsValid == IsValid).ToList();
                }

                return(Json(data.ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #4
0
        public JsonResult ListarJson()
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Parametros/Listar", "")).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JObject.Parse(WSR.Content).ToObject <Parameters>(), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
        }
Example #5
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request, Int32 IdPerson)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Direccion/Listar", "IdPerson=" + IdPerson + "&IdAddressType=null")).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Address> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Rol/Listar", "IdRole=null")).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Role> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #7
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request, Int32 IdFileDetail)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Descargo/Listar/Resumen", "IdFileDetail=" + IdFileDetail)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <DischargeResume> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #8
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request, Int32?IdResolution)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Partida/Listar", "IdAccountingItem=null&IdResolution=" + IdResolution)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <AccountingItem> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #9
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            Int32  IdMainItem = Convert.ToInt32(TempData["IDMAINITEM"].ToString());
            String MainItem   = TempData["MAINITEM"].ToString();

            TempData["IDMAINITEM"] = IdMainItem;
            TempData["MAINITEM"]   = MainItem;
            ViewBag.MainItem       = MainItem;
            Customer CustomerInfo = (Customer)Session["CUSTOMERINFO"];

            if (CustomerInfo != null)
            {
                IRestResponse WSR = Task.Run(() => apiClient.getJArray("Formula/Listar", "IdFormula=null&IdCustomer=" + CustomerInfo.Id
                                                                       + "&IdMainItem=" + IdMainItem)).Result;
                if (WSR.StatusCode == HttpStatusCode.OK)
                {
                    return(Json(JArray.Parse(WSR.Content).ToObject <List <Formula> >().ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new DataSourceResult {
                        Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = "No cuenta con clientes asignados"
                }));
            }
        }
Example #10
0
        public ActionResult ReadExpiredDetail([DataSourceRequest] DataSourceRequest request, Int32 IdCustomer, Int32 IdAccount)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Dashboard/Expirados/Detalle", "IdCustomer=" + IdCustomer
                                                                   + "&IdAccount=" + IdAccount)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Commons.Dashboard.ExpiredDetail> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #11
0
        private DataSet getDataSwornDeclaration()
        {
            List <SwornDeclarationOne> data = new List <SwornDeclarationOne>();

            Functionalities.Api.Client apiClient = new Functionalities.Api.Client(System.Configuration.ConfigurationManager.AppSettings["URLAPI"]);

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Reporte/DeclaracionJuradaUno", "IdCustomer=21"
                                                                   + "&IdAccount=1"
                                                                   + "&StartDate=2017-06-01"
                                                                   + "&EndDate=2017-06-21"
                                                                   + "&GetTransmited="
                                                                   + "&FileHeaderList="
                                                                   + "&FileDetailList="
                                                                   + "&UseFreeze=false")).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                data = JArray.Parse(WSR.Content).ToObject <List <SwornDeclarationOne> >();
            }
            DataSet ds = new DataSet();

            ds.Tables.Add(ConvertToDataTable <SwornDeclarationOne>(data));
            ds.Tables[0].TableName = "ado";

            return(ds);
        }
Example #12
0
        public ActionResult RawMaterialRead([DataSourceRequest] DataSourceRequest request, Int32 IdFileDetail, Int32 IdCustomer, Int32 IdItem, Boolean UseFormula)
        {
            Account Cuenta = (Account)Session["ACCOUNTINFO"];

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Descargo/Listar/Materias", "IdFileDetail=" + IdFileDetail
                                                                   + "&IdAccount=" + Cuenta.Id
                                                                   + "&IdCustomer=" + IdCustomer
                                                                   + "&IdItem=" + IdItem
                                                                   + "&UseFormula=" + UseFormula)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <DischargeRawMaterial> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #13
0
        public ActionResult DeclaracionesFiltroReadDetail([DataSourceRequest] DataSourceRequest request, Int32 IdFileHeader)
        {
            ClienteController customerController = new ClienteController();

            Commons.Customer            customer = customerController.GetCustomer(((Commons.Customer)Session["CUSTOMERINFO"]).Id);
            Commons.Account             cuenta   = (Commons.Account)Session["ACCOUNTINFO"];
            Commons.CustomerAccountData cadata   = customerController.GetCustomerAccountData(((Commons.Customer)Session["CUSTOMERINFO"]).Id, cuenta.Id).FirstOrDefault();

            if (customer != null)
            {
                IRestResponse WSR = Task.Run(() => apiClient.getJArray("Reporte/Declaraciones/Detalle", "IdCustomer=" + customer.Id
                                                                       + "&IdAccount=" + cuenta.Id
                                                                       + "&StartDate=" + Session["StarDate"]
                                                                       + "&EndDate=" + Session["EndDate"]
                                                                       + "&GetTransmited=" + Session["GetTransmited"]
                                                                       + "&IdFileHeader=" + IdFileHeader)).Result;
                if (WSR.StatusCode == HttpStatusCode.OK)
                {
                    return(new JsonResult()
                    {
                        Data = JArray.Parse(WSR.Content).ToObject <List <FileDetail> >().ToDataSourceResult(request),
                        ContentType = "json",
                        JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                        MaxJsonLength = Int32.MaxValue
                    });
                }
                else
                {
                    return(Json(new DataSourceResult {
                        Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                    }));
                }
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = "No cuenta con clientes asignados"
                }));
            }
        }
Example #14
0
        public ActionResult getCombo()
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Prioridad/Listar", null)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Commons.Transmition.Priority> >().Select(x => new { Id = x.Id, Name = x.Name }).ToList(), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
        public List <Commons.Menu> Get(String RoleName, String UserName)
        {
            List <Commons.Menu> result = new List <Commons.Menu>();

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Menu/Listar", "RoleName=" + RoleName + "&UserName=" + UserName)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                result = JArray.Parse(WSR.Content).ToObject <List <Commons.Menu> >();
            }

            return(result);
        }
Example #16
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Ajuste/Listar", "IdFileDetailStock=" + Convert.ToInt32(Session["IdFileDetailStock"])
                                                                   + "&IdFileDetailSubstract=" + Convert.ToInt32(Session["IdFileDetailSubstract"]))).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                return(Json(JArray.Parse(WSR.Content).ToObject <List <Adjustment> >().ToDataSourceResult(request)));
            }
            else
            {
                return(Json(new DataSourceResult {
                    Errors = JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()
                }));
            }
        }
Example #17
0
        public ActionResult Registro(Int32 IdFileDetail, Int32 TransactionLine)
        {
            ViewBag.IdFileDetail    = IdFileDetail;
            ViewBag.TransactionLine = TransactionLine;
            Freeze model = new Freeze();

            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Congelar/ListarRegistro", "IdFileDetail=" + IdFileDetail)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                model           = JObject.Parse(WSR.Content).ToObject <Freeze>();
                model.Discharge = (model.Discharge == 0) ? model.Stock : model.Discharge;
            }

            return(View(model));
        }
        public ActionResult Router(Int32 IdFileInfoConfig)
        {
            List <FileInfoConfig> data = new List <FileInfoConfig>();

            Account       cuenta = (Account)Session["ACCOUNTINFO"];
            IRestResponse WSR    = Task.Run(() => apiClient.getJArray("Documento/Configuracion/Listar", "IdFileInfoConfig=" + IdFileInfoConfig + "&IdFileInfo=null&IdAccount=" + cuenta.Id)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                data = JArray.Parse(WSR.Content).ToObject <List <FileInfoConfig> >();
            }

            if (data == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            else
            {
                TempData["FILEINFOCONFIG"] = data.FirstOrDefault();

                return(RedirectToAction("Index"));
            }
        }
Example #19
0
        public ActionResult Actualizar(Int32 IdFileHeader)
        {
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Encabezado/Listar", "IdFileHeader=" + IdFileHeader
                                                                   + "&IdCustomer=null&IdAccount=null&IdFileInfoConfig=null")).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                ViewBag.data = JsonConvert.SerializeObject(JArray.Parse(WSR.Content).ToObject <List <FileHeader> >().FirstOrDefault());
            }

            return(View());
        }
        public ActionResult Login(UserLogin model)
        {
            Commons.User response = new Commons.User();
            if (ModelState.IsValid)
            {
                IRestResponse result = Task.Run(() => apiClient.getJArray("Seguridad/Autenticar/Web",
                                                                          "UserName="******"&Password="******"null")
                    {
                        response = Newtonsoft.Json.JsonConvert.DeserializeObject <Commons.User>(result.Content);
                        if (response.Active)
                        {
                            FormsAuthentication.SetAuthCookie(model.Username, true);
                            Session["USERINFO"]    = response;
                            Session["STRUSERNAME"] = response.UserName;

                            List <Role>   roles       = new List <Role>();
                            IRestResponse wsrAssigned = Task.Run(() => apiClient.getJArray("Rol/ListarPorUsuario", "UserName="******"", "Su usuario no cuenta no cuenta con roles asignados en el sistema. Comuníquese con el administrador de seguridad de la aplicación.");
                                return(View(model));
                            }
                            else if (response.PasswordReset)
                            {
                                if (response.OAuthMobile == true && response.OAuthSite == true)
                                {
                                    TempData["USERNAME"] = response.UserName;
                                    if (roles.Count == 1)
                                    {
                                        Session["ROLEINFO"] = roles[0];
                                        Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                    }
                                    Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                    Session.Timeout        = 30;
                                    return(RedirectToAction("Cambio", "Seguridad"));
                                }
                                else
                                {
                                    if (response.OAuthMobile)
                                    {
                                        TempData["USERNAME"] = response.UserName;
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("CambioMovil", "Seguridad"));
                                    }
                                    else if (response.OAuthSite)
                                    {
                                        TempData["USERNAME"] = response.UserName;
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("CambioWeb", "Seguridad"));
                                    }
                                    else
                                    {
                                        if (roles.Count == 1)
                                        {
                                            Session["ROLEINFO"] = roles[0];
                                            Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                        }
                                        Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                        Session.Timeout        = 30;
                                        return(RedirectToAction("EvaluteAssigned"));
                                    }
                                }
                            }
                            else
                            {
                                if (roles.Count == 1)
                                {
                                    Session["ROLEINFO"] = roles[0];
                                    Session["MENUINFO"] = new MenuController().Get(roles[0].Name, response.UserName);
                                }
                                Session["GOTCUSTOMER"] = new UsuarioController().GotUserAssigned(response.UserName);
                                Session.Timeout        = 30;
                                return(RedirectToAction("EvaluteAssigned"));
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", "Credenciales incorrectas");
                            return(View(model));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Credenciales incorrectas");
                        return(View(model));
                    }
                }
                else
                {
                    ModelState.AddModelError("", JObject.Parse(result.Content).ToObject <Commons.Error>().Message.ToString());
                    return(View(model));
                }
            }
            else
            {
                return(View(model));
            }
        }