public ActionResult UpdateCustomerPass(string CurrentPass, string Pass) { if (HttpContext.Request.Cookies[StaticLicense.LicName + "Active"] != null) { string SSSession = ""; HttpCookie cookie = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Active"); if (cookie != null) { Encryption ENC = new Encryption(); SSSession = ENC.DecryptText(cookie.Value, "OMD_Token"); ActivationModel act = JsonConvert.DeserializeObject <ActivationModel>(SSSession); PDBC db = new PDBC("PandaMarketCMS", true); List <ExcParameters> parss = new List <ExcParameters>(); ExcParameters par = new ExcParameters() { _KEY = "@CurrentPass", _VALUE = ENC.MD5Hash(CurrentPass) }; parss.Add(par); par = new ExcParameters() { _KEY = "@Pass", _VALUE = ENC.MD5Hash(Pass) }; parss.Add(par); par = new ExcParameters() { _KEY = "@CustomerId", _VALUE = act.CustomerId }; parss.Add(par); db.Connect(); if (Convert.ToInt32(db.Select("SELECT COUNT(*) FROM [tbl_Customer_Main] WHERE id_Customer= @CustomerId AND C_Password = @CurrentPass", parss).Rows[0][0]) != 0) { db.Script("UPDATE [tbl_Customer_Main] SET[C_Password] =@Pass WHERE id_Customer= @CustomerId", parss); db.DC(); return(Content("Success")); } else { db.DC(); return(Content("WrongPass")); } } else { return(Content("Error")); } } else { return(Content("Login")); } }
public ActionResult GetCustomerAddress() { if (HttpContext.Request.Cookies[StaticLicense.LicName + "Active"] != null) { string SSSession = ""; HttpCookie cookie = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Active"); if (cookie != null) { Encryption ENC = new Encryption(); SSSession = ENC.DecryptText(cookie.Value, "OMD_Token"); ActivationModel act = JsonConvert.DeserializeObject <ActivationModel>(SSSession); PDBC db = new PDBC("PandaMarketCMS", true); db.Connect(); List <ExcParameters> parss = new List <ExcParameters>(); D_APIModelFiller DMF = new D_APIModelFiller(); return(Json(DMF.CustomerAddresses(Convert.ToInt32(act.CustomerId)))); } else { return(Content("Error")); } } else { return(Content("Login")); } }
public void AddAsync(ActivationModel model) { AsyncManager.Parameters["activationModel"] = model; if (!ModelState.IsValid) { AsyncManager.Parameters["validationError"] = true; return; } if (PostTokenIsMostRecentlySubmittedOne(model.PostToken)) { // Resubmits get bounced with an error message (only a refresh will generate a new token)- client side JS should prevent this from being a normal occurrence ModelState.AddModelError("", Resource.Controllers.ActivationController.AlreadySubmittedErrorMessage); AsyncManager.Parameters["validationError"] = true; return; } // Prevent any resubmits (minus ones just for validation purposes) as that could result in another activation taking place from Software Potential service's perspective StashLastRequestToken(model.PostToken); AsyncManager.OutstandingOperations.Increment(); AsyncManager.Parameters["validationError"] = false; AsyncManager.Parameters["activationTask"] = SpAgent.Product.Activation.OnlineActivateAsync(model.ActivationKey) .ContinueWith(task => { AsyncManager.OutstandingOperations.Decrement(); if (task.IsFaulted) { throw task.Exception; } }); }
public async Task <ActionResult> Add(ActivationModel model) { if (!ModelState.IsValid) { return(View(model)); } if (PostTokenIsMostRecentlySubmittedOne(model.PostToken)) { // Resubmits get bounced with an error message (only a refresh will generate a new token)- client side JS should prevent this from being a normal occurrence ModelState.AddModelError("", Resource.Controllers.ActivationController.AlreadySubmittedErrorMessage); return(View(model)); } // Prevent any resubmits (minus ones just for validation purposes) as that could result in another activation taking place from Software Potential service's perspective StashLastRequestToken(model.PostToken); try { await SpAgent.Product.Activation.OnlineActivateAsync(model.ActivationKey); } catch (Exception ex) { ModelState.AddModelError("", string.Format(Resource.Controllers.ActivationController.FailureMessage, model.ActivationKey, ex.Message)); // Re-render the page (with a new PostToken so that a form resubmission will pass the PostToken validation) return(View(new ActivationModel { PostToken = Guid.NewGuid(), ActivationKey = model.ActivationKey })); } // Redirect as per PRG to prevent resubmits return(RedirectToAction("Success")); }
public ActionResult AddCustomerAddress(int cityId, string Address, string CodePosti) { if (HttpContext.Request.Cookies[StaticLicense.LicName + "Active"] != null) { string SSSession = ""; HttpCookie cookie = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Active"); if (cookie != null) { Encryption ENC = new Encryption(); SSSession = ENC.DecryptText(cookie.Value, "OMD_Token"); ActivationModel act = JsonConvert.DeserializeObject <ActivationModel>(SSSession); PDBC db = new PDBC("PandaMarketCMS", true); db.Connect(); List <ExcParameters> parss = new List <ExcParameters>(); ExcParameters par = new ExcParameters() { _KEY = "@cityId", _VALUE = cityId }; parss.Add(par); par = new ExcParameters() { _KEY = "@Address", _VALUE = Address }; parss.Add(par); par = new ExcParameters() { _KEY = "@CodePosti", _VALUE = CodePosti }; parss.Add(par); par = new ExcParameters() { _KEY = "@CustomerId", _VALUE = act.CustomerId }; parss.Add(par); string AddresId = db.Script("INSERT INTO [tbl_Customer_Address] output inserted.id_CAddress VALUES( @CustomerId ,@cityId ,@CodePosti,@Address)", parss); db.DC(); return(Content("Success")); } else { return(Content("Error")); } } else { return(Content("Login")); } }
public ActionResult AccountActivationSaveData([Bind(Prefix = "Item2")] ActivationModel act) { var authModel = new AuthModel(); var activationModel = new ActivationModel(); var tuple = Tuple.Create(authModel, activationModel); tuple.Item2.Email = act.Email; tuple.Item2.PinCode = act.PinCode; //var gg= "<p class='uk-text-danger'>" + act.Email + "</p>"; return(Json(new { success = "true" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddCompleted(Task activationTask, ActivationModel activationModel, bool validationError) { if (validationError) { return(View(activationModel)); } try { activationTask.Wait(); } catch (Exception ex) { string exceptionMessage = ex is AggregateException ? ((AggregateException)ex).Flatten().InnerException.Message : ex.Message; ModelState.AddModelError("", string.Format(Resource.Controllers.ActivationController.FailureMessage, activationModel.ActivationKey, exceptionMessage)); // Re-render the page (with a new PostToken so that a form resubmission will pass the PostToken validation) return(View(new ActivationModel { PostToken = Guid.NewGuid(), ActivationKey = activationModel.ActivationKey })); } // Redirect as per PRG to prevent resubmits return(RedirectToAction("Success")); }
public ActionResult UpdateCustomerData(string Name, string familly, string Email, string Phonenum) { if (HttpContext.Request.Cookies[StaticLicense.LicName + "Active"] != null) { string SSSession = ""; HttpCookie cookie = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Active"); if (cookie != null) { Encryption ENC = new Encryption(); SSSession = ENC.DecryptText(cookie.Value, "OMD_Token"); ActivationModel act = JsonConvert.DeserializeObject <ActivationModel>(SSSession); PDBC db = new PDBC("PandaMarketCMS", true); List <ExcParameters> parss = new List <ExcParameters>(); ExcParameters par = new ExcParameters() { _KEY = "@Name", _VALUE = Name }; parss.Add(par); par = new ExcParameters() { _KEY = "@familly", _VALUE = familly }; parss.Add(par); par = new ExcParameters() { _KEY = "@CustomerId", _VALUE = act.CustomerId }; parss.Add(par); par = new ExcParameters() { _KEY = "@Phonenum", _VALUE = Phonenum }; parss.Add(par); par = new ExcParameters() { _KEY = "@Email", _VALUE = Email }; parss.Add(par); db.Connect(); db.Script("UPDATE [tbl_Customer_Main]SET [C_Mobile] = @Phonenum,[C_FirstName] =@Name ,[C_LastNAme] =@familly ,[C_ISActivate] = 1 ,[C_Email] =@Email WHERE id_Customer=@CustomerId", parss); db.DC(); return(Content("Success")); } else { return(Content("Error")); } } else { return(Content("Login")); } }
public ActionResult AddComment_Product(int ProId, string Email, string Name, string Message) { string CustomerId = "0"; if (HttpContext.Request.Cookies[StaticLicense.LicName + "Active"] != null) { string SSSession = ""; HttpCookie cookie = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Active"); if (cookie != null) { Encryption ENC = new Encryption(); SSSession = ENC.DecryptText(cookie.Value, "OMD_Token"); ActivationModel act = JsonConvert.DeserializeObject <ActivationModel>(SSSession); CustomerId = act.CustomerId; } } PDBC db = new PDBC("PandaMarketCMS", true); List <ExcParameters> parss = new List <ExcParameters>(); ExcParameters par = new ExcParameters() { _KEY = "@ProId", _VALUE = ProId }; parss.Add(par); par = new ExcParameters() { _KEY = "@Email", _VALUE = Email }; parss.Add(par); par = new ExcParameters() { _KEY = "@Name", _VALUE = Name }; parss.Add(par); par = new ExcParameters() { _KEY = "@Message", _VALUE = Message }; parss.Add(par); par = new ExcParameters() { _KEY = "@CustomerId", _VALUE = CustomerId }; parss.Add(par); db.Connect(); string result = db.Script("INSERT INTO [tbl_Product_Comment]VALUES(@Email,@Name,N'',@Message,@ProId,GETDATE(),@CustomerId)", parss); db.DC(); if (result == "1") { return(Content("Success")); } else { return(Content("NOSuccess")); } }
private void DoWork(object sender, DoWorkEventArgs e) { try { var instance = Singleton.Instance; //Check Database Vs System Version _activationModel = ValidateProduct(); if (_activationModel != null && _activationModel.DatabaseVersionDate != 0 && _activationModel.MaximumSystemVersion != 0) { if (instance.SystemVersionDate < _activationModel.DatabaseVersionDate) { _higherDbVersion = true; } if (Singleton.SystemVersionDate > _activationModel.MaximumSystemVersion) { _higherSystemVersion = true; } } if (!_higherDbVersion && !_higherSystemVersion) { ProductActivationDTO activation = _unitOfWork.Repository <ProductActivationDTO>().Query().Get().FirstOrDefault(); if (activation == null) { _activations = true; } else if (activation.KeyStatus == KeyStatus.Blocked) { _blockedKey = true; } else { LicensedTo = activation.LicensedTo; //Thread.Sleep(1000); //To show to whom the license belongs if (activation.RegisteredBiosSn.Contains(new ProductActivationDTO().BiosSn)) { //Check if this product is expired and also check if it is Renewed on the server //Otherwise close the app OR disable features if (activation.KeyStatus == KeyStatus.Expired || DateTime.Now > activation.ExpiryDate) { ActivationKey key = CheckProductRenewalOnActivationServer(activation.ProductKey); if (key != null) { if (key.ExpiryDate != activation.ExpiryDate) { activation.ExpiryDate = key.ExpiryDate; activation.LastRenewedDate = key.LastRenewedDate; activation.KeyStatus = KeyStatus.Active; } else { activation.KeyStatus = KeyStatus.Expired; } } else { activation.KeyStatus = KeyStatus.Expired; } _unitOfWork.Repository <ProductActivationDTO>().InsertUpdate(activation); _unitOfWork.Commit(); } else if (activation.KeyStatus == KeyStatus.Active) { Singleton.ProductActivation = activation; _login = true; } } else { if (Singleton.Edition == PinnaFaceEdition.ServerEdition) { _activations = true; } else { _suspeciousActivation = true; } } } } } catch (Exception exception) { _exceptions = exception; } }