示例#1
0
        public void SelectValue(object sender, EventArgs e)
        {
            int[] rows = ServiceTypeView.GetSelectedRows();

            SelectedValue = Convert.ToInt32(ServiceTypeView.GetRowCellValue(rows[0], "Id"));
            SelectedCode  = ServiceTypeView.GetRowCellValue(rows[0], "Name").ToString();
            SelectedText  = ServiceTypeView.GetRowCellValue(rows[0], "Name").ToString();

            Hide();
        }
示例#2
0
        public ActionResult Edit(int?serviceTypePK)
        {
            if (serviceTypePK != null)
            {
                IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);
                ServiceType             serviceType            = serviceTypesRepository.GetServiceTypeByPK((int)serviceTypePK);
                ServiceTypeView         serviceTypeView        = new ServiceTypeView();

                serviceTypeView.ConvertFrom(serviceType, serviceTypeView);

                return(View(serviceTypeView));
            }
            else
            {
                return(RedirectToAction("Index", "ServiceType"));
            }
        }
示例#3
0
        public ActionResult Edit(ServiceTypeView serviceTypeModel)
        {
            if (ModelState.IsValid)
            {
                IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);
                ServiceType             serviceType            = serviceTypesRepository.GetServiceTypeByPK((int)serviceTypeModel.ServiceTypePK);
                serviceTypeModel.ConvertTo(serviceTypeModel, serviceType);

                serviceTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", serviceType.ServiceTypePK);

                return(RedirectToAction("Index", "ServiceType"));
            }
            else
            {
                return(View(serviceTypeModel));
            }
        }
示例#4
0
        public ActionResult Add(ServiceTypeView serviceTypeView)
        {
            if (ModelState.IsValid)
            {
                IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);
                ServiceType             serviceType            = new ServiceType();

                serviceTypeView.ConvertTo(serviceTypeView, serviceType);

                serviceTypesRepository.Add(serviceType);
                serviceTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", serviceType.ServiceTypePK);

                return(RedirectToAction("Index", "ServiceType"));
            }
            else
            {
                return(View(serviceTypeView));
            }
        }