public async Task <IActionResult> storeDetails(string id) { var users = await usermanager.FindByIdAsync(id); if (users == null) { ViewBag.ErrorMessgae = "User with id =" + id + "cannot be found"; return(View("NotFound")); } var model = new StoreShowDetailsViewModel() { storeid = users.Id, storeownerName = users.name, mobileno = users.mobileno, ownergender = users.gender, profilephoto = users.profilephoto, Email = users.Email }; //byte[] decodedHashedPassword = Convert.FromBase64String(users.PasswordHash); // string pass = base64Decode(users.PasswordHash); if (model.storeid != null) { var storedetails = _storedetailsServices.GetAll().Where(x => x.storeid == model.storeid).FirstOrDefault(); if (storedetails != null) { model.contactpersonname = storedetails.contactpersonname; model.emailaddress = storedetails.emailaddress; model.contactno = storedetails.contactno; model.gender = storedetails.gender; model.fooddelivery = storedetails.fooddelivery; model.storename = storedetails.storename; model.radiusid = _RadiusMasterServices.GetById(Convert.ToInt32(storedetails.radiusid)).name; model.deliverytimeid = _DeliveryTimeMasterServices.GetById(Convert.ToInt32(storedetails.deliverytimeid)).name; model.orderMinAmount = storedetails.orderMinAmount; model.packagingCharges = storedetails.packagingCharges; model.storeBannerPhoto = storedetails.storeBannerPhoto; model.address = storedetails.address; model.description = storedetails.description; model.storetime = storedetails.storetime; model.licPhoto = storedetails.licPhoto; model.latitude = storedetails.latitude; model.longitude = storedetails.longitude; if (storedetails.radiusid != null) { int cityidd = Convert.ToInt32(storedetails.radiusid); int stateid = _cityRegistrationservices.GetById(cityidd).stateid; int countryid = _StateRegistrationService.GetById(stateid).countryid; model.country = _CountryRegistrationservices.GetById(countryid).countryname; model.state = _StateRegistrationService.GetById(countryid).StateName; model.cityid = _cityRegistrationservices.GetById(cityidd).cityName; } } } return(View(model)); }
public IActionResult storepaymentIndex(int?PageNumber) { // var orderheaderList1 = _storedetailsServices.GetAll().ToList(); var orderheaderList1 = _storedetailsServices.GetAll().Select(x => new storePaymentViewModel { id = x.id , payamount = x.payamount, storeid = x.storeid, storename = x.storename }); // var paramter = new DynamicParameters(); //paramter.Add("@from", from1); // var orderheaderList1 = _sP_Call.List<collectionViewModel>("storedetailsSelectAll", null); int PageSize = 30; return(View(storepaymentPagination <storePaymentViewModel> .Create(orderheaderList1.ToList(), PageNumber ?? 1, PageSize))); }
public async Task <IActionResult> ContactPersonDetails() { ApplicationUser usr = await GetCurrentUserAsync(); var id = usr.Id; var store = storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault(); var model = new StoreDetailContactPersonDetails(); if (store == null) { } else { model.id = store.id; model.contactpersonname = store.contactpersonname; model.gender = store.gender; model.emailaddress = store.emailaddress; model.contactno = store.contactno; } return(View(model)); }
public async Task <IActionResult> updateStoreStatus(string storeId, string status) { try { try { var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault(); if (store == null) { var details = new storedetails { storeid = storeId, status = status }; int id = await _storedetailsServices.CreateAsync(details); var store1 = _storedetailsServices.GetById(id); return(Ok(store1)); } else { //var store1 = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault(); if (store == null) { } else { store.status = status; await _storedetailsServices.UpdateAsync(store); return(Ok(store)); } } } catch (Exception obj) { //var details = new storedetails //{ // storeid = storeId, // storename = "", // contactpersonname = "", // // id = model.id, // radiusid = 0, // deliverytimeid = 0, // orderMinAmount =0, // packagingCharges =0, // isdeleted = false, // address ="", // description = "", // //storetime = model.storetime, // storetime = "", // latitude = "", // longitude = "", // cityid = 0, // promocode = "", // discount =0, // accountno = "", // banklocation = "", // bankname = "", // ifsccode = "", // status = status, // adminCommissionPer =0, // taxstatus = "", // taxstatusPer = 0 //}; //await _storedetailsServices.CreateAsync(details); //var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault(); //return Ok(store); } finally { } // IEnumerable<storedetails> store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId); return(BadRequest()); //if (store == null) //{ // var details = new storedetails // { // storeid = storesId, // status=status // //storename = "", // //contactpersonname = "", // //radiusid = model.radiusid, // //deliverytimeid = model.deliverytimeid, // //orderMinAmount = model.orderMinAmount, // //packagingCharges = model.packagingCharges, // //isdeleted = false, // //address = model.address, // //description = model.description, // ////storetime = model.storetime, // //storetime = model.FromTime + " - " + model.ToTime, // //latitude = model.latitude, // //longitude = model.longitude, // //cityid = model.cityid, // //promocode = model.promocode, // //discount = model.discount, // //accountno = model.longitude, // //banklocation = model.banklocation, // //bankname = model.bankname, // //ifsccode = model.ifsccode, // //status = model.status, // //adminCommissionPer = model.adminCommissionPer, // //taxstatus = model.taxstatus, // //taxstatusPer = model.taxstatusPer // }; // await _storedetailsServices.CreateAsync(details); // return Ok(store); //} //else //{ // store.status = status; // await _storedetailsServices.UpdateAsync(store); // return Ok(store); //} } catch (Exception obj) { return(Ok(obj.Message)); } }
public IActionResult changeorderStatus(int id, string status) { //orders obj = _ordersServices.GetById(id); //obj.orderstatus = status; //_ordersServices.UpdateAsync(obj); var paramter = new DynamicParameters(); paramter.Add("@id", id); paramter.Add("@orderstatus", status); //storedetailsListViewmodel _ISP_Call.Execute("orderStatus_Update", paramter); var orders = _ordersServices.GetById(id); int customerid = orders.customerid; int deliveryboyid = 0; string deliveryboyDeviceId = ""; string storeid = _ordersServices.GetById(id).storeid; var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeid).FirstOrDefault(); string storeLatitude = store.latitude; string storelongitude = store.longitude; string storeName = store.storename; if (orders.deliveryboyid == null) { //deliveryboyid = (int)orders.deliveryboyid; } else { deliveryboyid = (int)orders.deliveryboyid; // deliveryboyDeviceId = _driverRegistrationServices.GetById(deliveryboyid).deviceid; } string customerDeviceId = _CustomerRegistrationservices.GetById(customerid).deviceid; if (status == "approved") { #region "customer" //string message = "New Order No. - " + id + " Approved by Admin"; //string title = "Order Approved"; string message = storeName + " Has Accepted Your Order"; string title = "Order Accepted"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion #region "Deliveryboy" try { var distancedt = _distanceServices.GetById(1); var distance = distancedt.range; var paramter1 = new DynamicParameters(); paramter1.Add("@Latitude", storeLatitude); paramter1.Add("@Longitude", storelongitude); paramter1.Add("@distance", distance); var dt = _ISP_Call.List <getNeareDeliveryboybyLocation>("getNeareDeliveryboybyLocationNew", paramter1); foreach (var item in dt) { string deviceid = item.deviceid; //string message1 = "New Order No. - " + id + " Approved by Admin"; //string title1 = "Order Approved"; string message1 = "New Order Received"; string title1 = "New Order Received"; objfcmNotification.deliveryboyNotification(deviceid, message1, "", title1); } } catch (Exception ex) { string ss = ex.Message; throw ex; } // return Ok(sResponseFromServer); #endregion } else if (status == "cancelledorders") { #region "customer" string message = "Your Order No. - " + id + " has been cancelled"; string title = "Cancel Order"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion } else if (status == "completedorders") { ////--------------------------- //if(orders.paymentstatus == "Cash on Delivery") //{ // var obj = _deliveryboyPendingAmtServices.GetAll().Where(x => x.deliveryboyid == orders.deliveryboyid).FirstOrDefault(); // if (obj == null) // { // var obj1 = new deliveryboyPendingAmt // { // id = 0, // deliveryboyid =(int)orders.deliveryboyid, // amount = orders.amount, // modifydate = DateTime.Now // }; // await _deliveryboyPendingAmtServices.CreateAsync(obj1); // } // else // { // } //} //else //{ //} //---------------------- #region "customer" string message = "Your Order No. - " + id + " has been Completed"; string title = "Completed Order"; objfcmNotification.customerNotification(customerDeviceId, message, "", title); #endregion } return(RedirectToAction("test")); }