public List <DeliveryLocations> GetDeliveryDetails(long uaid) { List <DeliveryLocations> lstdeliverylocation = new List <DeliveryLocations>(); DeliveryLocations dl; try { db.OpenConn(); SqlCommand cmd = new SqlCommand("select * from DeliveryLocations where UserAccountID=@UserAccountID", db.conn); cmd.Parameters.AddWithValue("@UserAccountID", uaid); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { dl = new DeliveryLocations(); dl.DeliveryLocationsID = long.Parse(dr["DeliveryLocationsID"].ToString()); dl.UserAccountID = long.Parse(dr["UserAccountID"].ToString()); dl.FName = dr["FName"].ToString(); dl.LName = dr["LName"].ToString(); dl.Street1 = dr["Street1"].ToString(); dl.Street2 = dr["Street2"].ToString(); dl.City = dr["City"].ToString(); dl.PostalCode = dr["PostalCode"].ToString(); dl.PhoneNo = dr["PhoneNo"].ToString(); lstdeliverylocation.Add(dl); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(lstdeliverylocation); }
public DeliveryLocations GetDeliveryDetails_DLID(string paramDeliveryLocationID) { DeliveryLocations dl = null; try { db.OpenConn(); SqlCommand cmd = new SqlCommand("select * from DeliveryLocations where DeliveryLocationsID=" + paramDeliveryLocationID + "", db.conn); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { dl = new DeliveryLocations(); dl.DeliveryLocationsID = long.Parse(dr["DeliveryLocationsID"].ToString()); dl.UserAccountID = long.Parse(dr["UserAccountID"].ToString()); dl.FName = dr["FName"].ToString(); dl.LName = dr["LName"].ToString(); dl.Street1 = dr["Street1"].ToString(); dl.Street2 = dr["Street2"].ToString(); dl.City = dr["City"].ToString(); dl.PostalCode = dr["PostalCode"].ToString(); dl.PhoneNo = dr["PhoneNo"].ToString(); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(dl); }
public override void GetNextDeliveryLocation() { base.GetNextDeliveryLocation(); if (CurrentDeliveryLocation == DeliveryLocations.Last()) { CurrentDeliveryLocation = DeliveryLocations[0]; loadDeliveryBlip(); } }
public async Task <IActionResult> Create([Bind("DLId,LocationName,Address,City,State,TimeFrom,TimeTill,DayAvailable")] DeliveryLocations deliveryLocations) { if (ModelState.IsValid) { _context.Add(deliveryLocations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(deliveryLocations)); }
public async Task <IActionResult> Edit(int id, [Bind("DLId,LocationName,Address,City,State,TimeFrom,TimeTill,DayAvailable")] DeliveryLocations deliveryLocations) { if (ModelState.IsValid) { try { _context.Update(deliveryLocations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { } return(RedirectToAction(nameof(Index))); } return(View(deliveryLocations)); }
protected void Page_Load(object sender, EventArgs e) { long uid = 0; if (!IsPostBack) { // Session["deliverylocationid"] = null; if (Session["UserAccountID"] != null) { uid = long.Parse(Session["UserAccountID"].ToString()); List <DeliveryLocations> lstLoctions = new DeliveryLocations().GetDeliveryDetails(uid); dlLocations.DataSource = lstLoctions; dlLocations.DataBind(); hdnRowCount.Value = lstLoctions.Count.ToString(); } } }
protected void BtnSaveContinue_Click(object sender, EventArgs e) { DeliveryLocations objdlocation = new DeliveryLocations(); objdlocation.FName = txtname.Text; objdlocation.LName = txtLName.Text; objdlocation.Street1 = txtstreet1.Text; objdlocation.Street2 = txtstreet2.Text;; objdlocation.City = txtcity.Text; objdlocation.PostalCode = txtpincode.Text; objdlocation.PhoneNo = txtphoneno.Text; objdlocation.UserAccountID = long.Parse(Session["UserAccountID"].ToString()); long dlid = 0; if (hdnDLID_S.Value != "" && hdnDLID_S.Value != "0") { dlid = long.Parse(hdnDLID_S.Value); objdlocation.DeliveryLocationsID = long.Parse(hdnDLID_S.Value); objdlocation.UpdateDeliveryLocation(); } else { dlid = objdlocation.SaveDeliveryDetails(); } Session["deliverylocationid"] = dlid.ToString(); if (dlid != 0) { Orders obj = new Orders(); obj.OrderID = long.Parse(Session["OrderId"].ToString()); obj.Status = "Pending"; obj.Remarks = ""; obj.UserAccountID = long.Parse(Session["UserAccountID"].ToString()); obj.DeliveryLocationsID = dlid; obj.DeliveryMobileNo = long.Parse(txtphoneno.Text); obj.DeliverToPersonName = txtname.Text; obj.UpdateOrderDetails(); } Response.Redirect("Cart.aspx"); }