public static ClsRole GetByRoleID(Int64 ID) { try { ClsRole obj = new ClsRole(); DataSet ds = new Role.DataAccess.ClsRoleDataService().Role_GetByID(ID); if (!obj.MapData(ds.Tables[0])) { obj = null; } return(obj); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "GetByRoleID", "ClsRole.cs"); return(null); } }
private void btnSave_Click(object sender, System.Windows.RoutedEventArgs e) { try { if (txtName.Text.Trim() == "" || txtName.Text.Length > 50) { MessageBox.Show("Name of the Role cannot be left Blank or not more than 50 characters. ", "-> Please Enter a Name", MessageBoxButton.OK, MessageBoxImage.Information); txtName.Focus(); txtName.Text = txtName.Text.Trim(); return; } ClsRole objRole = new ClsRole(); if (varState == 0) //whn edit is clicked var state is sate to 1 so that sstored procedure update the table data objRole.ID = -1; else objRole.ID = varID; objRole.RoleName = txtName.Text.Trim(); objRole.Description = txtDescription.Text.Trim(); if (chkIsAdmin.IsChecked == true) objRole.IsAdmin = true; else objRole.IsAdmin = false; objRole.CreatedBy = VMuktiAPI.VMuktiInfo.CurrentPeer.ID; int gID = Convert.ToInt16(objRole.Save()); if (gID == 0) { MessageBox.Show("Duplicate Entry For Role Name Not Allowed !!", "-> Role", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { lblCurrentRole.Content = "Role : " + txtName.Text; FncSavePermissions(varID); //c.Save(varID); FncClearAll(); funSetGrid(); tbiRoles.IsSelected = true; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "btnSave_Click", "CtlRole.xaml.cs"); } }
public static ClsRole GetByRoleID(Int64 ID) { try { ClsRole obj = new ClsRole(); DataSet ds = new Role.DataAccess.ClsRoleDataService().Role_GetByID(ID); if (!obj.MapData(ds.Tables[0])) obj = null; return obj; } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "GetByRoleID", "ClsRole.cs"); return null; } }