public string ChangeStatus(long id) { tblRole location = _dbRepository.SelectById(id); location.IsActive = !location.IsActive; return(_dbRepository.Update(location)); }
protected void Page_Load(object sender, EventArgs e) { tblRole role = (tblRole)Session["Role"]; if (role == null || !role.ICR_Out) { Response.Redirect("/403"); } try { _NationalNumber = (string)Session["SVCNationalNumber"]; } catch { } using (EGovernmentEntities db = new EGovernmentEntities()) { tblCitizen citizen = db.tblCitizens.Where(x => x.NationalNumber == _NationalNumber).FirstOrDefault(); if (citizen != null) { FillDocument(citizen); } } }
public IHttpActionResult PuttblRole(int id, tblRole tblRole) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblRole.ID) { return(BadRequest()); } db.Entry(tblRole).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblRoleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
protected void Page_Load(object sender, EventArgs e) { tblRole role = (tblRole)Session["Role"]; if (role == null || !role.DeathOut) { Response.Redirect("/403"); } try { string NationalNumber = (string)Session["SVCNationalNumber"]; string[] nums = NationalNumber.Split(';'); FatherNationalNumber = nums[0]; ChildNationalNumber = nums[1]; } catch { } using (EGovernmentEntities db = new EGovernmentEntities()) { tblDeadRegistration deadRegistration = db.tblDeadRegistrations.Where(x => x.NationalNumber == ChildNationalNumber).FirstOrDefault(); if (deadRegistration != null) { FillDocument(deadRegistration); } } }
protected void Save(string strRoleID) { if (strRoleID != string.Empty) { using (MWDatabaseEntities MWDB = new MWDatabaseEntities()) { System.Guid gu = new Guid(strRoleID); tblRole objRole = MWDB.tblRole.First(r => r.RoleID == gu); if (objRole != null) { MenuPermissionRoleBLL Menu_Permission_RoleBLLs = new MenuPermissionRoleBLL(); Menu_Permission_RoleBLLs.DeleteT(strRoleID); IList <RadTreeNode> nodeCollection = RadTreeView_Rigth.CheckedNodes; //删除 //循环选中的节点并获取值 foreach (RadTreeNode node in nodeCollection) { if (node.Value != string.Empty) { tblMenu_Permission_Role tblp = new tblMenu_Permission_Role(); System.Guid guMenuID = new Guid(node.Value); tblp.MenuID = guMenuID; tblp.RoleID = gu; Menu_Permission_RoleBLLs.Add(tblp); } } } } } }
public void loadchildmenu(DataTable DtChildTab, int intLevel) { if (DtChildTab.Rows.Count > 0) { if (intLevel == 2) { menuString += "<ul>"; } else if (intLevel == 3) { menuString += "<ul>"; } for (int i = 0; i <= DtChildTab.Rows.Count - 1; i++) { // If DtTab.Rows(i)("appParentId") <> 0 And DtTab.Rows(i)("appIsAdd").ToString = "False" Then objRole = new tblRole(); DataTable dtSubChildTab = objRole.LoadPermissionTabMenu(Session[appFunctions.Session.RoleID.ToString()].ToString(), DtChildTab.Rows[i]["AppTabID"].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]); menuString += "<li><a href='" + DtChildTab.Rows[i]["appWebPageName"].ToString() + "'>" + DtChildTab.Rows[i]["AppTabName"].ToString(); menuString += "</a>"; loadchildmenu(dtSubChildTab, intLevel + 1); menuString += "</li>"; // End If } menuString += "</ul>"; } }
public ActionResult DeleteConfirmed(int id) { tblRole tblRole = db.tblRoles.Find(id); db.tblRoles.Remove(tblRole); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool DeleteRoleLogic(Guid roleGuid) { tblRole role = bringlyEntities.tblRoles.Where(c => c.RoleGuid == roleGuid).FirstOrDefault(); bringlyEntities.Entry(role).State = System.Data.Entity.EntityState.Deleted; bringlyEntities.SaveChanges(); return(true); }
public JsonResult DeleteRole(int?Id) { tblRole lang = userrole.GetByID(x => x.RoleId == Id); lang.IsDeleted = true; userrole.Save(); return(Json(Id)); }
private void AddMenagerExecute() { try { if (!ValidationClass.JMBGisValid(MenagerToAdd.JMBG)) { MessageBox.Show("JMBG nije validan."); return; } //if (!ValidationClass.JMBGIsUnique(employee.JMBG)) //{ // MessageBox.Show("JMBG already exists in database"); // return; //} if (!ValidationClass.IsValidEmail(MenagerToAdd.Email)) { MessageBox.Show("Email nije validan"); return; } int salary; if (!Int32.TryParse(Salary, out salary)) { MessageBox.Show("Plata mora biti broj"); return; } MenagerToAdd.RoleID = MenagerRole.RoleID; MenagerToAdd.SectorID = menagerSector.SectorID; MenagerToAdd.Salary = salary; MenagerToAdd.DateOfBirth = StartDate; EmployeeList = employeeService.GetAllEmployees(); //string textForFile = String.Format("Added user {0} {1} JMBG {2}", employee.FirstName, // employee.LastName, employee.JMBG); //eventObject.OnActionPerformed(textForFile); //employee.GenderID = gender.GenderID; isUpdateUser = true; menagerService.AddMenager(MenagerToAdd); MenagerToAdd = new tblEmployee(); MenagerRole = new tblRole(); MenagerSector = new tblSector(); Salary = ""; MessageBox.Show("Uspesno ste dodali menadzera"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public JsonResult UpdateRole(clsRole _role) { tblRole lang = userrole.GetByID(x => x.RoleId == _role.RoleId); lang.RoleName = _role.RoleName; userrole.Edit(lang); userrole.Save(); return(Json(lang)); }
protected void Page_Load(object sender, EventArgs e) { tblRole role = (tblRole)Session["Role"]; if (role == null || !role.StatisticsReports) { Response.Redirect("/403"); } }
protected void Page_Load(object sender, EventArgs e) { tblRole role = (tblRole)Session["Role"]; if (role == null || !role.MarriageDoc) { Response.Redirect("/403"); } }
public JsonResult InsertRole(clsRole _role) { tblRole lang = new tblRole(); lang.RoleName = _role.RoleName; lang.IsDeleted = false; userrole.Insert(lang); userrole.Save(); return(Json(lang)); }
public ActionResult Edit([Bind(Include = "idRol,nomRol")] tblRole tblRole) { if (ModelState.IsValid) { db.Entry(tblRole).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblRole)); }
public IHttpActionResult GettblRole(int id) { tblRole tblRole = db.tblRoles.Find(id); if (tblRole == null) { return(NotFound()); } return(Ok(tblRole)); }
public bool IsRolexists(UserRole role) { bool roleExists = false; tblRole roleObject = bringlyEntities.tblRoles.Where(x => x.CreatedByGuid == UserVariables.LoggedInUserGuid && x.RoleName == role.RoleName && x.RoleGuid != role.RoleGuid).FirstOrDefault(); if (roleObject != null && !string.IsNullOrEmpty(roleObject.RoleName)) { roleExists = true; } return(roleExists); }
private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objRole = new tblRole(); if (!string.IsNullOrEmpty(strFieldValue) & !string.IsNullOrEmpty(strFieldName)) { objDataTable = objRole.LoadGridData(strFieldName, strFieldValue, (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()], Session[appFunctions.Session.UserID.ToString()].ToString()); } else { objDataTable = objRole.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim(), (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()], Session[appFunctions.Session.UserID.ToString()].ToString()); } //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvGridView.PageCount > 0) { dgvGridView.PageIndex = 0; } } dgvGridView.DataSource = null; dgvGridView.DataBind(); lblCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DInfo.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvGridView.AllowPaging = false; } else { dgvGridView.AllowPaging = true; dgvGridView.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridView.DataSource = objDataTable; dgvGridView.DataBind(); } objRole = null; }
public IHttpActionResult PosttblRole(tblRole tblRole) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblRoles.Add(tblRole); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tblRole.ID }, tblRole)); }
public IActionResult GetbyID(Guid id) { try { tblRole TblRole = _unitOfWork.tblRole.GetById(id); return(Ok(TblRole)); } catch (Exception ex) { Utilities.QuickLog($"Failed to TblRoleController, Function :GetbyID() : {ex}"); return(BadRequest("Error Occurred")); } }
public bool Add(tblRole obj) { try { repository.tblRoles.Add(obj); repository.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public IHttpActionResult DeletetblRole(int id) { tblRole tblRole = db.tblRoles.Find(id); if (tblRole == null) { return(NotFound()); } db.tblRoles.Remove(tblRole); db.SaveChanges(); return(Ok(tblRole)); }
// GET: tblRoles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblRole tblRole = db.tblRoles.Find(id); if (tblRole == null) { return(HttpNotFound()); } return(View(tblRole)); }
public static tblRole GetRoleById(int?RoleId) { tblRole role = null; if (RoleId != null) { using (EGovernmentEntities db = new EGovernmentEntities()) { role = db.tblRoles.Where(x => x.Id == RoleId).FirstOrDefault(); } } return(role); }
public static tblRole GetEmployeeRole(string NationalNumber) { tblRole role = null; using (EGovernmentEntities db = new EGovernmentEntities()) { tblEmployeesCivilRegistry employeesCivilRegistry = db.tblEmployeesCivilRegistries.Where(x => x.EmployeNationalNumber == NationalNumber).Where(y => y.E_date == null).FirstOrDefault(); if (employeesCivilRegistry != null) { role = db.tblRoles.Where(x => x.Id == employeesCivilRegistry.RoleId).FirstOrDefault(); } } return(role); }
protected void btnUpdate_Click(object sender, EventArgs e) { tblRole result = get_Data_From_Form(); result.RoleId = Int32.Parse(Request.QueryString["id"]); Role repository = new Role(); if (repository.Update(result)) { Response.Redirect("~/pages/role.aspx"); } else { this.ShowErrorNotification("Error occured"); } }
public bool Delete(RoleEntity role) { try { TIMSDBEntities entity = new TIMSDBEntities(); tblRole Role = entity.tblRoles.Where(x => x.ID == role.ID).FirstOrDefault(); entity.tblRoles.Remove(Role); entity.SaveChanges(); return(true); } catch (Exception) { throw; } }
public JsonResult DeleteRole(int Id) { try { tblRole rigt = roles.GetByID(x => x.RoleId == Id); rigt.IsDeleted = true; roles.Edit(rigt); roles.Save(); return(Json(Id)); } catch (Exception ex) { Log.Error(ex.ToString()); } return(null); }
public bool UpdateRole(UserRole role) { if (!IsRolexists(role)) { tblRole roleObject = bringlyEntities.tblRoles.Where(x => x.RoleGuid == role.RoleGuid).FirstOrDefault(); roleObject.RoleName = role.RoleName; roleObject.ModifiedBy = UserVariables.LoggedInUserGuid; roleObject.ModifiedDate = DateTime.Now; bringlyEntities.SaveChanges(); return(true); } else { return(false); } }
public ActionResult KendoSave([DataSourceRequest] DataSourceRequest request, tblRole model) { if (model == null || !ModelState.IsValid) { return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); } string message = model.RoleId > 0 ? _dbRepository.Update(model) : _dbRepository.Insert(model); ModelState.Clear(); if (!string.IsNullOrEmpty(message)) { ModelState.AddModelError("RoleName", message); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }