Exemplo n.º 1
0
        protected void gvOrderLines_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;
            try
            {
                result = svc.DeleteOrderLine(int.Parse(gvOrderLines.Rows[e.RowIndex].Cells[1].Text));

                if (result.ErrorCode == 0)
                {
                    LoadData();
                    lblStatus.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                }

                lblStatus.Text = result.Message;
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "There was an error attempting to delete the specified item.";
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Apply order changes
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;

            try
            {
                order.PhoneNumber     = txtPhoneNumber.Text;
                order.DeliveryAddress = txtAddress.Text;

                result = svc.addOrder(order);

                if (result.ErrorCode == 0)
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                }

                lblStatus.Text = result.Message;
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "Unable to modify the order. Please ensure the submitted data is valid.";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Load the order and order lines to the fields.
        /// </summary>
        /// <returns>Returns a service result.</returns>
        private ServiceResult LoadData()
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;
            try
            {
                order               = Session["Order"] as Order;
                lblOrderID.Text     = order.ID.ToString();
                txtAddress.Text     = order.DeliveryAddress;
                txtPhoneNumber.Text = order.PhoneNumber;

                cboMeals.DataSource     = svc.GetMeals(out result);
                cboMeals.DataValueField = "ID";
                cboMeals.DataTextField  = "Name";
                cboMeals.DataBind();


                gvOrderLines.DataSource = svc.GetOrderLines(order.ID, out result);
                gvOrderLines.DataBind();

                return(result);
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "Oh no... Looks like it failed to load the page correctly.";
                return(new ServiceResult());
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// get order line from database, then display on page and set the status text to the ServiceResult message.
        /// </summary>
        protected void gvOrderLines_SelectedIndexChanged(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;

            try
            {
                orderLine = svc.GetByOrderLineId(int.Parse(gvOrderLines.SelectedRow.Cells[1].Text), out result);

                displayLine(orderLine);

                if (result.ErrorCode == 0)
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                }

                lblStatus.Text = result.Message;

                pnlItem.Visible = true;
                btnNew.Text     = "Save item";
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "There was an error selecting the item.";
            }
        }
Exemplo n.º 5
0
        protected void btnYes_Click(object sender, EventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                result = svc.DeleteUser(userDeleting.ID);

                if (result.ErrorCode == 0)
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                }
                lblInfo.Text = result.Message;

                LoadData();
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error trying to delete the user.";
            }
            finally
            {
                pnlDelete.Visible = false;
                btnNo.Enabled     = false;
                btnYes.Enabled    = false;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Set order line values to the data given by the user.
        /// run insert query.
        /// Display message.
        /// </summary>
        protected void btnNew_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;

            try
            {
                orderLine.MealID   = int.Parse(cboMeals.SelectedItem.Value);
                orderLine.OrderID  = order.ID;
                orderLine.Quantity = int.Parse(txtQuantity.Text);

                result = svc.AddOrderLine(orderLine);

                LoadData();

                if (result.ErrorCode == 0)
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                }
                lblStatus.Text = result.Message;
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "Error. Please ensure that you have entered valid data into the required fields.";
            }
        }
Exemplo n.º 7
0
        protected void gvIngredients_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                result = svc.DeleteIngredient(int.Parse(gvIngredients.Rows[e.RowIndex].Cells[2].Text));

                lblInfo.DisplayResult(result);

                pnlEdit.Visible = false;

                try
                {
                    LoadIngredients();
                }
                catch
                {
                    lblInfo.Text      = "There was an error attempting to load the Data.";
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                }
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to delete the ingredient.";
            }
        }
Exemplo n.º 8
0
        protected void gvOrders_SelectedIndexChanged(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();

            SvcKitchen.ServiceResult result;

            try
            {
                Session["Order"] = svc.GetOrderByID(int.Parse(gvOrders.SelectedRow.Cells[2].Text), out result);

                if (result.ErrorCode == 0)
                {
                    Response.Redirect("~/OrderEdit");
                }

                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = result.Message;
            }

            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to select the specified order.";
            }
        }
Exemplo n.º 9
0
        protected void btnNew_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;

            try
            {
                SvcKitchen.Order order = new SvcKitchen.Order();
                order.OrderDate = DateTime.Now;

                result = svc.addOrder(order);

                if (result.ErrorCode == 0)
                {
                    GetOrders();
                    lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
                }


                lblInfo.Text = result.Message;
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to create a new order.";
            }
        }
        protected void gvRoles_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                role             = new SvcKitchen.Role();
                role.ID          = int.Parse(gvRoles.Rows[e.RowIndex].Cells[2].Text);
                role.Description = gvRoles.Rows[e.RowIndex].Cells[3].Text;

                result = svc.RoleDelete(role);

                lblInfo.DisplayResult(result);

                pnlEdit.Visible     = false;
                lblID.Text          = "";
                txtDescription.Text = "";

                LoadData();
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to delete the role.";
            }
        }
Exemplo n.º 11
0
        protected void gvMealLines_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                // delete by meal line id
                result = svc.DeleteMealLine(int.Parse(gvMealLines.Rows[e.RowIndex].Cells[2].Text));

                // set the colour of the label to red if there is an error, else green; and then display the result's message.
                lblLineInfo.DisplayResult(result);

                pnlEditMealLine.Visible = false;

                // reload the meal lines
                try
                {
                    LoadMealLines();
                }
                catch
                {
                    lblLineInfo.Text      = "There was an error attempting to load the Data.";
                    lblLineInfo.ForeColor = System.Drawing.Color.DarkRed;
                }
            }
            catch
            {
                lblLineInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblLineInfo.Text      = "There was an error attempting to delete the meal/recipe.";
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                GetRoleFromForm(isNew);

                result = svc.RoleSave(role);

                lblInfo.DisplayResult(result);

                pnlEdit.Visible     = false;
                lblID.Text          = "";
                txtDescription.Text = "";

                LoadData();
            }
            catch
            {
                lblInfo.Text      = "There was an error attempting to submit the role.";
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
            }
        }
Exemplo n.º 13
0
        protected void btnNewUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNewUser.Text != "*" && !string.IsNullOrEmpty(txtNewUser.Text))
                {
                    SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();

                    var result = svc.AddNewUser(txtNewUser.Text);

                    if (result.ErrorCode == 0)
                    {
                        LoadData();
                    }
                    else
                    {
                        lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                        lblInfo.Text      = result.Message;
                    }
                }
            }
            catch
            {
                lblInfo.Text      = "There was an error attempting to create a new user.";
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
            }
        }
Exemplo n.º 14
0
        protected void gvOrders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();

            try
            {
                SvcKitchen.ServiceResult result = svc.DeleteOrder(int.Parse(gvOrders.Rows[e.RowIndex].Cells[2].Text));

                if (result.ErrorCode == 0)
                {
                    GetOrders();
                    lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
                }
                else
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                }
                lblInfo.Text = result.Message;
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to delete the order.";
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Loads the ingredients and displays them.
        /// </summary>
        private void LoadIngredients()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            gvIngredients.DataSource = svc.GetIngredients(out result);
            gvIngredients.DataBind();
            lblInfo.DisplayResult(result);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Fills gvRoles with all of the user roles.
        /// </summary>
        private void GetUserRoles()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            gvRoles.DataSource = svc.GetUserRolesById(userID, out result);
            gvRoles.DataBind();

            lblInfo.Text = result.Message;
        }
        /// <summary>
        /// Load all of the data.
        /// </summary>
        private void LoadData()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            gvRoles.DataSource = svc.RoleGetAll(out result);
            gvRoles.DataBind();

            lblInfo.DisplayResult(result);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Loads the meal lines and displays them.
        /// </summary>
        private void LoadMealLines()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            gvMealLines.DataSource = svc.GetMealLines(meal.ID, out result);
            gvMealLines.DataBind();

            lblLineInfo.DisplayResult(result);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Updates the user role with the data specified on the page, then reloads the data from the database.
        /// </summary>
        protected void btnSaveUserRole_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();

            ServiceResult result = new ServiceResult();

            result = svc.UpdateUserRole(ur.UserRoleID, Convert.ToInt32(txtAccessLevel.Text));

            lblInfo.Text = result.Message;

            GetUserRoles();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Loads the meal lines and displays them.
        /// </summary>
        private void PopulateIngredients()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            cboIngredients.DataSource     = svc.GetIngredients(out result);
            cboIngredients.DataValueField = "ID";
            cboIngredients.DataTextField  = "Name";
            cboIngredients.DataBind();

            lblLineInfo.DisplayResult(result);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Updates the username and password with the data specified on the page.
        /// If the password does not match the confirmation password, it will display an error message in red.
        /// </summary>
        protected void btnSaveUserCredentials_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            ServiceResult result = new ServiceResult();

            if (txtPassword.Text == txtConfirm.Text)
            {
                result = svc.UpdateUser(txtUsername.Text, txtPassword.Text, userID);

                lblInfo.ForeColor = System.Drawing.Color.Black;
                lblInfo.Text      = "Operation successful.";
            }
            else
            {
                lblInfo.ForeColor = System.Drawing.Color.Red;
                lblInfo.Text      = "Error. Please ensure that the passwords match.";
            }
        }
Exemplo n.º 22
0
        protected void gvRoles_SelectedIndexChanged(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            ur             = new UserRole();
            ur.UserRoleID  = Convert.ToInt32(gvRoles.SelectedRow.Cells[1].Text);
            ur.UserID      = Convert.ToInt32(gvRoles.SelectedRow.Cells[2].Text);
            ur.RoleID      = Convert.ToInt32(gvRoles.SelectedRow.Cells[3].Text);
            ur.AccessLevel = Convert.ToInt32(gvRoles.SelectedRow.Cells[4].Text);
            ur.RoleName    = gvRoles.SelectedRow.Cells[5].Text;

            DisplayUserRole(ur);

            lblRole.Enabled         = true;
            txtAccessLevel.Enabled  = true;
            btnSaveUserRole.Enabled = true;
            pnlUserRoles.Visible    = true;
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            var svc = new SvcKitchen.SvcKitchenSoapClient();

            SvcKitchen.ServiceResult result;
            var user = svc.UserLogin(txtUsername.Text, txtPassword.Text, out result);

            lblInfo.Text = result.Message;

            if (user.ID > 0) // If the user is valid
            {
                Session["user"] = user;
                Response.Redirect("~/Default");
            }
            else // if the user is invalid
            {
                lblInfo.ForeColor = System.Drawing.Color.Red;
                lblInfo.Text      = "Invalid credentials";
            }
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            switch (this.GetAccessLevel("Users"))
            {
            case AccessLevel.Deny:
                Response.Redirect("~/Users/Users.aspx");
                break;

            case AccessLevel.Read:
                btnSaveUserCredentials.Enabled = false;
                btnSaveUserRole.Enabled        = false;
                txtConfirm.Enabled             = false;
                txtPassword.Enabled            = false;
                txtUsername.Enabled            = false;
                txtAccessLevel.Enabled         = false;
                gvRoles.Enabled = false;
                break;
            }

            userID = (int)Session["UserID"];

            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            u = svc.GetUserByID(userID, out result);

            DisplayUser();

            GetUserRoles();

            lblInfo.Text = result.Message;

            lblRole.Enabled         = false;
            txtAccessLevel.Enabled  = false;
            btnSaveUserRole.Enabled = false;
        }
Exemplo n.º 25
0
        private void GetOrders()
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();

            SvcKitchen.ServiceResult result;

            gvOrders.DataSource = svc.GetOrders(out result);

            gvOrders.DataBind();

            if (result.ErrorCode == 0)
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
            }
            else
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
            }

            lblInfo.Text = result.Message;
        }
Exemplo n.º 26
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                GetIngredientFromForm(isNewIngredient);

                if (ingredient.ID == 0)
                {
                    result = svc.AddIngredient(ingredient.Name);
                }
                else
                {
                    result = svc.UpdateIngredient(ingredient.Name, ingredient.ID);
                }

                lblInfo.DisplayResult(result);

                pnlEdit.Visible        = false;
                lblID.Text             = "";
                txtIngredientName.Text = "";

                try
                {
                    LoadIngredients();
                }
                catch
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                    lblInfo.Text      = "Looks like there was an error attempting to load the data.";
                }
            }
            catch
            {
                lblInfo.Text      = "There was an error attempting to submit the ingredient.";
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
            }
        }
Exemplo n.º 27
0
        private void LoadData()
        {
            SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

            var       users   = svc.GetAllUsers(out result);
            DataTable dtUsers = new DataTable();

            dtUsers.Columns.Add();
            dtUsers.Columns.Add();
            dtUsers.Columns.Add();

            foreach (SvcKitchen.User u in users)
            {
                dtUsers.Rows.Add(new object[] { u.ID, u.Username, u.Password });
            }

            if (result.ErrorCode == 0)
            {
                gvUsers.DataSource = users;
                gvUsers.DataBind();

                for (int i = 0; i < users.Length; i++)
                {
                    if ((string)dtUsers.Rows[i][2] == "password")
                    {
                        gvUsers.Rows[i].Cells[2].Text = "*" + gvUsers.Rows[i].Cells[2].Text;
                    }
                }

                lblInfo.ForeColor = System.Drawing.Color.DarkGreen;
                lblInfo.Text      = result.Message;
            }
            else
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = result.Message;
            }
        }
Exemplo n.º 28
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            SvcKitchen.SvcKitchenSoapClient svc = new SvcKitchen.SvcKitchenSoapClient();
            SvcKitchen.ServiceResult        result;

            try
            {
                result = svc.DeleteOrder(order.ID);

                if (result.ErrorCode == 0)
                {
                    Response.Redirect("~/Orders");
                }

                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = result.Message;
            }
            catch
            {
                lblStatus.ForeColor = System.Drawing.Color.DarkRed;
                lblStatus.Text      = "There was an error attempting to delete the order.";
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// Delete the meal, and the meal lines that are related to the meal.
        /// </summary>
        protected void gvMeals_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                // Delete meal lines to prevent the meal lines from having no corresponding meal.
                result = svc.DeleteMealLineByMealID(int.Parse(gvMeals.Rows[e.RowIndex].Cells[2].Text));
                // If there is no error deleting the meal lines, delete the meal.
                if (result.ErrorCode == 0)
                {
                    result = svc.DeleteMeal(int.Parse(gvMeals.Rows[e.RowIndex].Cells[2].Text));
                }

                // set the colour of the label to red if there is an error, else green; and then display the result's message.
                lblInfo.DisplayResult(result);

                pnlEdit.Visible = false;

                try
                {
                    LoadMeals();
                }
                catch
                {
                    lblInfo.Text      = "There was an error attempting to load the Data.";
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                }
            }
            catch
            {
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                lblInfo.Text      = "There was an error attempting to delete the meal/recipe.";
            }
        }
Exemplo n.º 30
0
        protected void btnSubmitLine_Click(object sender, EventArgs e)
        {
            try
            {
                SvcKitchen.SvcKitchenSoapClient svc    = new SvcKitchen.SvcKitchenSoapClient();
                SvcKitchen.ServiceResult        result = new SvcKitchen.ServiceResult();

                // get the meal line
                GetMealLineFromForm(isNewMealLine);

                // add/update it
                result = svc.AddMealLine(mealLine);

                lblLineInfo.DisplayResult(result);

                // reset the form
                pnlEditMealLine.Visible = false;
                ClearMealLineForm();

                // reload
                try
                {
                    LoadMealLines();
                }
                catch
                {
                    lblInfo.ForeColor = System.Drawing.Color.DarkRed;
                    lblInfo.Text      = "Looks like there was an error attempting to load the data.";
                }
            }
            catch
            {
                lblInfo.Text      = "There was an error attempting to submit the recipe.";
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
            }
        }