public ActionResult AddParameterCompetency(int?categoryID) { try { AddNewCategory addnewcategory = new AddNewCategory(); string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName); addnewcategory.SearchedUserDetails = new SearchedUserDetails(); CommonMethodsDAL Commondal = new CommonMethodsDAL(); addnewcategory.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); EmployeeDAL dal = new EmployeeDAL(); int employeeID = dal.GetEmployeeID(Membership.GetUser().UserName); addnewcategory.SearchedUserDetails.EmployeeId = employeeID; PersonalDetailsDAL personalDAL = new PersonalDetailsDAL(); addnewcategory.SearchedUserDetails.EmployeeCode = personalDAL.getEmployeeCode(employeeID); ConfigurationDAL configDAL = new ConfigurationDAL(); if (categoryID != null) { tbl_PA_CompetencyCategories parameterCategory = configDAL.getParametercategory(categoryID); addnewcategory.CategoryID = parameterCategory.CategoryID; addnewcategory.Category = parameterCategory.CategoryType; addnewcategory.Description = parameterCategory.CategoryDescription; } return(PartialView("_addParameterCategory", addnewcategory)); } catch { throw; } }
public ActionResult AddParameterCompetency(AddNewCategory addnewcategory) { try { bool success = false; string result = null; ConfigurationDAL configDAL = new ConfigurationDAL(); success = configDAL.SaveParameterCategory(addnewcategory); if (addnewcategory.IsAddnew) { result = "addnew"; return(Json(new { resultMesssage = result, status = success }, JsonRequestBehavior.AllowGet)); } else { if (success) { result = "Saved"; } else { result = "Error"; } return(Json(new { resultMesssage = result, status = success }, JsonRequestBehavior.AllowGet)); } } catch { throw; } }
private void AddNewCategory_Loaded(object sender, RoutedEventArgs e) { var pos = AddNewCategory.GetPosition(); if (pos.Y < this.ActualHeight / 2) { AddNewCategory.Foreground = new SolidColorBrush(Colors.White); } }
public IActionResult AddCategory(AddNewCategory model, string imagename) { if (ModelState.IsValid) { if (imagename == null) { model.ImagePath = "default.png"; } else { model.ImagePath = imagename; } Category category = new Category { Name = model.Name, Description = model.Description, ImagePath = model.ImagePath }; categoryRepository.Add(category); } return(RedirectToAction(nameof(ListCat))); }
private void BtnNew_Click(object sender, EventArgs e) { AddNewCategory?.Invoke(sender, e); }