Ejemplo n.º 1
0
        public IActionResult Getpackage(string reference)
        {
            MSParameters par = new MSParameters("ref", reference);

            Parameter.Add(par);
            return(new JsonResult(MSutil.ExecuteStopProcedureToJson("Getpackage", Parameter)));
        }
Ejemplo n.º 2
0
        public IActionResult ChangePassword(UsersChangePassword usersChangePassword)
        {
            MSParameters par = new MSParameters("LoginUser", User.Claims.Where(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname").Select(c => c.Value).DefaultIfEmpty("Failed").First());

            Parameter.Add(par);
            par = new MSParameters("LoginPassword", usersChangePassword.usr_Pswd_Old);
            Parameter.Add(par);

            GeneralFuntions functions;

            DataTable LoginUser = MSutil.ExecuteStopProcedure("ps_ValidateUserLogin", Parameter);

            if (LoginUser.Rows[0]["authentication"].ToString() == "Success")
            {
                Parameter.Clear();

                Parameter.Add(new MSParameters("_usr_ID", functions.Base64Decode(LoginUser.Rows[0]["usr_ID"].ToString())));
                Parameter.Add(new MSParameters("_usr_Pswd", usersChangePassword.usr_Pswd));

                DataTable result = MSutil.ExecuteStopProcedure("pf_usr_change_password", Parameter);
                TempData["result"]  = result.Rows[0][0].ToString();
                TempData["message"] = result.Rows[0][1].ToString();
            }
            else
            {
                TempData["changePasswordFailed"] = "Error al intentar cambiar la contraseña. Por favor ingrese las credenciales correctas...";
                //return PartialView("Admin/_login");
            }

            return(PartialView("Admin/User/_ChangePassword"));
        }
Ejemplo n.º 3
0
        public IActionResult Attent(int id)
        {
            MSParameters par = new MSParameters("id", id.ToString());

            Parameter.Add(par);
            MSutil.ExecuteStopProcedureNotResult("Attent", Parameter);

            return(new JsonResult("true"));
        }
Ejemplo n.º 4
0
        public IActionResult InactiveCoin(int id)
        {
            MSParameters par = new MSParameters("id", id.ToString());

            Parameter.Add(par);
            MSutil.ExecuteStopProcedureNotResult("SetInactivateCurrenPrice", Parameter);

            return(new JsonResult("true"));
        }
Ejemplo n.º 5
0
        public IActionResult AddCoin(string name, string value, string bank)
        {
            MSParameters par = new MSParameters("name", name);

            Parameter.Add(par);
            par = new MSParameters("valor", value);
            Parameter.Add(par);
            par = new MSParameters("bank", bank);
            Parameter.Add(par);
            return(new JsonResult(MSutil.ExecuteStopProcedureToJson("AddCurrenPrice", Parameter)));
        }
Ejemplo n.º 6
0
        public IActionResult Setpackage(string reference, string detail, string progress)
        {
            MSParameters par = new MSParameters("ref", reference);

            Parameter.Add(par);
            par = new MSParameters("detail", detail);
            Parameter.Add(par);
            par = new MSParameters("progress", progress);
            Parameter.Add(par);
            MSutil.ExecuteStopProcedureNotResult("Setpackage", Parameter);

            return(new JsonResult("true"));
        }
Ejemplo n.º 7
0
        public IActionResult Setpackage(PackageModel package)
        {
            MSParameters par = new MSParameters("ref", package.Pck_ref);

            Parameter.Add(par);

            par = new MSParameters("detailSend", package.Pck_detailSend);
            Parameter.Add(par);
            par = new MSParameters("progress", package.Pck_progress);
            Parameter.Add(par);
            par = new MSParameters("IdCustomer", package.Pck_IdCustomer);
            Parameter.Add(par);
            par = new MSParameters("NameCustomer", package.Pck_NameCustomer);
            Parameter.Add(par);
            par = new MSParameters("LastNameCustomer", package.Pck_LastNameCustomer);
            Parameter.Add(par);
            par = new MSParameters("AgeCustomer", package.Pck_AgeCustomer);
            Parameter.Add(par);
            par = new MSParameters("PhoneCustomer", package.Pck_PhoneCustomer[0] + ";" + package.Pck_PhoneCustomer[1] + ";" + package.Pck_PhoneCustomer[2]);
            Parameter.Add(par);
            par = new MSParameters("AddressCustomer", package.Pck_AddressCustomer);
            Parameter.Add(par);
            par = new MSParameters("EmailCustomer", package.Pck_EmailCustomer);
            Parameter.Add(par);
            par = new MSParameters("NameLastnamebeneficiary", package.Pck_NameLastnamebeneficiary);
            Parameter.Add(par);
            par = new MSParameters("Phonebeneficiary", package.Pck_Phonebeneficiary[0] + ";" + package.Pck_Phonebeneficiary[1] + ";" + package.Pck_Phonebeneficiary[2]);
            Parameter.Add(par);
            par = new MSParameters("Addressbeneficiary", package.Pck_Addressbeneficiary);
            Parameter.Add(par);
            par = new MSParameters("NameCollector", package.Pck_NameCollector);
            Parameter.Add(par);
            par = new MSParameters("IdCollector", package.Pck_IdCollector);
            Parameter.Add(par);
            par = new MSParameters("PriceByKg", package.Pck_PriceByKg);
            Parameter.Add(par);
            par = new MSParameters("KgInSuitCase", package.Pck_KgInSuitCase);
            Parameter.Add(par);
            par = new MSParameters("Coin", package.Pck_Coin);
            Parameter.Add(par);
            par = new MSParameters("TypeChange", package.Pck_TypeChange);
            Parameter.Add(par);
            par = new MSParameters("TotalPrice", package.Pck_TotalPrice);
            Parameter.Add(par);
            par = new MSParameters("Date", package.Pck_Date);
            Parameter.Add(par);
            par = new MSParameters("detailArticles", package.Pck_detailArticles);
            Parameter.Add(par);

            return(new JsonResult(MSutil.ExecuteStopProcedureToJson("Setpackage", Parameter)));
        }
Ejemplo n.º 8
0
        public IActionResult UpdateCoins(string id, string name, string value, string bank)
        {
            MSParameters par = new MSParameters("name", name);

            Parameter.Add(par);
            par = new MSParameters("valor", value);
            Parameter.Add(par);
            par = new MSParameters("bank", bank);
            Parameter.Add(par);
            par = new MSParameters("id", id);
            Parameter.Add(par);
            MSutil.ExecuteStopProcedureNotResult("UpdateCurrenPrice", Parameter);

            return(new JsonResult("true"));
        }
Ejemplo n.º 9
0
        public IActionResult SendRecomendation(string name, string phone, string email, string message)
        {
            MSParameters par = new MSParameters("name", name);

            Parameter.Add(par);
            par = new MSParameters("phone", phone);
            Parameter.Add(par);
            par = new MSParameters("email", email);
            Parameter.Add(par);
            par = new MSParameters("message", message);
            Parameter.Add(par);
            MSutil.ExecuteStopProcedureNotResult("SendRecomendation", Parameter);

            return(new JsonResult("true"));
        }
Ejemplo n.º 10
0
        //public class IndexModel: PageModel
        //{
        //    private WebSettings WebSetting = new WebSettings();
        //    private List<MSParameters> Parameter = new List<MSParameters>();
        //    MSutils MSutil = new MSutils("SERVER=localhost;" + "DATABASE=gt;" + "UID=root;" + "PASSWORD=;");
        public IActionResult Login(string usr, string pswd)
        {
            MSParameters par = new MSParameters("_user", usr);

            Parameter.Add(par);
            par = new MSParameters("pswd", pswd);
            Parameter.Add(par);
            DataTable _user = MSutil.ExecuteStopProcedure("ps_GetUserLogin", Parameter);
            //User user = new User(_user.Rows[0][0], _user.Rows[0][1], _user.Rows[0][2], _user.Rows[0][3], _user.Rows[0][4], _user.Rows[0][5], _user.Rows[0][6], _user.Rows[0][7], _user.Rows[0][8]);
            List <User> users = new List <User>();

            foreach (DataRow row in _user.Rows)
            {
                User user = new User()
                {
                    usr_Name       = row[0].ToString(),
                    usr_Email      = row[1].ToString(),
                    usr_Nameperson = row[2].ToString(),
                    usr_Birthday   = Convert.ToDateTime(row[3].ToString()),
                    lan_ID         = Convert.ToInt32(row[4].ToString()),
                    pro_id         = Convert.ToInt32(row[5].ToString()),
                    pro_Name       = row[6].ToString(),
                    acc_id         = Convert.ToInt32(row[7].ToString()),
                    acc_key        = row[8].ToString()
                };
                users.Add(user);
            }


            //List<User> users = new List<User> {


            //};
            return(PartialView("Admin/_menu", users));

            //return new PartialViewResult {
            //        ViewName = "Admin/_menu",
            //    ViewData = new ViewDataDictionary<List<user>>(ViewData, user)
            //            };
            //}
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Login(Users user)
        {
            ModelState.Remove("usr_ID");
            ModelState.Remove("usr_Email");
            ModelState.Remove("usr_Nameperson");
            ModelState.Remove("usr_Birthday");
            ModelState.Remove("lan_ID");
            ModelState.Remove("pro_id");
            ModelState.Remove("usr_is_deleted");
            ModelState.Remove("usr_Pswd_Confirm");

            //List<Users> users = new List<Users>();

            if (ModelState.IsValid)
            {
                MSParameters par = new MSParameters("LoginUser", user.usr_Name);
                Parameter.Add(par);
                par = new MSParameters("LoginPassword", user.usr_Pswd);
                Parameter.Add(par);

                GeneralFuntions functions;

                DataTable LoginUser = MSutil.ExecuteStopProcedure("ps_ValidateUserLogin", Parameter);

                if (LoginUser.Rows[0]["authentication"].ToString() == "Success")
                {
                    Parameter.Clear();

                    par = new MSParameters("usr_id", functions.Base64Decode(LoginUser.Rows[0]["usr_ID"].ToString()));

                    Parameter.Add(par);

                    DataTable UserDetails = MSutil.ExecuteStopProcedure("ps_GetUserById", Parameter);
                    user.usr_ID         = UserDetails.Rows[0][0].ToString();
                    user.usr_Name       = UserDetails.Rows[0][1].ToString();
                    user.usr_Email      = UserDetails.Rows[0][2].ToString();
                    user.usr_Nameperson = UserDetails.Rows[0][3].ToString();
                    user.usr_Birthday   = Convert.ToDateTime(UserDetails.Rows[0][4].ToString());
                    user.lan_ID         = Convert.ToInt32(UserDetails.Rows[0][5].ToString());
                    user.pro_id         = Convert.ToInt32(UserDetails.Rows[0][6].ToString());

                    user.OnGetProfileAccess();

                    ClaimsIdentity identity = new ClaimsIdentity(new[] {
                        new Claim(ClaimTypes.Name, user.usr_Nameperson),
                        new Claim(ClaimTypes.Email, user.usr_Email),
                        new Claim(ClaimTypes.NameIdentifier, user.usr_ID),
                        new Claim(ClaimTypes.DateOfBirth, user.usr_Birthday.ToString()),
                        new Claim(ClaimTypes.Surname, user.usr_Name)//,
                        //new Claim("abc", "abc", ClaimValueTypes.String)
                    }, CookieAuthenticationDefaults.AuthenticationScheme);


                    foreach (var item in user.userAccess)
                    {
                        identity.AddClaim(new Claim(item.acc_key, item.acc_key, ClaimValueTypes.String));
                    }

                    //identity.AddClaim

                    ClaimsPrincipal principal = new ClaimsPrincipal(identity);

                    await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);

                    return(RedirectToAction("Index", "Admin"));
                }
                else
                {
                    TempData["UserLoginFailed"] = "Error de inicio de sesion. Por favor ingrese las credenciales correctas...";
                    return(PartialView("Admin/_login"));
                }
            }
            else
            {
                return(PartialView("Admin/_login"));
            }
        }