/// <summary> /// to get cart details /// </summary> /// <returns></returns> public ActionResult GetCartDetails() { try { string mobileNumber = LoggedInUser.MobileNumber; var getCartDetails = ObjICommonServices.GetCartDetails(mobileNumber); double Totalsum = 0; foreach (var sum in getCartDetails) { double Totalprice = Convert.ToDouble(sum.TotalPrice); Totalsum += Totalprice; } var getUserDetailByMobile = ObjIUserService.GetuserInfo(mobileNumber); //ViewBag.UserName = getUserDetailByMobile.retailer_name==null?"N/A": getUserDetailByMobile.retailer_name; //ViewBag.Email = getUserDetailByMobile.email_id==null?"N/A": getUserDetailByMobile.email_id; //ViewBag.MobileNumber = getUserDetailByMobile.mobile_number; ViewBag.TotalPricePartial = Totalsum; ViewBag.TotalPrice = Totalsum + 20; //LoggedInUser.AmountToBePaid = ViewBag.TotalPrice; return(PartialView("~/Views/User/GetCartDetailsForUser.cshtml", getCartDetails)); } catch (Exception ex) { throw ex; } }
public ActionResult Contact(ContactViewModel objContactViewModel) { try { var addcontactInfo = ObjIUserService.Addcontact(objContactViewModel); TempData["ContactUs"] = Resource.GrowOnline_Message_CiontactUs; return(RedirectToAction("Index", "Home")); } catch (Exception ex) { throw ex; } }
/// <summary> /// delete cart /// </summary> /// <returns></returns> public bool DeleteCartAfterPayment() { try { string mobileNumber = LoggedInUser.MobileNumber; var deleteCartProducts = ObjIUserService.DeleteCartProducts(mobileNumber); return(deleteCartProducts); } catch (Exception ex) { throw ex; } }
public async Task <JsonResult> GetOrderList(DTParameterModel criteria, string mobileNumber = "") { try { string mobileNum = LoggedInUser.MobileNumber; var list = ObjIUserService.GetOrderList(criteria, mobileNum); return(Json(new { list.Result.sEcho, recordsFiltered = list.Result.recordsTotal, list.Result.recordsTotal, list.Result.data })); } catch (Exception ex) { throw ex; } }
/// <summary> /// payment status /// </summary> /// <param name="OrderId"></param> /// <returns></returns> public ActionResult PaymentStatus(int OrderId = 0) { try { string ROrderiD = Request.Form["razorpay_order_id"]; string RPaymentId = Request.Form["razorpay_payment_id"]; string RSignature = Request.Form["razorpay_signature"]; string Status = Request.Form["Status"]; string Status1 = Request.Form["razorpay_status"]; string Status2 = Request.Form["razorpay_status"]; //to fetch detail of payment RazorpayClient client = new RazorpayClient("rzp_test_zGV3VGeqasiZZD", "3sQi6joqbhooZwHrzuIvu9qt"); Payment payment = client.Payment.Fetch(RPaymentId); //if(payment.Status) OrderViewModel objOrderViewModel = new OrderViewModel(); objOrderViewModel.Order_Id = OrderId; objOrderViewModel.rzp_order_id = ROrderiD; objOrderViewModel.rzp_payment_id = RPaymentId; objOrderViewModel.rzp_signature = RSignature; objOrderViewModel.order_status = "Submitted"; objOrderViewModel.rzp_payment_status = Status; var result = ObjIUserService.UpdateOrderDeatils(objOrderViewModel, "online"); var getUserdetail = ObjIUserService.GetOrderDetailByOrderId(OrderId); if (getUserdetail != null) { var deletCart = DeleteCartAfterPayment(); ViewBag.TotalPrice = getUserdetail.Totalprice; return(View()); } else { ViewBag.Status = "Failure"; return(View()); } } catch (Exception ex) { throw ex; } }
public JsonResult UserLoginVerifyMobileNumber(LoginViewModel objLoginViewModel) { try { string mobileNumber = objLoginViewModel.MobileNumber; if (mobileNumber != null) { var otpNumber = objCommonFunctions.GenerateOTP(); if (objCommonFunctions.SendOTP(otpNumber, mobileNumber)) { //For inserting a new mobile number into shop_UserMaster table objLoginViewModel.MobileNumber = mobileNumber; objLoginViewModel.OTP = otpNumber; objLoginViewModel.CreatedDate = DateTime.Now; var addOtp = ObjIUserService.AddUserOtp(objLoginViewModel); if (addOtp) { TempData["LoginSuccess"] = Resource.GrowOnline_Message_RegistrationSuccess; return(Json(addOtp, JsonRequestBehavior.AllowGet)); } else { TempData["LoginFail"] = Resource.GrowOnline_Message_RegistrationSuccess; return(Json(addOtp, JsonRequestBehavior.AllowGet)); } } else { return(Json("false", JsonRequestBehavior.AllowGet)); } } else { TempData["LoginFail"] = Resource.GrowOnline_Message_RegistrationSuccess; return(Json("false", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; //Log.Info(Convert.ToString(ex.InnerException)); //Log.Info(ex.Message); //objCommonClasses.InsertExceptionDetails(ex, "MandiUserController", "MandiUserRegistration"); //return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message); } }
/// <summary> /// Update profile method /// </summary> /// <param name="type"></param> /// <returns></returns> public ActionResult UpdateUserProfile(string type = "") { try { string mobileNumber = LoggedInUser.MobileNumber; var getuserInfo = ObjIUserService.GetuserInfo(mobileNumber); UpdateUserViewModel objUserInfoViewModel = new UpdateUserViewModel { retailer_name = getuserInfo.retailer_name, mobile_number = getuserInfo.mobile_number, email_id = getuserInfo.email_id, address = getuserInfo.address, state = getuserInfo.state, district = getuserInfo.district, taluka = getuserInfo.taluka, cstn_number = getuserInfo.cstn_number, vat_number = getuserInfo.vat_number, pan_number = getuserInfo.pan_number, license_no = getuserInfo.license_no, imei_number = getuserInfo.imei_number, EntryDate = getuserInfo.EntryDate, pincode = getuserInfo.pincode, seed_license_validity = getuserInfo.seed_license_validity, gst_number = getuserInfo.gst_number, firm_name = getuserInfo.firm_name, depo = getuserInfo.depo, Flag = getuserInfo.Flag, town = getuserInfo.town, sap_retailer_id = getuserInfo.sap_retailer_id, fcm_token = getuserInfo.fcm_token, fcm_subscription_topic = getuserInfo.fcm_subscription_topic, bank_account_number = getuserInfo.bank_account_number, birth_date = getuserInfo.birth_date, retailer_last_name = getuserInfo.retailer_last_name, houseNo = getuserInfo.houseNo, streetLine1 = getuserInfo.streetLine1, streetLine2 = getuserInfo.streetLine2, //profileUpdate = Convert.ToBoolean(getuserInfo.profileUpdate), user_company = getuserInfo.user_company }; return(View(objUserInfoViewModel)); } catch (Exception ex) { throw ex; } }
public JsonResult UpdateOrderDetails(int orderId = 0, string type = "") { OrderViewModel objOrderViewModel = new OrderViewModel(); objOrderViewModel.Order_Id = orderId; var update = ObjIUserService.UpdateOrderDeatils(objOrderViewModel, type); if (update == true) { DeleteCartAfterPayment(); return(Json(update, JsonRequestBehavior.AllowGet)); } else { return(Json(update, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// payment method /// </summary> /// <param name="addressId"></param> /// <returns></returns> public ActionResult PaymentMethod(string addressId = "") { try { string mobileNumber = LoggedInUser.MobileNumber; var getCartDetails = ObjICommonServices.GetCartDetails(mobileNumber); double Totalsum = 0; foreach (var sum in getCartDetails) { double Totalprice = Convert.ToDouble(sum.TotalPrice); Totalsum += Totalprice; } ViewBag.TotalPrice = Totalsum; double ttlPrice = ViewBag.TotalPrice; var AddOrder = ObjIUserService.AddOrderDetails(mobileNumber, ttlPrice, addressId); { var getUserDetailByMobile = ObjIUserService.GetuserInfo(mobileNumber); ViewBag.UserName = getUserDetailByMobile.retailer_name == null ? "N/A" : getUserDetailByMobile.retailer_name; ViewBag.Email = getUserDetailByMobile.email_id == null ? "N/A" : getUserDetailByMobile.email_id; ViewBag.MobileNumber = getUserDetailByMobile.mobile_number; ViewBag.TotalPricePartial = Totalsum; ViewBag.TotalPrice = Totalsum + 20; double amount = (ViewBag.TotalPrice) * 100; //int receipt = AddOrder; //to get razor pay OrderID #region API call to create orderID string orderID = GetRazorPayOrderID(amount); #endregion ViewBag.OrderID = orderID; ViewBag.ServerOrderID = AddOrder; return(View()); } } catch (Exception ex) { throw ex; } }
/// <summary> /// cart info /// </summary> /// <returns></returns> public ActionResult CartInfo(string productId = "") { try { string MobileNumber = LoggedInUser.MobileNumber; var checkProfileUpdated = ObjIUserService.CheckUserProfileUpdated(MobileNumber); if (checkProfileUpdated) { var getCartDetailForMobileNumber = ObjIUserService.GetCartDetailByMobileNumber(MobileNumber); double Totalsum = 0; double TotalGst = 0; foreach (var sum in getCartDetailForMobileNumber) { double Totalprice = Convert.ToDouble(sum.Price); Totalsum += Totalprice; //for gst if (sum.ProductGST != "0") { int IntGst = Convert.ToInt32(sum.ProductGST); double GstPer = Convert.ToDouble((Totalprice * IntGst) / 100); TotalGst += GstPer; } } ViewBag.TotalPrice = Totalsum; ViewBag.TotalServicePrice = Totalsum + TotalGst; return(View(getCartDetailForMobileNumber)); } else { TempData["UpdateProfile"] = Resource.GrowOnline_Message_UpdateCartProfile; return(RedirectToAction("UpdateUserProfile", "Account", new { type = "cart" })); } } catch (Exception ex) { throw ex; } }
/// <summary> /// to delete cart /// </summary> /// <param name="cartId"></param> /// <returns></returns> public JsonResult DeleteCartProduct(long cartId = 0) { try { var deleteCartProduct = ObjIUserService.DeleteCartProduct(cartId); if (deleteCartProduct) { return(Json("true", JsonRequestBehavior.AllowGet)); } else { return(Json("false", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; } }
public ActionResult UpdateUserProfile(UpdateUserViewModel objUpdateUserViewModel, string Type = "") { try { if (objUpdateUserViewModel != null) { var mobileNumber = LoggedInUser.MobileNumber; objUpdateUserViewModel.mobile_number = mobileNumber; ResultModel objResultStatus = new ResultModel(); var objUpdateUser = ObjIUserService.UpdateUserProfile(objUpdateUserViewModel); if (objUpdateUser == true) { objResultStatus.Message = Resource.GrowOnline_Message_UserProfileUpdate; } else { objResultStatus.Message = Resource.GrowOnline_Message_ErrorUserProfileUpdate; } TempData["ProfileMessage"] = objResultStatus.Message; if (Type == "cart") { return(RedirectToAction("CartInfo", "Order", new { id = objUpdateUser })); } else { return(RedirectToAction("Index", "Home", new { id = objUpdateUser })); } } else { TempData["ErroUpdate"] = Resource.GrowOnline_Message_ErrorUserProfileUpdate; return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { throw ex; } }
/// <summary> /// checkout form /// </summary> /// <param name="totalPrice"></param> /// <returns></returns> public ActionResult CheckOut(string totalPrice = "") { try { string mobleNumber = LoggedInUser.MobileNumber; string MobileNumber = LoggedInUser.MobileNumber; var checkProfileUpdated = ObjIUserService.CheckUserProfileUpdated(MobileNumber); if (checkProfileUpdated) { return(View()); } else { TempData["UpdateProfile"] = Resource.GrowOnline_Message_UpdateCartProfile; return(RedirectToAction("UpdateUserProfile", "Account", new { type = "cart" })); } } catch (Exception ex) { throw ex; } }
public ActionResult AddAddreessForUser(ShippingAddressViewModel objShippingAddressViewModel) { try { objShippingAddressViewModel.retailer_mobile = LoggedInUser.MobileNumber; var addAddress = ObjIUserService.AddAddreessForUser(objShippingAddressViewModel); if (addAddress) { TempData["AddressSuccess"] = Resource.GrowOnline_Message_AddAddress; return(Json(addAddress, JsonRequestBehavior.AllowGet)); //return Json("true", JsonRequestBehavior.AllowGet); } else { TempData["AddressSuccess"] = Resource.GrowOnline_Message_ErrorAddAddress; return(Json(addAddress, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; } }
public ActionResult UserRegistration(UserInfoViewModel objMandiUserInfoViewModel) { try { string mobileNumber = objMandiUserInfoViewModel.MobileNumber; var getmobileNumber = ObjICommonServices.CheckMobileNumberExits(mobileNumber); if (objMandiUserInfoViewModel != null) { var result = ObjIUserService.AddUser(objMandiUserInfoViewModel); if (result) { TempData["RegisterSuccess"] = Resource.GrowOnline_Message_RegistrationSuccess; return(RedirectToAction("Index", "Home")); } else { TempData["RegisterFailed"] = Resource.GrowOnline_Message_LoginFailed; return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { throw ex; //Log.Info(Convert.ToString(ex.InnerException)); //Log.Info(ex.Message); //objCommonClasses.InsertExceptionDetails(ex, "MandiUserController", "MandiUserRegistration"); //return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message); } }