Example #1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            int ID = (int)e.Keys["userId"];

            RestaurantServiceReference.Customer customer = new RestaurantServiceReference.Customer();
            string username  = (string)e.NewValues["username"];
            string email     = (string)e.NewValues["email"];
            string password  = (string)e.NewValues["password"];
            string contactno = (string)e.NewValues["contactno"];


            customer.UserId    = ID;
            customer.Username  = username;
            customer.Email     = email;
            customer.Password  = password;
            customer.ContactNo = contactno;

            client.UpdateUser(customer);

            GridView1.EditIndex = -1;

            lblStatus.Text      = "Customer Updated Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;
            BindData();
        }
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");


            int ID = (int)e.Keys["restaurantId"];

            RestaurantServiceReference.Restaurant res = new RestaurantServiceReference.Restaurant();
            string name        = (string)e.NewValues["name"];
            string city        = (string)e.NewValues["city"];
            string description = (string)e.NewValues["description"];
            string food_type   = (string)e.NewValues["food_type"];
            string contactno   = (string)e.NewValues["contactno"];



            res.RestaurantId = ID;
            res.Name         = name;
            res.City         = city;
            res.Description  = description;
            res.FoodType     = food_type;
            res.ContactNo    = contactno;

            client.UpdateRestaurant(res);

            GridView1.EditIndex = -1;
            lblStatus.Text      = "Restaurant Updated Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;
            BindData();
        }
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            int ID = (int)e.Keys["Id"];

            RestaurantServiceReference.Review review = new RestaurantServiceReference.Review();
            string feedback = (string)e.NewValues["feedback"];
            string rating   = (string)e.NewValues["rating"];
            string name     = (string)e.NewValues["name"];
            string id       = (string)e.NewValues["userId"];

            review.Id       = ID;
            review.Feedback = feedback;
            review.Rating   = int.Parse(rating);
            review.Name     = name;
            review.UserId   = int.Parse(id);


            bool status = client.UpdateReview(review);

            lblStatus.Text      = "Review Updated Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;

            GridView1.EditIndex = -1;
            BindData();
        }
Example #4
0
        protected void Btn_Login_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
                int    status;
                string uname = txtUsername.Text;
                string pass  = txtPassword.Text;
                status = client.SignInUser(uname, pass);

                if (status == 1)
                {
                    Session["username"] = txtUsername.Text;
                    lblStatus.Text      = "Signed In Successfully";
                    lblStatus.ForeColor = System.Drawing.Color.Green;
                    Response.Redirect("Customer_Home.aspx");
                }
                else if (status == 2)
                {
                    lblStatus.Text      = "InCorrect Pasaword !";
                    lblStatus.ForeColor = System.Drawing.Color.Red;
                }
                else if (status == 3)
                {
                    lblStatus.Text = "User Doesn't Exist !";
                    string strMsg = "User Doesn't Exist !";
                    string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
                    Response.Write(script);
                    lblStatus.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        protected void Btn_Register_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
                    RestaurantServiceReference.Customer user = new RestaurantServiceReference.Customer();

                    user.Username  = txtUsername.Text;
                    user.Password  = txtPassword.Text;
                    user.Email     = txtEmail.Text;
                    user.ContactNo = txtContactNo.Text;

                    try
                    {
                        client.RegisterUser(user);
                    }
                    catch (FaultException ex)
                    {
                        // lblStatus.Text = ex.Message.ToString();
                        //lblStatus.ForeColor = System.Drawing.Color.Red;
                        Console.Write(ex.Message.ToString());
                    }


                    Session["username"] = txtUsername.Text;
                    Response.Redirect("Customer_Home.aspx");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message.ToString());
            }
        }
        protected void BindData()
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            DataSet ds = client.GetAllRestaurants();

            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        protected void BindData()
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            int     id = client.GetUserId(Session["username"].ToString());
            DataSet ds = client.GetReviewForOneUser(id);

            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            int ID = (int)e.Keys["restaurantId"];

            client.DeleteRestaurant(ID);
            lblStatus.Text      = "Restaurant Deleted Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;
            BindData();
        }
Example #9
0
        protected void Btn_Add_Restaurant_Click(object sender, EventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
            RestaurantServiceReference.Customer customer = new RestaurantServiceReference.Customer();

            customer.Username  = txtUsername.Text;
            customer.Email     = txtEmail.Text;
            customer.ContactNo = txtContactNo.Text;

            client.UpdateUser(customer);

            lblStatus.Text      = "Profile Updated Successffully";
            lblStatus.ForeColor = System.Drawing.Color.Green;
        }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
         DropDownList1.DataSource = client.GetRestaurantNames();
         DropDownList1.DataBind();
     }
     if (Session["username"] != null)
     {
     }
     else
     {
         Response.Redirect("Login.aspx");
     }
 }
        protected void Btn_Add_Restaurant_Click(object sender, EventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
            RestaurantServiceReference.Restaurant res = new RestaurantServiceReference.Restaurant();

            res.FoodType    = txtFoodType.Text;
            res.Description = txtDescription.Text;
            res.City        = txtCity.Text;
            res.Name        = txtName.Text;
            res.ContactNo   = txtContactNo.Text;

            client.AddRestaurant(res);

            lblStatus.Text      = "Restaurant Added Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;
        }
Example #12
0
        protected void Btn_Add_Review_Click(object sender, EventArgs e)
        {
            try
            {
                RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
                RestaurantServiceReference.Review review = new RestaurantServiceReference.Review();

                int id = client.GetUserId(Session["username"].ToString());
                review.UserId   = id;
                review.Name     = DropDownList1.SelectedValue;
                review.Feedback = txtFeedback.Text;
                review.Rating   = int.Parse(txtRating.Text);

                client.AddReview(review);
                lblStauts.Text      = "Review Added Successfully";
                lblStauts.ForeColor = System.Drawing.Color.Green;
            }
            catch (Exception ex)
            {
                lblStauts.Text      = ex.Message.ToString();
                lblStauts.ForeColor = System.Drawing.Color.Red;
            }
        }