Exemplo n.º 1
0
        protected void ServiceEditView_DataBound(object sender, EventArgs e)
        {
            DropDownList listCategories = (DropDownList)ServiceEditView.FindControl("serviceCategories");

            if (listCategories == null)
            {
                return;
            }
            Label currentCategory = (Label)ServiceEditView.FindControl("categoryId");

            listCategories.Items.FindByValue(currentCategory.Text).Selected = true;
        }
Exemplo n.º 2
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            FileUpload btnUpload = (FileUpload)ServiceEditView.FindControl("serviceImageUpload");

            if (btnUpload.FileName == null)
            {
                return;
            }

            btnUpload.SaveAs(Server.MapPath("~/Front/img/service_detail/" + btnUpload.FileName.ToLower()));
            Image imgService = (Image)ServiceEditView.FindControl("serviceImage");

            imgService.ImageUrl = "~/Front/img/service_detail/" + btnUpload.FileName.ToLower();
        }
Exemplo n.º 3
0
        protected void btnSvcUpdate_Click(object sender, EventArgs e)
        {
            string serviceId          = ((Label)ServiceEditView.FindControl("idLabel")).Text;
            string serviceName        = ((TextBox)ServiceEditView.FindControl("serviceName")).Text;
            string serviceCost        = ((TextBox)ServiceEditView.FindControl("serviceCost")).Text;
            string serviceCategory    = ((DropDownList)ServiceEditView.FindControl("serviceCategories")).SelectedValue;
            string serviceImage       = Path.GetFileName(((Image)ServiceEditView.FindControl("serviceImage")).ImageUrl);
            string serviceDescription = ((TextBox)ServiceEditView.FindControl("serviceDescription")).Text;

            DataLayer.updateService(serviceId, serviceName, serviceCost, serviceCategory, serviceImage, serviceDescription);
            if (Session["servicePageIndex"] != null)
            {
                Response.Redirect("manage_services.aspx?pageIndex=" + Session["servicePageIndex"]);
            }
            else
            {
                Response.Redirect("manage_services.aspx");
            }
        }