protected void Page_Init(object sender, EventArgs e)
    {
        ctx = new AriClinicContext("AriClinicContext");
        // security control, it must be a user logged
        if (Session["User"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "servicesubcategory"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        //
        if (Request.QueryString["ServiceSubCategoryId"] != null)
        {
            serviceSubCategoryId = Int32.Parse(Request.QueryString["ServiceSubCategoryId"]);
            serSub = CntAriCli.GetServiceSubcategory(serviceSubCategoryId, ctx);
            LoadData(serSub);
        }
        else
        {
            LoadServiceCategory(null);
        }
    }
Esempio n. 2
0
        public async Task <IActionResult> PutServiceSubCategory(int id, ServiceSubCategory serviceSubCategory)
        {
            if (id != serviceSubCategory.Id)
            {
                return(BadRequest());
            }

            _context.Entry(serviceSubCategory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ServiceSubCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
 {
     RefreshGrid();
     if (e.Argument == "new")
     {
         RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1;
         RadGrid1.Rebind();
     }
     if (e.Argument == "yes")
     {
         if (Session["DeleteId"] != null)
         {
             try
             {
                 serviceId = (int)Session["DeleteId"];
                 ServiceSubCategory serSub = (from s in ctx.ServiceSubCategories
                                              where s.ServiceSubCategoryId == serviceId
                                              select s).FirstOrDefault <ServiceSubCategory>();
                 ctx.Delete(serSub);
                 ctx.SaveChanges();
                 RefreshGrid();
                 Session["DeleteId"] = null;
             }
             catch (Exception ex)
             {
                 Session["Exception"] = ex;
                 string command = String.Format("showDialog('Error','{0}','error',null, 0, 0)"
                                                , Resources.GeneralResource.DeleteRecordFail);
                 RadAjaxManager1.ResponseScripts.Add(command);
             }
         }
     }
 }
Esempio n. 4
0
 public CarController()
 {
     myService          = new ServiceCar();
     serviceSubCategory = new ServiceSubCategory();
     serviceCarModel    = new ServiceCarModel();
     serviceCreation    = new ServiceCreationYear();
     serviceType        = new ServiceTypeCar();
     serviceImage       = new ServiceImage();
     serviceRating      = new ServiceRating();
 }
Esempio n. 5
0
 public HomeClientController()
 {
     myService          = new ServiceCategory();
     serviceCountry     = new ServiceCountry();
     serviceState       = new ServiceState();
     serviceCategory    = new ServiceCategory();
     serviceSubCategory = new ServiceSubCategory();
     serviceCar         = new ServiceCar();
     serviceRating      = new ServiceRating();
     serviceUser        = new ServiceUser();
 }
Esempio n. 6
0
 protected void LoadServiceSubCategory(ServiceSubCategory sscat)
 {
     // clear previous items
     rdcServiceSubCategory.Items.Clear();
     foreach (ServiceSubCategory s in ctx.ServiceSubCategories)
     {
         rdcServiceSubCategory.Items.Add(new RadComboBoxItem(s.Name, s.ServiceSubCategoryId.ToString()));
     }
     if (sscat != null)
     {
         rdcServiceSubCategory.SelectedValue = sscat.ServiceSubCategoryId.ToString();
     }
     else
     {
         rdcServiceSubCategory.Items.Add(new RadComboBoxItem(" ", ""));
         rdcServiceSubCategory.SelectedValue = "";
     }
 }
 protected bool CreateChange()
 {
     if (!DataOk())
     {
         return(false);
     }
     if (serSub == null)
     {
         serSub = new ServiceSubCategory();
         UnloadData(serSub);
         ctx.Add(serSub);
     }
     else
     {
         serSub = CntAriCli.GetServiceSubcategory(serviceSubCategoryId, ctx);
         UnloadData(serSub);
     }
     ctx.SaveChanges();
     return(true);
 }
 protected void UnloadData(ServiceSubCategory ser)
 {
     ser.Name            = txtName.Text;
     ser.ServiceCategory = CntAriCli.GetServiceCategory(Int32.Parse(rdcbServiceCategory.SelectedValue), ctx);
 }
 protected void LoadData(ServiceSubCategory serSub)
 {
     txtServiceSubCategoryId.Text = serSub.ServiceSubCategoryId.ToString();
     txtName.Text = serSub.Name;
     LoadServiceCategory(serSub.ServiceCategory);
 }
Esempio n. 10
0
 public SubCategoryController()
 {
     myService    = new ServiceSubCategory();
     myServicecat = new ServiceCategory();
 }
Esempio n. 11
0
        public async Task <ActionResult <ServiceSubCategory> > PostServiceSubCategory(ServiceSubCategory serviceSubCategory)
        {
            _context.ServiceSubCategories.Add(serviceSubCategory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetServiceSubCategory", new { id = serviceSubCategory.Id }, serviceSubCategory));
        }