protected Bill create() { OrderModel order = new OrderModel(); UserInfoModel user = new UserInfoModel(); Bill b = new Bill(); b.ClientID = (String)Session["id"]; b.Quantity = order.GetAmountOfOrders((String)Session["id"]); b.OrderDate = DateTime.Now; b.DeliveryDate = b.OrderDate.AddDays(5.0); b.TotalBill = (int)totalAmount; b.Address = user.GetUserInfoByGUID((String)Session["id"]).Address; b.Phone = user.GetUserInfoByGUID((String)Session["id"]).Phone; return(b); }
protected String getUser(String id) { UserInfoModel model = new UserInfoModel(); UserInformation info = new UserInformation(); info = model.GetUserInfoByGUID(id); return(info.FirstName); }
protected void Page_Load(object sender, EventArgs e) { BillModel model = new BillModel(); Bill b = new Bill(); UserInfoModel user = new UserInfoModel(); if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); b = model.getBill(id); litName.Text = user.GetUserInfoByGUID(b.ClientID).FirstName + " " + user.GetUserInfoByGUID(b.ClientID).LastName; litPhone.Text = b.Phone.ToString(); litQuantity.Text = b.Quantity.ToString(); litODate.Text = b.OrderDate.ToShortDateString(); litDDate.Text = b.DeliveryDate.ToShortDateString(); litAddress.Text = b.Address; litBill.Text = "Rs " + b.TotalBill.ToString(); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { if (Session["id"] != null) { if (Session["role"] == "user") { ProductModel pro = new ProductModel(); UserInformation info = new UserInformation(); UserInfoModel model = new UserInfoModel(); Order cart = new Order(); String g = (String)Session["id"]; info = model.GetUserInfoByGUID(g); int id = Convert.ToInt32(Request.QueryString["id"]); int amount = Convert.ToInt32(ddlAmount.SelectedValue); if (amount <= pro.GetProduct(id).Stock) { cart.OrderQuantity = amount; Random r = new Random(); cart.ClientID = info.GUID; cart.OrderDate = DateTime.Now; cart.IsInCart = true; cart.ProductID = id; OrderModel order = new OrderModel(); lblResult.Text = order.insertOrder(cart); } else { lblResult.Text = "Required Amount not present"; } } else { Response.Redirect("~/Pages/Index.aspx"); } } else { lblResult.Text = "Login to Order Products."; } } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { UserInfoModel model = new UserInfoModel(); UserInformation user = new UserInformation(); user = model.GetUserInfoByGUID(Request.QueryString["id"]); txtFirstname.Text = user.FirstName; txtLastName.Text = user.LastName; txtPassword.Text = user.Password; txtPhone.Text = user.Phone.ToString(); txtAddress.Text = user.Address; txtEmail.Text = user.Email; txtUsername.Text = user.Username; txtPostalCode.Text = user.PostalCode.ToString(); } }
protected void btn_Reset_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { if (txtPass.Text.Equals(txtConfrmPass.Text)) { String g = Request.QueryString["id"]; UserInfoModel model = new UserInfoModel(); litResult.Text = model.ResetPass(g, txtPass.Text); UserInformation info = new UserInformation(); info = model.GetUserInfoByGUID(g); string strSubject = "24x7 Email Validation"; string strBody = "Your password is :" + info.Password; SendEmail(info.Email, strSubject, strBody); } else { litResult.Text = "Password should Match"; } } }