Ejemplo n.º 1
0
        public IActionResult KendoRead([DataSourceRequest] DataSourceRequest request)
        {
            try
            {
                if (!request.Sorts.Any())
                {
                    request.Sorts.Add(new SortDescriptor("Name", ListSortDirection.Ascending));
                }

                List <UserModel> result = new List <UserModel>();

                IEnumerable <UserModel> modelResult = _service.GetAll();


                foreach (UserModel entity in modelResult)
                {
                    entity.Password = EncryptionDecryption.GetDecrypt(entity.Password);

                    result.Add(entity);
                }

                return(Json(result.ToDataSourceResult(request)));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }
        public static string ReadReg(string Title, string keyName)//ReadLocal  value to Reg
        {
            //Title = EncryptionDecryption.Encrypt(Title, "9946");
            //keyName = EncryptionDecryption.Encrypt(keyName, "9946");

            string      t;
            RegistryKey Test = Registry.CurrentUser.OpenSubKey(Title);

            try
            {
                if (Test != null)
                {
                    Test.OpenSubKey(keyName);
                    t = Test.GetValue(keyName).ToString();
                }
                else
                {
                    t = null;
                }
                return(EncryptionDecryption.Decrypt(t, MyShopConfigration.EncyKey));
            }
            catch (NullReferenceException)
            {
                return(null);
            }
        }
        public ActionResult Login(VMLogin user)
        {
            string Pass     = EncryptionDecryption.DH_PEncode(user.Password);
            string Uname    = EncryptionDecryption.DH_PEncode(user.UserName);
            var    userInfo = (from mi in _newStaffService.All().ToList()
                               where mi.LoginName == Uname && mi.Password == Pass
                               select new
            {
                UserID = mi.StaffId,
                UserName = mi.LoginName,
                Password = mi.Password,
                Email = mi.Email
            }).FirstOrDefault();

            if (userInfo != null)
            {
                Session["UserID"]   = userInfo.UserID;
                Session["UserName"] = userInfo.UserName;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Message = "Login data is incorrect!";
                return(RedirectToAction("Authentication", "Authentication"));
            }
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> DeleteUser(Students std)
        {
            await Task.Delay(0);

            Response res = new Response();

            var Deactivebyid = std.Deactivebyid;

            if (Deactivebyid == "" || Deactivebyid == null)
            {
                Deactivebyid = std.Deactivebyid;
            }
            else
            {
                Deactivebyid = EncryptionDecryption.Decrypt(std.Deactivebyid);
            }
            res.id = std.Id;
            if (SQLDatabase.ExecNonQuery("update users set Status=0, DeactiveDateTime='" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "', Deactivebyid='" + Deactivebyid + "' where Id=" + std.Id) > 0)
            {
                res.Status = "Delete Successfully";
            }
            else
            {
                res.Status = "Deletion Failed";
            }

            return(Ok(res));
        }
Ejemplo n.º 5
0
        public UserService(ATMDbContext dbContext, IServiceProvider provider)
        {
            _dbContext = dbContext;
            var secureaccessFactory = new SecureAccessFactory();

            _encryption = secureaccessFactory.CreateInstance(provider).SecureAccess.GetEncryptionDecryption;
        }
Ejemplo n.º 6
0
        public ActionResult Index(string returnUrl)
        {
            if (ProjectSession.UserId > 0)
            {
                return(new RedirectResult(this.Url.Action(Actions.AllActivities, Controllers.Home)));
            }

            Login loginModel = new Login();

            if (this.Request.Cookies["SmartLibrary"] != null)
            {
                HttpCookie cookie = this.Request.Cookies["SmartLibrary"];

                loginModel.RememberMe = ConvertTo.ToBoolean(cookie.Values.Get("LoginIsRemember"));
                if (loginModel.RememberMe)
                {
                    if (cookie.Values.Get("LoginEmail") != null)
                    {
                        loginModel.Email = cookie.Values.Get("LoginEmail");
                    }

                    if (cookie.Values.Get("LoginPassword") != null)
                    {
                        loginModel.Password = EncryptionDecryption.DecryptByTripleDES(cookie.Values.Get("LoginPassword"));
                    }
                }
            }

            loginModel.ReturnUrl = returnUrl;
            return(this.View(Views.Index, loginModel));
        }
Ejemplo n.º 7
0
        public ActionResult SignUp(string q, string loginType, string pcnumber)
        {
            if (q == null)
            {
                return(this.RedirectToAction(Views.Index));
            }

            string emailDecrypt     = EncryptionDecryption.DecryptByTripleDES(q);
            string pcNoDecrypt      = EncryptionDecryption.DecryptByTripleDES(pcnumber);
            var    decryptLoginType = EncryptionDecryption.DecryptByTripleDES(loginType);

            if (string.IsNullOrEmpty(emailDecrypt))
            {
                return(this.RedirectToAction(Actions.Index, Controllers.Account));
            }

            Customer objCustomer = this.memberDataBL.GetCustomerList(new Customer()).Where(x => x.Email == emailDecrypt).FirstOrDefault();

            if (objCustomer == null)
            {
                objCustomer           = new Customer();
                objCustomer.Email     = emailDecrypt;
                objCustomer.LoginType = Convert.ToInt32(decryptLoginType);
                objCustomer.PCNumber  = pcNoDecrypt;
                return(this.View(Views.SignUp, objCustomer));
            }

            this.AddToastMessage(Account.CreateAccount, Messages.MemberAlreadyRegistered, Infrastructure.SystemEnumList.MessageBoxType.Error);
            return(this.RedirectToAction(Actions.Index, Controllers.Account));
        }
Ejemplo n.º 8
0
        // GET: Login
        public ActionResult Login(UserModel usm)
        {
            if (ModelState.IsValid)
            {
                using (DbContextShop dbCtx = new DbContextShop())
                {
                    string encryptedPass = EncryptionDecryption.EncriptarSHA1(usm.Password);

                    var isLogged = dbCtx.Usersses
                                   .Where(x => x.UserName.Equals(usm.UserName) &&
                                          x.Password.Equals(encryptedPass))
                                   .FirstOrDefault();


                    if (isLogged != null)
                    {
                        Session["UserName"] = usm.UserName.ToString();

                        var          path     = Server.MapPath("~") + @"Files";
                        var          fileName = "/Log.txt";
                        StreamWriter sw       = new StreamWriter(path + fileName, true);
                        sw.WriteLine("Login -" + DateTime.Now + " " + "El usuario : " + usm.UserName + " ingresó");
                        sw.Close();

                        return(RedirectToAction("Index", "Image"));
                    }
                    else
                    {
                        //return RedirectToAction("Registrar","Login");
                    }
                }
            }

            return(View(usm));
        }
Ejemplo n.º 9
0
        public ActionResult StaffLogin(string returnUrl)
        {
            Login loginModel = new Login();

            if (this.Request.Cookies["SmartLibraryAD"] != null)
            {
                System.Web.HttpCookie cookie = this.Request.Cookies["SmartLibraryAD"];

                loginModel.RememberMe = ConvertTo.ToBoolean(cookie.Values.Get("LoginIsRemember"));
                if (loginModel.RememberMe)
                {
                    if (cookie.Values.Get("LoginEmail") != null)
                    {
                        loginModel.Email = cookie.Values.Get("LoginEmail");
                    }

                    if (cookie.Values.Get("LoginPassword") != null)
                    {
                        loginModel.Password = EncryptionDecryption.DecryptByTripleDES(cookie.Values.Get("LoginPassword"));
                    }
                }
            }

            loginModel.ReturnUrl = returnUrl;
            return(this.View(Views.StaffLogin, loginModel));
        }
Ejemplo n.º 10
0
        protected void bttn_decrypt_Click(object sender, EventArgs e)
        {
            EncryptionDecryption myDecrypter = new EncryptionDecryption();
            string result = myDecrypter.Decryption(txt_decrypt.Text);

            lbl_decryptResults.Text = result;
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> ChangePassword(PasswordChange std)
        {
            await Task.Delay(0);

            Response res = new Response();
            var      Id  = EncryptionDecryption.Decrypt(std.id);

            DataTable table = SQLDatabase.GetDataTable("SELECT * FROM users WHERE Id='" + Id + "' AND Password='******'");

            if (table.Rows.Count > 0)
            {
                if (SQLDatabase.ExecNonQuery("update users set Password='******' where Id='" + Id + "'") > 0)
                {
                    res.Status = "Password Update Successfully";
                }
                else
                {
                    res.Status = "Password Updation Failed";
                }
            }
            else
            {
                res.Status = "Old Password is Incorrect";
            }

            return(Ok(res));
        }
Ejemplo n.º 12
0
        public ConnectService(IServiceProvider provider, ILogger <ConnectService> logger)
        {
            this.logger = logger;
            var secureaccessFactory = new SecureAccessFactory();

            encryption = secureaccessFactory.CreateInstance(provider).SecureAccess.GetEncryptionDecryption;
        }
Ejemplo n.º 13
0
        public ActionResult ForgotPassword(Login model)
        {
            User userModel = this.userDataBL.GetUsersList(new User()).Where(m => m.Email == model.Email).FirstOrDefault();

            if (userModel != null)
            {
                string         resetPasswordParameter        = string.Format("{0}#{1}", userModel.Id, DateTime.Now.AddMinutes(ProjectConfiguration.ResetPasswordExpireTime).ToString(ProjectConfiguration.EmailDateTimeFormat));
                string         encryptResetPasswordParameter = EncryptionDecryption.EncryptByTripleDES(resetPasswordParameter);
                string         encryptResetPasswordUrl       = string.Format("{0}?q={1}", ProjectConfiguration.SiteUrlBase + Controllers.Account + "/" + Actions.ResetPassword, encryptResetPasswordParameter);
                EmailViewModel emailModel = new EmailViewModel()
                {
                    Email      = userModel.Email,
                    Name       = userModel.FirstName + " " + userModel.LastName,
                    ResetUrl   = encryptResetPasswordUrl,
                    LanguageId = ConvertTo.ToInteger(ProjectSession.AdminPortalLanguageId)
                };
                if (UserMail.SendForgotPassword(emailModel))
                {
                    this.AddToastMessage(Resources.General.Success, Messages.EmailSent, SystemEnumList.MessageBoxType.Success);
                    return(this.RedirectToAction(Actions.Index, Controllers.Account));
                }
                else
                {
                    this.AddToastMessage(Resources.General.Error, Messages.PasswordEmailSendFail, SystemEnumList.MessageBoxType.Error);
                    return(this.View(Views.ForgotPassword, model));
                }
            }
            else
            {
                this.AddToastMessage(Resources.General.Error, Messages.UserAccountNotmatched, SystemEnumList.MessageBoxType.Error);
                return(this.View(Views.ForgotPassword, model));
            }
        }
Ejemplo n.º 14
0
        public ActionResult ForgotPassword(string emailValue, int Type)
        {
            try
            {
                using (var ctx = new LicenseApplicationContext())
                {
                    string link = string.Empty;
                    var    user = ctx.Users.Where(a => a.Email == emailValue).FirstOrDefault();
                    if (user != null && user.UsersID > 0)
                    {
                        string resetPasswordParameter        = string.Format("{0}#{1}#{2}", SystemEnum.RoleType.User.GetHashCode(), user.UsersID, DateTime.Now.AddMinutes(ProjectConfiguration.ResetPasswordExpireTime).ToString(ProjectConfiguration.EmailDateTimeFormat));
                        string encryptResetPasswordParameter = EncryptionDecryption.GetEncrypt(resetPasswordParameter);
                        string encryptResetPasswordUrl       = string.Format("{0}?q={1}", ProjectConfiguration.SiteUrlBase + TradingLicense.Web.Pages.Controllers.Account + "/" + Actions.ResetPassword, encryptResetPasswordParameter);

                        if (UserMail.SendForgotPassword(user.Email, user.Username, encryptResetPasswordUrl))
                        {
                            return(Json(new object[] { Convert.ToInt32(MessageType.success), MessageType.success.ToString(), Messages.Mailsend }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new object[] { Convert.ToInt32(MessageType.danger), MessageType.danger.ToString(), Messages.ContactToAdmin }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json(new object[] { Convert.ToInt32(MessageType.danger), MessageType.danger.ToString(), Messages.InvalidEmail }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception ex)
            {
                // ErrorLogHelper.Log(ex);
                return(Json(new object[] { Convert.ToInt32(MessageType.danger), MessageType.danger.ToString(), Messages.ContactToAdmin }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Logs the in.
        /// </summary>
        /// <returns>ActionResult.</returns>
        public ActionResult LogIn(string returnUrl)
        {
            if (ProjectSession.UserID > 0)
            {
                return(RedirectToAction(Actions.Individual, Pages.Controllers.Master));
            }

            LoginModel loginModel = new LoginModel();

            if (Request.Cookies["TradingLicenseIsRemember"] != null && Request.Cookies["TradingLicenseIsRemember"] != null)
            {
                loginModel.RememberMe = ConvertTo.Boolean(Request.Cookies["TradingLicenseIsRemember"].Value);
                if (loginModel.RememberMe)
                {
                    if (Request.Cookies["TradingLicenseUserName"] != null)
                    {
                        loginModel.Username = Request.Cookies["TradingLicenseUserName"].Value;
                    }

                    if (Request.Cookies["TradingLicensePassword"] != null)
                    {
                        loginModel.Password = EncryptionDecryption.GetDecrypt(Request.Cookies["TradingLicensePassword"].Value);
                    }
                }
            }

            if (TempData["openPopup"] != null)
            {
                ViewBag.openPopup = TempData["openPopup"];
            }

            loginModel.ReturnUrl = returnUrl;
            return(View(loginModel));
        }
Ejemplo n.º 16
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            //if there's not token header return unauthorized
            if (!actionContext.Request.Headers.Contains("x-auth-token"))
            {
                actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
                return;
            }

            string token            = actionContext.Request.Headers.GetValues("x-auth-token").First();
            EncryptionDecryption ed = new EncryptionDecryption();
            bool validation         = ed.validateToken(token);

            //if token is invalid return unauthorized
            if (!validation)
            {
                actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
                return;
            }

            if (role != null && !role.Equals(ed.getRole(token)))
            {
                actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
                return;
            }
        }
Ejemplo n.º 17
0
        public ResponseData UserLogin(LoginRequest login)
        {
            try
            {
                ResponseData responseData      = null;
                string       encryptedPassword = EncryptionDecryption.Encryption(login.Password);
                var          userData          = _context.Users.
                                                 Where(user => user.Email == login.Email && user.Password == encryptedPassword)
                                                 .FirstOrDefault <UserInfo>();

                if (userData != null)
                {
                    responseData = new ResponseData()
                    {
                        ID         = userData.ID,
                        FirstName  = userData.FirstName,
                        LastName   = userData.LastName,
                        ProfilePic = userData.ProfilePic,
                        Email      = userData.Email
                    };
                }
                return(responseData);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 18
0
        public ResponseData ResetPassword(int id, ResetPasswordRequest resetPasswordRequest)
        {
            try
            {
                ResponseData responseData = null;

                var    user        = _context.Users.First(userID => userID.ID == id);
                string newPassword = EncryptionDecryption.Encryption(resetPasswordRequest.NewPassword);
                user.Password = newPassword;
                _context.SaveChanges();

                responseData = new ResponseData()
                {
                    ID         = user.ID,
                    FirstName  = user.FirstName,
                    LastName   = user.LastName,
                    ProfilePic = user.ProfilePic,
                    Email      = user.Email
                };
                return(responseData);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 19
0
        public ActionResult Registrar(RegistrationModel userss)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DbContextShop dbCtx = new DbContextShop())
                    {
                        //var duplicate = dbCtx.Usersses.Any(x => x.UserName == userss.UserName);
                        //if (duplicate)
                        //{
                        //    ModelState.AddModelError("UserName", "Ya existe una persona con ese UserName");
                        //}
                        //else
                        //{
                        int row = dbCtx.Usersses.Count();
                        if (row > 0)
                        {
                            Userss us = new Userss()
                            {
                                LastName  = userss.LastName,
                                FirstName = userss.FirstName,
                                Email     = userss.Email,
                                UserName  = userss.UserName,
                                Password  = EncryptionDecryption.EncriptarSHA1(userss.Password)
                            };
                            dbCtx.Usersses.Add(us);
                            dbCtx.SaveChanges();
                            var          path     = Server.MapPath("~") + @"Files";
                            var          fileName = "/Log2.txt";
                            StreamWriter sw       = new StreamWriter(path + fileName, true);
                            sw.WriteLine("Metodo Registrar -" + DateTime.Now + "Se registró el cliente: " + userss.FirstName + " " + userss.LastName);
                            sw.Close();

                            return(RedirectToAction("Index", "Image"));
                        }
                        //}
                    }
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Combine the original exception message with the new one.
                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                // Throw a new DbEntityValidationException with the improved exception message.
                //throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
            }

            return(View(userss));
        }
Ejemplo n.º 20
0
        public void EncryptVPositiveTest(string input, string key_temp, string result, bool alphabetTrigger)
        {
            var alphabet = alphabetTrigger ? russianAlphabet : englishAlphabet;

            var encryptionResult = new EncryptionDecryption().EncryptV(input, key_temp, alphabet);

            Assert.AreEqual(result, encryptionResult);
        }
        public void SetUp()
        {
            DeleteOutputDirectory();
            Directory.CreateDirectory(OutputDirectory);
            File.WriteAllText(OriginalFile, Constants.PlainText);

            _sut = new EncryptionDecryption();
        }
 public ActionResult getCategoryList()
 {
     return(Json(db.tblPortfolioGalleries.Where(C => C.tblPortfolio.PortfolioID == _PortfolioID).DistinctBy(C => C.tblPortfolioGalleryCategory.PortfolioGalleryCategoryID).Select(Q => new
     {
         CategoryID = EncryptionDecryption.EncryptString(Q.tblPortfolioGalleryCategory.PortfolioGalleryCategoryID.ToString()),
         CategoryName = Q.tblPortfolioGalleryCategory.PortfolioGalleryCategoryName
     }).ToList(), JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 23
0
        private static void CreateRegistry()
        {
            EncryptionDecryption encryption = new EncryptionDecryption();
            RegistryKey          key        = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\InfofixPosBilling");

            //storing the values
            key.SetValue("ExpiryDate", encryption.Encryptdata(DateTime.Now.Date.ToString()));
            key.Close();
        }
        public ShopController(IShopping shopping, ILogger <ShopController> logger, IServiceProvider provider)
        {
            _shopping = shopping;
            _logger   = logger;

            SecureAccessFactory sa = new SecureAccessFactory();

            _encryption = sa.CreateInstance(provider).SecureAccess.GetEncryptionDecryption;
        }
Ejemplo n.º 25
0
        public async Task <IActionResult> GetBindStudent(Students std)
        {
            await Task.Delay(0);

            string    Uid   = EncryptionDecryption.Decrypt(std.str1);
            DataTable table = SQLDatabase.GetDataTable("SELECT (bindstudent.Id) AS bsid,(users.Name) AS StudentName, (courses.Coursetitle) AS CourseTitle, (bindstudent.InsertedDateTime) AS bsdatetime FROM users INNER JOIN bindstudent on bindstudent.StudentId=users.Id and bindstudent.Status=1 INNER JOIN courses ON bindstudent.CourseId=courses.Courseid");

            return(Ok(table));
        }
Ejemplo n.º 26
0
        public async Task <ActionResult> GetAllCourses(Students std)
        {
            await Task.Delay(0);

            string    Uid   = EncryptionDecryption.Decrypt(std.str1);
            DataTable table = SQLDatabase.GetDataTable("select Courseid, Coursetitle, Description, Fee from courses where Status='1' ");

            return(Ok(table));
        }
Ejemplo n.º 27
0
        public async Task <ActionResult> GetAllUser(Students std)
        {
            await Task.Delay(0);

            string    Uid   = EncryptionDecryption.Decrypt(std.str1);
            DataTable table = SQLDatabase.GetDataTable("select Id,Name,FatherName,Email,PhoneNumber,Gender,Address,Image from users where Status='1' ");

            return(Ok(table));
        }
Ejemplo n.º 28
0
        public ActionResult StaffSignUp(string q, string pcnumber)
        {
            Customer user = new Customer();

            if (q == null)
            {
                return(this.RedirectToAction(Actions.ActiveDirectoryLogin, Controllers.ActiveDirectory));
            }

            string emailDecrypt = EncryptionDecryption.DecryptByTripleDES(q);
            string pcNoDecrypt  = EncryptionDecryption.DecryptByTripleDES(pcnumber);

            if (string.IsNullOrEmpty(emailDecrypt))
            {
                return(this.RedirectToAction(Actions.ActiveDirectoryLogin, Controllers.ActiveDirectory));
            }

            var response = this.commonBL.GetADuserDataWithPCNo(pcNoDecrypt);

            if (response == null && response.Status != SystemEnumList.ApiStatus.Success.GetDescription())
            {
                this.AddToastMessage(Account.CreateAccount, response.Message, Infrastructure.SystemEnumList.MessageBoxType.Error);
                return(this.RedirectToAction(Actions.ActiveDirectoryLogin, Controllers.ActiveDirectory));
            }

            if (response.Status == SystemEnumList.ApiStatus.Success.GetDescription())
            {
                user.FirstName = response.Data.Name;
                user.Email     = response.Data.Email;
                user.LoginType = SystemEnumList.LoginType.Staff.GetHashCode();
                user.PCNumber  = response.Data.PCNumber;
                user.Active    = true;
                user.Language  = 2;
                int saveStatus = this.memberDataBL.SaveCustomer(user);
                var msgBox     = Infrastructure.SystemEnumList.MessageBoxType.Success;
                if (saveStatus > 0)
                {
                    return(this.RedirectToAction(Actions.StaffLogin, Controllers.ActiveDirectory));
                }
                else
                {
                    if (saveStatus == -2)
                    {
                        this.AddToastMessage(Account.CreateAccount, Messages.DuplicateMessage.SetArguments(Resources.General.Customer), Infrastructure.SystemEnumList.MessageBoxType.Error);
                        return(this.View(Views.SignUp, user));
                    }
                    else
                    {
                        this.AddToastMessage(Account.CreateAccount, Messages.ErrorMessage.SetArguments(Resources.General.Customer), Infrastructure.SystemEnumList.MessageBoxType.Error);
                        return(this.RedirectToAction(Actions.StaffLogin, Controllers.ActiveDirectory));
                    }
                }
            }

            this.AddToastMessage(Account.CreateAccount, response.Message, Infrastructure.SystemEnumList.MessageBoxType.Error);
            return(this.RedirectToAction(Actions.ActiveDirectoryLogin, Controllers.ActiveDirectory));
        }
Ejemplo n.º 29
0
        public async Task <ActionResult> UserProfile(Students std)
        {
            await Task.Delay(0);

            Response  res   = new Response();
            var       Id    = EncryptionDecryption.Decrypt(std.str1);
            DataTable table = SQLDatabase.GetDataTable("select Name,FatherName,Email,PhoneNumber,Gender,Address,Username from users where Id=" + Id + "");

            return(Ok(table));
        }
Ejemplo n.º 30
0
        public ShoppingService(ATMDbContext dbContext, IServiceProvider provider, IConnect connectService, ILogger <ShoppingService> logger)
        {
            var secureaccessFactory = new SecureAccessFactory();

            authentication  = secureaccessFactory.CreateInstance(provider).SecureAccess.GetSecureAccess;
            _encryption     = secureaccessFactory.CreateInstance(provider).SecureAccess.GetEncryptionDecryption;
            _dbContext      = dbContext;
            _connectService = connectService;
            _logger         = logger;
        }
        static void Main(string[] args)
        {
            //Sample of encryption
            /*
            EncryptionDecryption _entryption = new EncryptionDecryption();
            string _s1 = "12345";
            string _s2 = string.Empty; 
            string _key = string.Empty;
            _key = _entryption.DecryptPermanent("DsGSLNYJlj0Xhl0BnMFKNxGN5nHc79O65nFj2wA5Ex4uB2pVEnlHaA==", true);
            _s2 = _entryption.Encrypt(_s1, _key, true);
             */


            //Sample of decryption
            /*
            EncryptionDecryption _entryption = new EncryptionDecryption();
            string _s1 = "12345";
            string _s2 = string.Empty; 
            string _key = string.Empty;
            _key = _entryption.DecryptPermanent("DsGSLNYJlj0Xhl0BnMFKNxGN5nHc79O65nFj2wA5Ex4uB2pVEnlHaA==", true);
            _s2 = _entryption.Decrypt(_s1, _key, true);
             */

            EncryptionDecryption _entrypt = new EncryptionDecryption(); 
            //DsGSLNYJlj0Xhl0BnMFKNxGN5nHc79O65nFj2wA5Ex4uB2pVEnlHaA==
            //_entrypt.
            string _userid = "waldengroup\\administrator~0Griswold1";
            string _key = _entrypt.DecryptPermanent("DsGSLNYJlj0Xhl0BnMFKNxGN5nHc79O65nFj2wA5Ex4uB2pVEnlHaA==", true);
            string _id = _entrypt.Encrypt(_userid,_key,true);

            _id = _id.Replace("+", "~");
            //ProviderList
        //http://localhost:56630/servicestack/json/syncreply/ProviderList
            //http://localhost:56630/servicestack/json/syncreply/patientlist
            //String uri = "http://localhost:64345/servicestack/json/syncreply/checkuserid?id=" + _id;
            //String uri = "http://walden.myftp.org/barkorders/servicestack/json/syncreply/checkuserid?id=" + _id;
            //String uri = "http://walden.myftp.org/barkorders/servicestack/json/syncreply/getpatientlist?id=27";
            //string uri = "http://localhost:64350/servicestack/json/syncreply/getadtdata";
            //String uri = "http://localhost:56630/servicestack/json/syncreply/dailyexerciseroutine?dayofweek=Tuesday";

            //String uri = "http://localhost:56630/servicestack/json/syncreply/clientexerciseresults?results=Tuesday";
            String uri = "http://localhost:56630/servicestack/json/syncreply/retrieveappointment?id=8606803763";

            

            //String uri = "http://localhost:56630/servicestack/json/syncreply/clientexercises?clientid=1";
            //getpatientlist
            //String uri = "http://localhost:64345/servicestack/json/syncreply/removefromnopatientlist?id=27";
            //String uri = "http://localhost:64345/servicestack/json/syncreply/UpdateNoPatientRecord?id=27";
            //String uri = "http://100.0.3.128/InterfaceUtility/servicestack/json/syncreply/UpdateNoPatientRecord?id=27";

            //tring uri = "http://100.0.3.128/InterfaceUtility/servicestack/json/syncreply/getmiddlesexlog";
            ///getoutstandingpatients/{_providerID}"
                Stream stream;
                StreamReader reader;
                String response = null;
                WebClient webClient = new WebClient();
            //System.Collections.Specialized
            System.Collections.Specialized.NameValueCollection reqparm = new System.Collections.Specialized.NameValueCollection();

           // string example = "1~2013-02-04~Saturday February 2, 2013~2~1~1^1~2013-02-04~Saturday February 2, 2013~4~2~1^1~2013-02-04~Saturday February 2, 2013~5~3~1^1~2013-02-04~Saturday February 2, 2013~2~4~1^1~2013-02-04~Saturday February 2, 2013~2~5~1^1~2013-02-04~Saturday February 2, 2013~2~6~1^1~2013-02-04~Saturday February 2, 2013~4~7~1^1~2013-02-04~Saturday February 2, 2013~4~8~1^1~2013-02-04~Saturday February 2, 2013~4~9~1^1~2013-02-04~Saturday February 2, 2013~5~10~1^1~2013-02-04~Saturday February 2, 2013~5~11~1^";
            
           // reqparm.Add("Results",example);
    //Dim reqparm As New Specialized.NameValueCollection
    //reqparm.Add("param1", "somevalue")
    //reqparm.Add("param2", "othervalue")
    //Dim responsebytes = client.UploadValues(someurl, "POST", reqparm)
    //Dim responsebody = (New Text.UTF8Encoding).GetString(responsebytes)



                //var xx = webClient.UploadValues(uri, "POST",reqparm);
                //Dim responsebytes = client.UploadValues(someurl, "POST", reqparm)
            //webClient.
                // open and read from the supplied URI
                stream = webClient.OpenRead(uri);

                reader = new StreamReader(stream);
                response = reader.ReadToEnd();
            ///servicestack/[xml|json|html|jsv|csv]/[syncreply|asynconeway]/[servicename]

            //String request = reader.ReadToEnd();
        }