IList <ALRD_SecurityRoleDetailEntity> IALRD_SecurityRoleDetailDao.GetAll(ALRD_SecurityRoleDetailEntity entity) { try { const string SP = "alrd_securityroledetail_GetAll"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddSortExpressionParameter(cmd, entity.SortExpression); FillParameters(entity, cmd, Database); IList <ALRD_SecurityRoleDetailEntity> itemList = new List <ALRD_SecurityRoleDetailEntity>(); using (IDataReader reader = Database.ExecuteReader(cmd)) { while (reader.Read()) { itemList.Add(new ALRD_SecurityRoleDetailEntity(reader)); } } return(itemList); } } catch (Exception ex) { throw GetDataAccessException(ex, SourceOfException("GetAll")); } }
long IALRD_SecurityRoleDetailDao.Update(ALRD_SecurityRoleDetailEntity entity, bool isPertial = false) { long returnCode = -99; string SP; if (!isPertial) { SP = "alrd_securityroledetail_Update"; } else { SP = "alrd_securityroledetail_PertialUpdate"; } using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { FillParameters(entity, cmd, Database); //FillSequrityParameters(securityCapsule, cmd, OparationType.Update, Database); AddOutputParameter(cmd); try { returnCode = Database.ExecuteNonQuery(cmd); } catch (Exception ex) { throw GetDataAccessException(ex, SourceOfException("Update")); } } return(returnCode); }
protected void ddlRoleType_SelectedIndexChanged(object sender, EventArgs e) { long roleID = ddlRoleType.SelectedIndex > 0 ? long.Parse(ddlRoleType.SelectedValue) : -99; ALRD_SecurityRoleDetailEntity entity = new ALRD_SecurityRoleDetailEntity { RoleID = roleID }; LoadEntityList(entity); }
public static void FillParameters(ALRD_SecurityRoleDetailEntity entity, DbCommand cmd, Database Database, bool forDelete = false) { if (entity.COMPID.HasValue) { Database.AddInParameter(cmd, "@COMPID", DbType.Int64, entity.COMPID); } if (forDelete) { return; } if (entity.RoleID.HasValue) { Database.AddInParameter(cmd, "@RoleID", DbType.Int64, entity.RoleID); } if (entity.FormID.HasValue) { Database.AddInParameter(cmd, "@FormID", DbType.Int64, entity.FormID); } if (entity.CanInsert.HasValue) { Database.AddInParameter(cmd, "@CanInsert", DbType.Boolean, entity.CanInsert); } if (entity.CanUpdate.HasValue) { Database.AddInParameter(cmd, "@CanUpdate", DbType.Boolean, entity.CanUpdate); } if (entity.CanDelete.HasValue) { Database.AddInParameter(cmd, "@CanDelete", DbType.Boolean, entity.CanDelete); } if (entity.IsVisible.HasValue) { Database.AddInParameter(cmd, "@IsVisible", DbType.Boolean, entity.IsVisible); } if (entity.CreatedBy.HasValue) { Database.AddInParameter(cmd, "@CreatedBy", DbType.Int64, entity.CreatedBy); } if (entity.CreatedOn.HasValue) { Database.AddInParameter(cmd, "@CreatedOn", DbType.DateTime, entity.CreatedOn); } if (entity.UpdatedBy.HasValue) { Database.AddInParameter(cmd, "@UpdatedBy", DbType.Int64, entity.UpdatedBy); } if (entity.UpdatedOn.HasValue) { Database.AddInParameter(cmd, "@UpdatedOn", DbType.DateTime, entity.UpdatedOn); } }
public void CheckButtonPermission(Button btnSave = null, Button btnUpdate = null, Button btndelete = null, HyperLink lnkAddNew = null) { ALRD_SecurityRoleDetailEntity role = GlobalClass.UserRolePermissionEntity; if (btnSave != null && role != null) { if (role.CanInsert.HasValue && (bool)role.CanInsert) { btnSave.Visible = (bool)role.CanInsert; } else { btnSave.Visible = false; } } if (lnkAddNew != null && role != null) { if (role.CanInsert.HasValue && (bool)role.CanInsert) { lnkAddNew.Visible = (bool)role.CanInsert; } else { lnkAddNew.Visible = false; } } if (btnUpdate != null && role != null) { if (role.CanUpdate.HasValue && (bool)role.CanUpdate) { btnUpdate.Visible = (bool)role.CanUpdate; } else { btnUpdate.Visible = false; } } if (btndelete != null && role != null) { if (role.CanDelete.HasValue && (bool)role.CanDelete) { btndelete.Visible = (bool)role.CanDelete; } else { btndelete.Visible = false; } } }
private void LoadEntityList(ALRD_SecurityRoleDetailEntity entity) { bool updateMode = false; try { FormLocalDataStore = ALRD_SecurityRoleDetailService.GetService().GetAllByRoleID(entity).ToList(); if (FormLocalDataStore != null && FormLocalDataStore.Count > 0) { foreach (ALRD_SecurityRoleDetailEntity ob in FormLocalDataStore) { if (ob.COMPID.HasValue) { updateMode = true; } } } if (updateMode) { btnSave.Text = "Update"; btnSave.OnClientClick = "javascript:return validateSubmit('Do you want to update this information?');"; this.CheckButtonPermission(null, btnSave, null); } else { btnSave.Text = "Save"; btnSave.OnClientClick = "javascript:return validateSubmit('Do you want to save this information?');"; this.CheckButtonPermission(btnSave, null, null); } if (MenuLocalDataStore != null && MenuLocalDataStore.Count > 0) { this.rptMenuInfo.DataSource = MenuLocalDataStore; } else { this.rptMenuInfo.DataSource = new List <ALRD_SecurityMenuEntity>(); } this.rptMenuInfo.DataBind(); } catch (Exception ex) { Error = ex.Message; } }
private List <ALRD_SecurityRoleDetailEntity> BuiltEntityList() { List <ALRD_SecurityRoleDetailEntity> entityList = new List <ALRD_SecurityRoleDetailEntity>(); try { foreach (RepeaterItem ob in rptMenuInfo.Items) { ListView lsv = (ListView)ob.FindControl("lsvFormInfo"); if (lsv != null && lsv.Items.Count > 0) { foreach (ListViewDataItem item in lsv.Items) { ALRD_SecurityRoleDetailEntity entity = new ALRD_SecurityRoleDetailEntity(); entity.COMPID = ((TextBox)item.FindControl("txtRoleDetailID")).Text.Trim() != string.Empty ? long.Parse(((TextBox)item.FindControl("txtRoleDetailID")).Text.Trim()) : (long?)null; entity.FormID = ((TextBox)item.FindControl("txtFormID")).Text.Trim() != string.Empty ? long.Parse(((TextBox)item.FindControl("txtFormID")).Text.Trim()) : (long?)null; entity.RoleID = ddlRoleType.SelectedIndex > 0 ? long.Parse(ddlRoleType.SelectedValue) : (long?)null; entity.IsVisible = ((CheckBox)item.FindControl("chkIsVisible")).Checked; entity.CanInsert = ((CheckBox)item.FindControl("chkCanInsert")).Checked; entity.CanUpdate = ((CheckBox)item.FindControl("chkCanUpdate")).Checked; entity.CanDelete = ((CheckBox)item.FindControl("chkCanDelete")).Checked; if (entity.COMPID.HasValue) { entity.CreatedBy = ((TextBox)item.FindControl("txtCreatedBy")).Text.Trim() != string.Empty ? long.Parse(((TextBox)item.FindControl("txtCreatedBy")).Text.Trim()) : (long?)null; entity.CreatedOn = GetDateFromString(((TextBox)item.FindControl("txtCreatedOn")).Text.Trim()); entity.UpdatedBy = GlobalClass.UserID; entity.UpdatedOn = DateTime.Now; entity.CurrentState = BaseEntity.EntityState.Changed; } else { entity.CreatedBy = GlobalClass.UserID; entity.CreatedOn = DateTime.Now; entity.CurrentState = BaseEntity.EntityState.Added; } entityList.Add(entity); } } } } catch (Exception ex) { throw ex; } return(entityList); }
long IALRD_SecurityRoleDetailDao.Delete(ALRD_SecurityRoleDetailEntity entity) { long returnCode = -99; const string SP = "alrd_securityroledetail_Delete"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { FillParameters(entity, cmd, Database, true); //FillSequrityParameters(securityCapsule, cmd, OparationType.Update, Database); AddOutputParameter(cmd); try { returnCode = Database.ExecuteNonQuery(cmd);//Convert.ToInt64(cmd.Parameters["@RETURN_KEY"].Value); } catch (Exception ex) { throw GetDataAccessException(ex, SourceOfException("Delete")); } } return(returnCode); }
long IALRD_SecurityRoleDetailDao.Add(ALRD_SecurityRoleDetailEntity entity) { long returnCode = -99; const string SP = "alrd_securityroledetail_Insert"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { FillParameters(entity, cmd, Database); //FillSequrityParameters(securityCapsule, cmd, OparationType.Save, Database); AddOutputParameter(cmd); try { returnCode = Database.ExecuteNonQuery(cmd); // GetReturnCodeFromParameter(cmd); } catch (Exception ex) { throw GetDataAccessException(ex, SourceOfException("Add")); } } return(returnCode); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { this.CheckFormPermission(this.FormID); this.CheckButtonPermission(btnSave, null, null); LoadCombo(); SearchEntity = new ALRD_SecurityRoleDetailEntity { RoleID = -99 }; FormLocalDataStore = new List <ALRD_SecurityRoleDetailEntity>(); MenuLocalDataStore = ALRD_SecurityMenuService.GetService().GetAll(new ALRD_SecurityMenuEntity()).ToList(); LoadEntityList(SearchEntity); } } catch (Exception ex) { Error = ex.Message; } }
IList <ALRD_SecurityRoleDetailEntity> IALRD_SecurityRoleDetailDao.GetAllByRoleID(ALRD_SecurityRoleDetailEntity entity) { try { const string SP = "alrd_securityroledetail_GetAllByRoleID"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { if (entity.RoleID.HasValue) { Database.AddInParameter(cmd, "@RoleID", DbType.Int64, entity.RoleID); } IList <ALRD_SecurityRoleDetailEntity> itemList = new List <ALRD_SecurityRoleDetailEntity>(); using (IDataReader reader = Database.ExecuteReader(cmd)) { while (reader.Read()) { itemList.Add(new ALRD_SecurityRoleDetailEntity(reader)); } } return(itemList); } } catch (Exception ex) { throw GetDataAccessException(ex, SourceOfException("GetAll")); } }