/// <summary> /// Action for do payment on saving a resolution /// </summary> /// <param name="id">id of resolution which needs to be selected</param> /// <returns></returns> public ActionResult Payment(int id) { PaymentObject paymentobj = new PaymentObject(); //UserPaymentComplexViewModel model = new UserPaymentComplexViewModel(); //model.BidID = 12; //model.ProblemID = 1; //model.UserID = 2; //model.QuickBloxUserID = "5815727"; //model.ResolutionMethodName = "Onsite Online Video Chat"; //model.ProfileImagePath = ServerSettings.WebApplicationURL + "/upload/profilepic/profile.jpg"; //model.Description = "Washing machine won’t spin or agitate? Not draining, filling or leaks water? This video provides information on how a washing cloths. Washer not spinning or draining? This demonstrates how to test a three terminal switch on a washing machine. The lid switch not works."; //model.DisplayName = "Nathen Astle"; //model.Amount = 1200; //model.IsSelected = true; return View(paymentobj); }
/// <summary> /// Get payment page /// </summary> /// <param name="pPageIndex">Index of a page that needs to be fetched</param> /// <returns></returns> public ActionResult GetPaymentPage(int pPageIndex) { PaymentObject paymentobj = new PaymentObject(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); PaymentEngine paymentEngine = new PaymentEngine(); string response = paymentEngine.GetPaymentHistoryJSON(Request.Cookies["sessionkey"].Value); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); paymentobj = (PaymentObject)Serializer.JSONStringToObject<PaymentObject>(responseObject.ResultObjectJSON); return PartialView("_PaymentList", paymentobj.PaymentMade); //int totalRecords = 0; //PaymentListViewModel model = null; //List<PaymentListViewModel> modelList = new List<PaymentListViewModel>(); //model = new PaymentListViewModel(); //model.ProblemID = 10522; //model.ProblemTitle = "DVD Player"; //model.OppositeUserFirstName = "Alex"; //model.OppositeUserLastName = "D'Souza"; //model.OppositeUserImagepath = ServerSettings.WebApplicationURL + "/upload/profilepic/Sean-McPheat-Profile-Pic.jpg"; //model.PaymentDate = DateTime.Now; //model.Amount = Convert.ToDecimal(3000.99); //modelList.Add(model); //if (modelList.Count > 0) //{ // totalRecords = 2; //} //int totalPagesCount = (int)Math.Ceiling((float)totalRecords / (float)_PageSize); //ViewBag.TotalPagesCount = totalPagesCount; //ViewBag.PageNumber = pPageIndex; //return PartialView("_PaymentList", payment); }
///// <summary> ///// Action for display the profile page of a current login user ///// </summary> ///// <returns></returns> //public ActionResult MyProfile() //{ // MyProfileComplexViewModel model = new MyProfileComplexViewModel(); // return View(model); //} /// <summary> /// Action for Display the payment Listing by user /// </summary> /// <returns></returns> public ActionResult MyPayments() { ViewBag.ActiveMenu = "LiMyPayments"; ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); PaymentObject paymentobj = new PaymentObject(); PaymentEngine paymentEngine = new PaymentEngine(); string response = paymentEngine.GetPaymentHistoryJSON(Request.Cookies["sessionkey"].Value); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); paymentobj = (PaymentObject)Serializer.JSONStringToObject<PaymentObject>(responseObject.ResultObjectJSON); int totalPagesCount = (int)Math.Ceiling((float)responseObject.ResultObjectRecordCount / (float)_PageSize); ViewBag.TotalPagesCount = totalPagesCount; ViewBag.PageNumber = 1; ViewBag.TotalRecordCount = responseObject.ResultObjectRecordCount; return View(); //ViewBag.ActiveMenu = "LiMyPayments"; //int totalRecords = 0; //PaymentListViewModel model = null; //List<PaymentListViewModel> modelList = new List<PaymentListViewModel>(); //model = new PaymentListViewModel(); //model.ProblemID = 10522; //model.ProblemTitle = "Washing Machine"; //model.OppositeUserFirstName = "Chester"; //model.OppositeUserLastName = "Benington"; //model.OppositeUserImagepath = ServerSettings.WebApplicationURL + "/upload/profilepic/profile.jpg"; //model.PaymentDate = DateTime.Now; //model.Amount = Convert.ToDecimal(15000.99); //modelList.Add(model); //model = new PaymentListViewModel(); //model.ProblemID = 10522; //model.ProblemTitle = "Freeze Cooling"; //model.OppositeUserFirstName = "Chester"; //model.OppositeUserLastName = "Benington"; //model.OppositeUserImagepath = ServerSettings.WebApplicationURL + "/upload/profilepic/profile.jpg"; //model.PaymentDate = DateTime.Now; //model.Amount = Convert.ToDecimal(7850.75); //modelList.Add(model); //model = new PaymentListViewModel(); //model.ProblemID = 10522; //model.ProblemTitle = "DVD Player"; //model.OppositeUserFirstName = "Alex"; //model.OppositeUserLastName = "D'Souza"; //model.OppositeUserImagepath = ServerSettings.WebApplicationURL + "/upload/profilepic/Sean-McPheat-Profile-Pic.jpg"; //model.PaymentDate = DateTime.Now; //model.Amount = Convert.ToDecimal(3000.99); //modelList.Add(model); //if (modelList.Count > 0) //{ // totalRecords = 2; //} //int totalPagesCount = (int)Math.Ceiling((float)totalRecords / (float)_PageSize); //ViewBag.TotalPagesCount = totalPagesCount; //ViewBag.PageNumber = 1; //return View(modelList); }
public ResponseObjectForAnything GetPaymentHistory(string sessionkey) { ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); PaymentObject paymentobj = new PaymentObject(); AuthenticationEngine authEngine = new AuthenticationEngine(); List<Payment> lstpaymentreceived = new List<Payment>(); List<Payment> lstpaymentmade = new List<Payment>(); bool isValid = true; if (!string.IsNullOrEmpty(sessionkey)) { isValid = authEngine.IsValidSession(sessionkey); } if(isValid) { try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetPaymentsByUserID"); db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionkey); DataSet dsPayment = db.ExecuteDataSet(dbCommand); if (dsPayment.Tables.Count > 0) { DataTable tPayment = dsPayment.Tables[0]; foreach (DataRow dRow in tPayment.Rows) { Payment payment = new Payment(); if (dRow["ID"] != DBNull.Value) { payment.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { payment.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["ProblemHeading"] != DBNull.Value) { payment.ProblemHeading = dRow["ProblemHeading"].ToString(); } if (dRow["ProfilePicPath"] != DBNull.Value) { payment.ProfilePicPath = dRow["ProfilePicPath"].ToString(); } if (dRow["DisplayName"] != DBNull.Value) { payment.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["Amount"] != DBNull.Value) { payment.Amount = Convert.ToDecimal(dRow["Amount"].ToString()); } if (dRow["PaymentDate"] != DBNull.Value) { payment.PaymentDate = Convert.ToDateTime(dRow["PaymentDate"].ToString()); } if (dRow["PaymentStatus"] != DBNull.Value) { payment.PaymentStatus = dRow["PaymentStatus"].ToString(); } if (dRow["PaymentCount"] != DBNull.Value) { payment.PaymentCount = Int32.Parse(dRow["PaymentCount"].ToString()); } if (dRow["TotalPayment"] != DBNull.Value) { payment.TotalPayment = Convert.ToDecimal(dRow["TotalPayment"].ToString()); } lstpaymentmade.Add(payment); } paymentobj.PaymentMade = lstpaymentmade; } if (dsPayment.Tables.Count > 1) { DataTable tPayment = dsPayment.Tables[1]; foreach (DataRow dRow in tPayment.Rows) { Payment payment = new Payment(); if (dRow["ID"] != DBNull.Value) { payment.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { payment.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["ProblemHeading"] != DBNull.Value) { payment.ProblemHeading = dRow["ProblemHeading"].ToString(); } if (dRow["ProfilePicPath"] != DBNull.Value) { payment.ProfilePicPath = dRow["ProfilePicPath"].ToString(); } if (dRow["DisplayName"] != DBNull.Value) { payment.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["Amount"] != DBNull.Value) { payment.Amount = Convert.ToDecimal(dRow["Amount"].ToString()); } if (dRow["PaymentDate"] != DBNull.Value) { payment.PaymentDate = Convert.ToDateTime(dRow["PaymentDate"].ToString()); } if (dRow["PaymentStatus"] != DBNull.Value) { payment.PaymentStatus = dRow["PaymentStatus"].ToString(); } if (dRow["PaymentCount"] != DBNull.Value) { payment.PaymentCount = Int32.Parse(dRow["PaymentCount"].ToString()); } if (dRow["TotalPayment"] != DBNull.Value) { payment.TotalPayment = Convert.ToDecimal(dRow["TotalPayment"].ToString()); } lstpaymentreceived.Add(payment); } paymentobj.PaymentReceived = lstpaymentreceived; } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(paymentobj); if (responseObject.ResultObjectRecordCount <= 0) { responseObject.ResultMessage = "No payment details found."; } } catch (Exception ex) { responseObject.ResultCode = "ERROR"; responseObject.ResultMessage = ex.Message; CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetPaymentHistory", System.DateTime.Now); ExceptionManager.PublishException(exc); } } return (responseObject); }