protected void Page_Load(object sender, EventArgs e) { try { SalitaEntities db = new SalitaEntities(); DateTime from = Convert.ToDateTime(DateTime.Today.ToShortDateString() + " 12:00AM"); DateTime to = Convert.ToDateTime(DateTime.Today.ToShortDateString() + " 11:59PM"); int cid = Convert.ToInt32(Session["Customer_ID"]); var myNeeds = db.CustomerNeeds.Where(p => p.RequestDateTime >= from && p.RequestDateTime <= to && p.Customer_ID == cid && p.WasFullfilled == false); foreach (CustomerNeed need in myNeeds) { if (need.RequestedService_ID == 1) { water_alert.Visible = true; this.lbGetWater.Enabled = false; this.Water_Text.Visible = false; } } } catch (Exception E) { this.CustomValidator1.IsValid = false; this.CustomValidator1.ErrorMessage = E.Message; } }
protected void lbConfirm_Click(object sender, EventArgs e) { try { int cid = Convert.ToInt32(ViewState["cid"]); int sid = Convert.ToInt32(ViewState["sid"]); SalitaEntities db = new SalitaEntities(); CustomerNeed N = new CustomerNeed(); N.Canceled = false; N.Customer_ID = cid; N.Note = this.txtNote.Value; N.RequestDateTime = DateTime.Now; N.RequestedService_ID = sid; N.WasFullfilled = false; db.CustomerNeeds.Add(N); UpdateHub.SendServer(""); Response.Redirect("request_service_feedback.aspx"); } catch (Exception E) { this.CustomValidator1.ErrorMessage = E.Message; this.CustomValidator1.IsValid = false; } }
public IEnumerable <v_RecentVisits> GetAllVisits() { SalitaEntities db = new SalitaEntities(); var v = db.v_RecentVisits.Where(p => p.InLounge == true); int Count = v.Count(); return(v); }
public IHttpActionResult GetCustomer(string Phone) { SalitaEntities db = new SalitaEntities(); var c = db.Customers.FirstOrDefault((p) => p.Phone == Phone); if (c == null) { return(NotFound()); } return(Ok(c)); }
protected void Page_Load(object sender, EventArgs e) { try { ViewState["cid"] = Request.QueryString["cid"]; ViewState["sid"] = Request.QueryString["sid"]; ViewState["note"] = Request.QueryString["n"]; this.txtNote.Value = ViewState["note"].ToString(); SalitaEntities db = new SalitaEntities(); int sid = Convert.ToInt32(ViewState["sid"]); var S = db.CustomerServices.Single(p => p.CustomerService_ID == sid); this.lblRefreshment.Text = S.ServiceDescription; } catch (Exception E) { this.CustomValidator1.ErrorMessage = E.Message; this.CustomValidator1.IsValid = false; } }
public IEnumerable <Customer> GetAllCustomers() { SalitaEntities db = new SalitaEntities(); return(db.Customers); }
public IEnumerable <v_CustomerNeeds> GetAllNeeds() { SalitaEntities db = new SalitaEntities(); return(db.v_CustomerNeeds.Where(p => p.WasFullfilled == false && p.Canceled == false).OrderBy(p => p.RequestDateTime)); }