Exemplo n.º 1
0
        public JsonResult Login(string userName, string password)
        {
            try
            {
                password = Utility.EncryptMd5(password.Trim());
                var ipl = SingletonIpl.GetInstance <IplAccount>();
                var ue  = new AccountEntity();
                var res = ipl.Login(userName, password.Trim(), ref ue);//Md5Util.Md5EnCrypt(password.Trim())

                if (res)
                {
                    var userSess = new UserSession
                    {
                        UserName    = ue.UserName,
                        UserType    = ue.Type,
                        Id          = int.Parse(ue.Id.ToString()),
                        DisplayName = ue.DisplayName,
                        Avatar      = ue.Avatar,
                        Email       = ue.Email
                    };
                    SessionUtility.SetUser(userSess);
                    Session["UserName"] = userName;
                }

                return(Json(new { status = res }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 2
0
        //End
        //********Quan tâm của tôi******
        public JsonResult AddWishlist(long id)
        {
            var obj = SessionUtility.GetSessionMember(Session);

            if (obj == null)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));//Bạn phải đăng nhập để thực hiện chức năng này.
            }
            else
            {
                var memberCareProductBusiness = new MemberCareProductBusiness();
                var listCare =
                    memberCareProductBusiness.GetDynamicQuery()
                    .Where(x => x.MemberId == obj.Id && x.ProductId == id)
                    .ToList();
                if (listCare.Any())
                {
                    return(Json(1, JsonRequestBehavior.AllowGet));//Sản phẩm đã có trong danh sách quan tâm của bạn
                }
                else
                {
                    var entity = new MemberCareProduct {
                        MemberId = obj.Id, ProductId = id
                    };
                    memberCareProductBusiness.AddNew(entity);
                    return(Json(2, JsonRequestBehavior.AllowGet));//Sản phẩm đã được thêm vào danh sách quan tâm của bạn
                }
            }
        }
Exemplo n.º 3
0
        //End

        #region Add comment

        public JsonResult AddComment(string array)
        {
            var serializerSettings = new JsonSerializerSettings
            {
                PreserveReferencesHandling = PreserveReferencesHandling.Objects
            };

            var arr = JsonConvert.DeserializeObject <List <string> >(array, serializerSettings);
            //var arr = array.Split(',');
            Comment comment = new Comment();

            comment.NickName  = arr[0];
            comment.Rate      = int.Parse(arr[2]);
            comment.Content   = arr[1];
            comment.ProductId = long.Parse(arr[3]);
            comment.ParentId  = -1;
            var obj = SessionUtility.GetSessionMember(Session);

            if (obj != null)
            {
                comment.MemberId = obj.Id;
            }
            else
            {
                comment.MemberId = -1;
            }
            var product = new ProductsBusiness().GetById(comment.ProductId);

            comment.ShopId = product.MemberId;
            new CommentsBusiness().AddNew(comment);
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
 public IActionResult ShowProfile(StockDistributionInput input)
 {
     try
     {
         string errorMessage = string.Empty;
         var    listParam    = new List <KeyValuePair <string, string> >();
         listParam.Add(new KeyValuePair <string, string>("mobileNumber", input.MobileNumber));
         var response = new CallService().GetResponse <ShowProfile>("getCustomerDetailsByMobileNo", listParam, ref errorMessage);
         if (string.IsNullOrEmpty(errorMessage))
         {
             response.NumberOfStock = input.NumberOfStock;
             response.StockType     = input.StockType;
             var sessionUtility = new SessionUtility();
             sessionUtility.SetSession("StockTypeId", input.StockType);
             sessionUtility.SetSession("PayeeMobileNo", Convert.ToString(response.mobileNumber));
             sessionUtility.SetSession("PayeeName", response.firstName + " " + response.lastName);
             sessionUtility.SetSession("PayeeNumberOfStock", Convert.ToString(input.NumberOfStock));
             sessionUtility.SetSession("PayeeCustomerID", Convert.ToString(response.customerId));
             return(PartialView("ViewProfile", response));
         }
     }
     catch (Exception)
     {
     }
     return(PartialView("ViewProfile"));
 }
Exemplo n.º 5
0
        public JsonResult CheckLoginPay(string usename, string pass)
        {
            var entity = new MembersBusiness().CheckLogin(usename, pass);

            if (entity != null)
            {
                if (entity.Status == 0)
                {
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }
                else if (entity.Status == 3)
                {
                    return(Json(3, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    SessionUtility.SetSessionMember(entity, Session);
                    return(Json(1, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(4, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 6
0
        public ActionResult Login(FormCollection collection)
        {
            var userModel = this.AccountService.FindByUsername(collection.Get("username"));

            if (userModel != null && !string.IsNullOrEmpty(userModel.Password) &&
                EncryptionUtility.BcryptCheckPassword(collection.Get("password"), userModel.Password))
            {
                if (userModel.Status.Value)
                {
                    var callBackUrl = collection.Get("callUrl");

                    SessionUtility.SetAuthenticationToken(userModel, 60);

                    if (!string.IsNullOrEmpty(callBackUrl))
                    {
                        return(RedirectToAction(callBackUrl.Split('/')[1], callBackUrl.Split('/')[0]));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    return(RedirectToAction("Login", new { msg = Constant.CONST_MESSAGE_LOGIN_DISABLE }));
                }
            }

            return(RedirectToAction("Login", new { msg = Constant.CONST_MESSAGE_LOGIN_INVALID }));
        }
Exemplo n.º 7
0
        public ActionResult Login(string userName, string password, string remember, string returnUrl)
        {
            ViewBag.Mes = "";
            string IPAddress = IPHelper.GetIPAddress(Request.ServerVariables["HTTP_VIA"],
                                                     Request.ServerVariables["HTTP_X_FORWARDED_FOR"],
                                                     Request.ServerVariables["REMOTE_ADDR"]);

            UserInfo userInfo = new UserBusiness().CheckLogin(userName, password, "", ObjectClass.GetHostName(Request.ServerVariables["REMOTE_ADDR"]), IPHelper.GetIPAddress(Request.ServerVariables["HTTP_VIA"],
                                                                                                                                                                             Request.ServerVariables["HTTP_X_FORWARDED_FOR"],
                                                                                                                                                                             Request.ServerVariables["REMOTE_ADDR"]));

            if (userInfo.Status)
            {
                SessionUtility.SetSessionUser(userInfo.UserId.ToString(), userInfo.UserName, userInfo.ScreenName, "0", Session, userInfo.IsSuperUser);

                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                return(Redirect("/Manage/Admin/Index"));
                //  return RedirectToRoute(new { controller = "Admin", action = "Index" });
            }
            else
            {
                ViewBag.Mes = userInfo.StatusMessage;
                return(View());
            }
        }
Exemplo n.º 8
0
        public ActionResult UpdateInfo(string userProfileName, string screenName, string email, string tel, DateTime?dob, string address)
        {
            try
            {
                var user = _userBusiness.GetById(long.Parse(SessionUtility.GetSessionUserId(Session)));
                user.Screenname               = screenName;
                user.UserProfile.Name         = userProfileName;
                user.UserProfile.Phone        = tel;
                user.UserProfile.Dob          = dob;
                user.UserProfile.Address      = address;
                user.UserProfile.Modifieddate = DateTime.Now;

                _userBusiness.Edit(user);

                ViewData["ErrMessage"]      = "Cập nhật thông tin thành công.";
                ViewData["code"]            = user.UserProfile.Code;
                ViewData["userProfileName"] = user.UserProfile.Name;
                ViewData["screenName"]      = user.Screenname;
                ViewData["email"]           = user.UserProfile.Email;
                ViewData["tel"]             = user.UserProfile.Phone;
                ViewData["dob"]             = user.UserProfile.Dob;
                ViewData["address"]         = user.UserProfile.Address;
            }
            catch (FaultException ex)
            {
                var    exep    = Function.GetExeption(ex);
                var    codeExp = exep[1];
                string url     = "Error/ErrorFunction/" + codeExp;
                return(RedirectToActionPermanent(url));
            }
            return(View());
        }
 public IActionResult ShowProfile(PaymentTransferModel input)
 {
     try
     {
         string errorMessage = string.Empty;
         var    listParam    = new List <KeyValuePair <string, string> >();
         listParam.Add(new KeyValuePair <string, string>("mobileNumber", input.MobileNumber));
         var response = new CallService().GetResponse <ShowProfile>("getCustomerDetailsByMobileNo", listParam, ref errorMessage);
         if (string.IsNullOrEmpty(errorMessage))
         {
             response.amount = input.Amount;
             var sessionUtility = new SessionUtility();
             sessionUtility.SetSession("PayeeMobileNo", Convert.ToString(response.mobileNumber));
             sessionUtility.SetSession("PayeeAmount", Convert.ToString(input.Amount));
             sessionUtility.SetSession("PayeeCustomerID", Convert.ToString(response.customerId));
             sessionUtility.SetSession("PayeeName", response.firstName + " " + response.lastName);
             return(PartialView("ShowProfile", response));
         }
         else
         {
             return(Json(new { success = false, errorMessage }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, errorMessage = ex.Message }));
     }
 }
Exemplo n.º 10
0
        public JsonResult ThirdPartyLogin(string id, string name, string email, string picture)
        {
            var result = new JsonResult {
                ContentType = "text", Data = new { type = "success" }
            };
            var currentUser = this.AccountService.FindByUsername(id);

            if (currentUser == null)
            {
                var user = new AccountModel
                {
                    Username      = id,
                    LastName      = name,
                    Email         = email,
                    Photo         = picture,
                    AccountTypeID = this.AccountTypeService.FindByName(Constant.CONST_ROLE_USER).ID,
                    Status        = true
                };

                this.AccountService.Insert(user);
                SessionUtility.SetAuthenticationToken(user, 60);
            }
            else if (currentUser.Status.Value)
            {
                SessionUtility.SetAuthenticationToken(currentUser, 60);
            }
            else
            {
                result.Data = new { type = "error", msg = Constant.CONST_MESSAGE_LOGIN_DISABLE }
            };

            return(result);
        }
Exemplo n.º 11
0
        public JsonResult GetInformation()
        {
            var result = new JsonResult {
                ContentType = "text"
            };
            var loggedUser = SessionUtility.GetLoggedUser();

            if (loggedUser != null)
            {
                var currentUser = JsonConvert.SerializeObject(new {
                    loggedUser.LastName,
                    loggedUser.FirstName,
                    loggedUser.Email,
                    loggedUser.Address,
                    loggedUser.IDCardOrPassport,
                    loggedUser.Phone,
                    loggedUser.PlaceIssue,
                    Gender   = loggedUser.Gender != null? loggedUser.Gender.Value?"1":"0":"",
                    Birthday = loggedUser.Birthday != null? loggedUser.Birthday.Value.ToString("dd/MM/yyyy"): "",
                    Expire   = loggedUser.DateIssueOrExpiry != null? loggedUser.DateIssueOrExpiry.Value.ToString("dd/MM/yyyy"):""
                });

                result.Data = new { msg = "success", info = currentUser };
            }

            return(result);
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zoneCurrent    = ZoneUtility.GetZoneCurrent();
            _excludeSpecial = ConvertUtility.ToInt32(SessionUtility.GetValue("excludeid"));

            var source = DistributionDB.GetNewContentByZoneIDNoPage(_zoneCurrent, true, _excludeSpecial);

            if (source.Rows.Count > 0)
            {
                CollectionPager1.DataSource    = source.DefaultView;
                CollectionPager1.BindToControl = rptData;

                if (AppEnv.GetLanguageFrontEnd() == "vi-VN")
                {
                    CollectionPager1.LabelText = "Trang:&nbsp;";
                }
                else
                {
                    CollectionPager1.LabelText = "Page:&nbsp;";
                }

                CollectionPager1.BackText              = "<<";
                CollectionPager1.PageNumbersSeparator  = "&nbsp;&nbsp;&nbsp;";
                CollectionPager1.BackNextLinkSeparator = "&nbsp;&nbsp;&nbsp;";

                rptData.DataSource = CollectionPager1.DataSourcePaged;
                rptData.DataBind();
            }
            else
            {
                rptData.Visible = false;
            }
        }
Exemplo n.º 13
0
 public IActionResult BankDetails(IFormCollection fc)
 {
     try
     {
         var    bankName        = Convert.ToString(fc["ddlBank"]);
         var    bankAccount     = Convert.ToString(fc["bankaccount"]);
         string bankIFSCCode    = Convert.ToString(fc["bankifsccode"]);
         var    sessionUtility  = new SessionUtility();
         var    allBasicDetails = JsonConvert.DeserializeObject <AllBasicDetailsInput>(sessionUtility.GetStringSession("AllBasicDetails"));
         var    mainDetails     = JsonConvert.DeserializeObject <SetAllValue>(sessionUtility.GetStringSession("MainDetails"));
         mainDetails.BankName     = bankName;
         mainDetails.BankAccount  = bankAccount;
         mainDetails.BankIFSCCode = bankIFSCCode;
         sessionUtility.SetSession("MainDetails", JsonConvert.SerializeObject(mainDetails));
         mainDetails.BankName = bankName.Split("~")[1];
         var overviewDtls = new OverviewDetails();
         allBasicDetails.personalDetails.Gender         = allBasicDetails.personalDetails.Gender.Split("~")[1];
         allBasicDetails.personalDetails.MaritialStatus = allBasicDetails.personalDetails.MaritialStatus.Split("~")[1];
         overviewDtls.allDetails = allBasicDetails;
         overviewDtls.allValue   = mainDetails;
         return(PartialView("AllDetails", overviewDtls));
     }
     catch (Exception)
     {
     }
     return(PartialView("AllDetails"));
 }
Exemplo n.º 14
0
 public IActionResult GetPaymentReqFields(IFormCollection fc)
 {
     try
     {
         var sessionUtility = new SessionUtility();
         var listParam      = new List <KeyValuePair <string, string> >();
         listParam.Add(new KeyValuePair <string, string>("bankId", fc["bankId"]));
         sessionUtility.SetSession("bankId", fc["bankId"]);
         sessionUtility.SetSession("bankName", fc["bankName"]);
         sessionUtility.SetSession("ifscCode", Convert.ToString(fc["ifscCode"]));
         listParam.Add(new KeyValuePair <string, string>("paymentModeId", sessionUtility.GetStringSession("paymentModeId")));
         string errorMessage = string.Empty;
         var    response     = new CallService().GetResponse <List <RequestInputRes> >("getPaymentReqFieldMapping", listParam, ref errorMessage);
         if (string.IsNullOrEmpty(errorMessage))
         {
             var viewModel = new RequestViewModel();
             viewModel.reqList = response;
             sessionUtility.SetSession("RequestInput", JsonConvert.SerializeObject(response));
             return(PartialView("RequestField", viewModel));
         }
     }
     catch (Exception)
     {
     }
     return(PartialView("RequestField"));
 }
Exemplo n.º 15
0
        public JsonResult ReplyComment(long newid, long commentid, int status, string TraLoicontent)
        {
            try
            {
                CommentsNewsBusiness commentbusiness = new CommentsNewsBusiness();
                Common.CommentsNew   comment         = new Common.CommentsNew();
                comment = commentbusiness.GetCommentsByParentID(commentid);
                if (comment == null)
                {
                    Common.CommentsNew comment1 = new Common.CommentsNew();
                    comment1.Content    = TraLoicontent;
                    comment1.CreateDate = DateTime.Now;
                    comment1.NewId      = newid;
                    comment1.ParentId   = commentid;
                    comment1.Status     = 2;
                    comment1.NickName   = SessionUtility.GetSessionName(Session);

                    comment1.Email = "";
                    comment1.Rate  = 5;
                    commentbusiness.AddNew(comment1);
                }
                else
                {
                    comment.Content = TraLoicontent;
                    commentbusiness.Edit(comment);
                }
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                // _logger.Debug(ex.Message);
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 16
0
        private async Task <BackupMetadata> SaveLastSavedChangesAsync(ITextEditor textEditor)
        {
            TextFile    snapshot = textEditor.LastSavedSnapshot;
            StorageFile backupFile;

            try
            {
                backupFile = await SessionUtility.CreateNewBackupFileAsync(textEditor.Id.ToString("N") + "-LastSaved");

                await FileSystemUtility.WriteToFile(LineEndingUtility.ApplyLineEnding(snapshot.Content, snapshot.LineEnding), snapshot.Encoding, backupFile);
            }
            catch (Exception ex)
            {
                LoggingService.LogError($"Failed to save backup file: {ex.Message}");
                return(null);
            }

            return(new BackupMetadata
            {
                BackupFilePath = backupFile.Path,
                Encoding = snapshot.Encoding,
                LineEnding = snapshot.LineEnding,
                DateModified = snapshot.DateModifiedFileTime
            });
        }
Exemplo n.º 17
0
        public IActionResult GetAadharDetails(IFormCollection fc)
        {
            var sessionUtility = new SessionUtility();

            try
            {
                sessionUtility.SetSession("Aadhar_panel", "true");
                string status           = Convert.ToString(fc["status"]);
                string additionalParams = Convert.ToString(fc["additionalparam"]);
                var    additionalResp   = JsonConvert.DeserializeObject <AdditionalParam>(additionalParams);
                sessionUtility.SetSession("BoardedMobile", additionalResp.MobileNumber);
                sessionUtility.SetSession("BoardingFatherName", additionalResp.FatherName);
                sessionUtility.SetSession("BoardingId", additionalResp.BoardingId);
                sessionUtility.SetSession("BoardingDob", additionalResp.DateOfBirth);
                sessionUtility.SetSession("PanImageURL", additionalResp.PanPhoto);
                GetCroppedPANPhoto();
                if (status == "SUCCESS")
                {
                    string response = Convert.ToString(fc["response"]);
                    sessionUtility.SetSession("Aadhar_Details", response);
                    var aadharDetails = JsonConvert.DeserializeObject <AadharOTPRes>(response);
                    ViewData["Status"]       = status;
                    ViewData["AadharOTPRes"] = aadharDetails;
                }
                else
                {
                    ViewData["Status"]       = status;
                    ViewData["AadharOTPRes"] = null;
                }
            }
            catch (Exception)
            {
            }
            return(View("Index"));
        }
 public IActionResult BookComplaint(string txnId)
 {
     try
     {
         var sessionUtility = new SessionUtility();
         var req            = new
         {
             CustomerId            = sessionUtility.GetLoginSession().customerId,
             CustomerName          = sessionUtility.GetLoginSession().firstName,
             CustomerEmailId       = "",
             AlternateMobileNumber = "",
             CustomerLanguageId    = 1,
             TicketSubCategoryId   = 2,
             TicketSourceId        = 1,
             TicketChannelId       = 2,
             TransactionId         = txnId,
             CustomerRemark        = "Book Complaint",
             BookedBy      = sessionUtility.GetLoginSession().customerId,
             BookedRemarks = "Automatic Booked"
         };
         string errorMessage = string.Empty;
         var    response     = new CallHelpDeskService().PostResponse <string>("putDetailstickets", req, ref errorMessage);
         if (string.IsNullOrEmpty(errorMessage))
         {
             return(Json("Ticket Booked. Ticket ID: " + response));
         }
     }
     catch (Exception)
     {
     }
     return(Json(null));
 }
Exemplo n.º 19
0
        public ActionResult Index()
        {
            var loggedUser = SessionUtility.GetLoggedUser();

            if (loggedUser == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var ticketList = this.TicketService.FindByAccount(loggedUser.ID);
            var model      = new List <TicketHistoryModel>();

            foreach (var ticket in ticketList)
            {
                var departFlight      = this.FlightService.FindByTicket(ticket.ID).ToList();
                var returnFlight      = this.FlightService.FindByTicket(ticket.ID, true).ToList();
                var passengers        = this.PassengerTicketService.FindByTicket(ticket.ID).ToList();
                var firstTicketFlight = this.TicketFlightService.FindByTicket(ticket.ID).First();

                model.Add(new TicketHistoryModel
                {
                    Ticket           = ticket,
                    From             = this.AirportService.Find(departFlight.First().Departure.ID),
                    To               = this.AirportService.Find(departFlight.Last().Arrival.ID),
                    SeatClass        = this.SeatMapService.FindBySeatCode(firstTicketFlight.SeatCode.Split(',').First(), firstTicketFlight.Flight.PlaneID.Value),
                    DepartFlight     = departFlight,
                    ReturnFlight     = returnFlight,
                    Passengers       = passengers,
                    TicketFlightList = this.TicketFlightService.FindByTicket(ticket.ID).ToList()
                });
            }

            return(View(model.OrderByDescending(m => m.Ticket.ID).ToList()));
        }
Exemplo n.º 20
0
 public UserApiController(ApplicationDbContext _context, IHostingEnvironment _hosting,
                          SessionUtility _session)
 {
     context = _context;
     hosting = _hosting;
     session = _session;
 }
 public IActionResult FetchBill(List <InputParamsRes> input)
 {
     try
     {
         var sessionUtility = new SessionUtility();
         var inputData      = JsonConvert.DeserializeObject <List <InputParamsRes> >(sessionUtility.GetStringSession("InputParams"));
         for (int i = 0; i < inputData.Count; i++)
         {
             inputData[i].UserInput = input[i].UserInput;
         }
         sessionUtility.SetSession("InputParams", JsonConvert.SerializeObject(inputData));
         var listParams = new List <KeyValuePair <string, string> >();
         listParams.Add(new KeyValuePair <string, string>("ssCode", Convert.ToString(input[0].SSCode)));
         listParams.Add(new KeyValuePair <string, string>("caNumber", Convert.ToString(input[0].UserInput)));
         string errorMessage = string.Empty;
         var    response     = new CallService().GetResponse <BillFetchRes>("getSpecificStepBill", listParams, ref errorMessage);
         sessionUtility.SetSession("FetchBillData", JsonConvert.SerializeObject(response));
         if (string.IsNullOrEmpty(errorMessage))
         {
             return(PartialView(response));
         }
         else
         {
             ViewBag.InputData = inputData;
             return(PartialView());
         }
     }
     catch (Exception)
     {
         return(PartialView());
     }
 }
 public IActionResult DoTransaction(IFormCollection fc)
 {
     try
     {
         var tpin           = Convert.ToString(fc["digit1"]) + Convert.ToString(fc["digit2"]) + Convert.ToString(fc["digit3"]) + Convert.ToString(fc["digit4"]) + Convert.ToString(fc["digit5"]) + Convert.ToString(fc["digit6"]) + Convert.ToString(fc["digit7"]) + Convert.ToString(fc["digit8"]);
         var sessionUtility = new SessionUtility();
         var req            = new
         {
             customerId        = sessionUtility.GetLoginSession().customerId,
             rechageNumber     = Convert.ToString(fc["MobileNumber"]),
             txnAmount         = Convert.ToDecimal(fc["Amount"]),
             serviceProviderId = Convert.ToInt32(fc["OperatorId"]),
             serviceCircleId   = 1,
             serviceChannelId  = 2,
             remarks           = "Recharge",
             tPin = new PasswordHash().HashShA1(tpin)
         };
         string errorMessage = string.Empty;
         var    response     = new CallService().PostTransaction <TransactionResult>("doRecharge", req, ref errorMessage);
         if (response != null)
         {
             if (response.response != null)
             {
                 response.response.OperatorNm = Convert.ToString(fc["OperatorNm"]).Trim();
             }
         }
         return(PartialView("AckView", response));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(PartialView("AckView"));
 }
Exemplo n.º 23
0
        public JsonResult Login(FormCollection collection)
        {
            var userModel = this.AccountService.FindByUsername(collection.Get("username"));

            if (userModel != null && !string.IsNullOrEmpty(userModel.Password) &&
                EncryptionUtility.BcryptCheckPassword(collection.Get("password"), userModel.Password))
            {
                if (userModel.Status.Value)
                {
                    SessionUtility.SetAuthenticationToken(userModel, 60);

                    return(new JsonResult {
                        ContentType = "text", Data = new { msg = "success" }
                    });
                }
                else
                {
                    return new JsonResult {
                               ContentType = "text", Data = new { msg = Constant.CONST_MESSAGE_LOGIN_DISABLE }
                    }
                };
            }

            return(new JsonResult {
                ContentType = "text", Data = new { msg = Constant.CONST_MESSAGE_LOGIN_INVALID }
            });
        }
Exemplo n.º 24
0
        public ActionResult Login(string email, string pass, string returnUrl)
        {
            ViewBag.Mes = "";
            var entity = _membersBusiness.CheckLogin(email, pass);

            if (entity != null)
            {
                if (entity.Status == 0)
                {
                    ViewBag.Mes = "Tài khoản chưa được kích hoạt ";
                    return(View());
                }
                else if (entity.Status == 3)
                {
                    ViewBag.Mes = "Tài khoản đã bi khóa";
                    return(View());
                }
                else
                {
                    SessionUtility.SetSessionMember(entity, Session);
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    return(RedirectToRoute(new { controller = "Member", action = "Profile" }));
                }
            }
            else
            {
                ViewBag.mes = "Lỗi thông tin đăng nhập";
                return(View());
            }
        }
Exemplo n.º 25
0
        public IActionResult SubmitPAN(IFormCollection fc)
        {
            string mobileNumber = string.Empty;
            string redirectUrl  = string.Empty;

            try
            {
                var sessionUtility = new SessionUtility();
                mobileNumber = sessionUtility.GetStringSession("BoardedMobile");
                var additionalData = new AdditionalParam
                {
                    Name         = sessionUtility.GetStringSession("BoardingName"),
                    FatherName   = sessionUtility.GetStringSession("BoardingFatherName"),
                    PanPhoto     = sessionUtility.GetStringSession("PanImageURL"),
                    PanNumber    = sessionUtility.GetStringSession("BoardingPAN"),
                    BoardingId   = sessionUtility.GetStringSession("BoardingId"),
                    DateOfBirth  = sessionUtility.GetStringSession("BoardingDob"),
                    MobileNumber = sessionUtility.GetStringSession("BoardedMobile")
                };
                redirectUrl = Startup.AppSetting["AadharOTP_RedirectURL"] + "?mob=" + mobileNumber + "&targetUrl=" + Startup.AppSetting["Aadhar_ReturnBackURL"] + "&additionalParmJson=" + JsonConvert.SerializeObject(additionalData);
            }
            catch (Exception)
            {
            }
            return(Json(new { success = true, redirect_url = redirectUrl }));
        }
Exemplo n.º 26
0
 public MenuRepository(ApplicationDbContext _context, IHostingEnvironment _hosting,
                       SessionUtility _session)
 {
     context = _context;
     hosting = _hosting;
     session = _session;
 }
Exemplo n.º 27
0
        public ActionResult PaymentPaypal()
        {
            if (SessionUtility.GetBookingSession() == null || SessionUtility.GetPassengerSession() == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            APIContext apiContext = PaypalUtility.GetAPIContext();

            try
            {
                var payerId = Request.Params["PayerID"];

                if (string.IsNullOrEmpty(payerId))
                {
                    var baseURI        = Request.Url.Scheme + "://" + Request.Url.Authority + "/Ticket/PaymentPaypal?";
                    var guid           = Convert.ToString((new Random()).Next(100000));
                    var createdPayment = PaypalUtility.CreatePayment(apiContext, baseURI + "guid=" + guid);

                    //Get id payment for refund
                    var boookingSession = SessionUtility.GetBookingSession();
                    boookingSession.PaymentID = createdPayment.id;
                    SessionUtility.SetBookingSession(boookingSession);

                    var    links             = createdPayment.links.GetEnumerator();
                    string paypalRedirectUrl = null;

                    while (links.MoveNext())
                    {
                        Links lnk = links.Current;

                        if (lnk.rel.ToLower().Trim().Equals("approval_url"))
                        {
                            paypalRedirectUrl = lnk.href;
                        }
                    }

                    Session.Add(guid, createdPayment.id);

                    return(Redirect(paypalRedirectUrl));
                }
                else
                {
                    var guid            = Request.Params["guid"];
                    var executedPayment = PaypalUtility.ExecutePayment(apiContext, payerId, Session[guid] as string);

                    if (executedPayment.state.ToLower() != "approved")
                    {
                        return(View("Failed"));
                    }
                }
            }
            catch
            {
                return(View("Failed"));
            }

            return(RedirectToAction("BookingSuccess"));
        }
Exemplo n.º 28
0
        /// <summary>
        /// Mathes the vertify.
        /// </summary>
        /// <returns>System.Byte[].</returns>
        public static byte[] MathVertify()
        {
            AbstractVertify vertify = new MathVertify(Num.Single);

            System.IO.MemoryStream ms = vertify.Draw();
            SessionUtility.Set(ConfigurationKey.ValidateCode, vertify.result);
            return(ms.ToArray());
        }
Exemplo n.º 29
0
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (SessionUtility.GetUser() == null)
     {
         filterContext.Result = new RedirectToRouteResult(new
                                                          RouteValueDictionary(new { controller = "Login", action = "Index" }));
     }
     base.OnActionExecuting(filterContext);
 }
Exemplo n.º 30
0
        public ActionResult ForgotPassword()
        {
            if (SessionUtility.GetLoggedUser() != null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }