protected void lkbEditLeaveAssingedByRole_Click(object sender, EventArgs e) { ddlRole.Items.Clear(); ddlRole.Items.Add("select"); ddlLeave.Items.Clear(); ddlLeave.Items.Add("select"); ddlRole1.DataSource = GiveAllRole(); ddlRole1.DataTextField = "Name"; ddlRole1.DataValueField = "Id"; ddlRole1.DataBind(); ddlLeaveEdit.DataSource = GetAllLeaves(); ddlLeaveEdit.DataTextField = "LeaveName"; ddlLeaveEdit.DataValueField = "Id"; ddlLeaveEdit.DataBind(); MasterEntries objMasterEntry = new MasterEntries(); LinkButton b = (LinkButton)sender; int Id = Convert.ToInt32(b.CommandArgument); string roleName = objMasterEntry.GetRoleById(Id); LeaveAssignedByRole objLeaves = new LeaveAssignedByRole(); objMasterEntry.GetLeavesAssignedByRoleById(Id, out objLeaves); txtNoOfLeave.Text = objLeaves.NoOfLeaves.ToString(); ddlIsPromotedEdit.SelectedIndex = Convert.ToInt32(objLeaves.IsPromoted); ddlRole1.SelectedIndex = Convert.ToInt32(objLeaves.RoleId); ddlLeaveEdit.SelectedIndex = Convert.ToInt32(objLeaves.LeaveTypeId); ddlRole1.Enabled = false; ddlLeaveEdit.Enabled = false; Session["Id"] = Id; popupEditLeaveAssignedByRole.Show(); }
public List <LeaveAssignedByRole> GetAllTypeOfLeavesAssignedByRole() { DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; DataTable dt = new DataTable(); DataSet ds; int i = 0; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet("spGetAllTypeOfLeavesAssignedByRole", SQLTextType.Stored_Proc); List <LeaveAssignedByRole> lstLeaveType = new List <LeaveAssignedByRole>(); foreach (DataRow rows in ds.Tables[0].Rows) { LeaveAssignedByRole objLeaves = new LeaveAssignedByRole(); objLeaves.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); objLeaves.RoleId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); objLeaves.LeaveTypeId = Convert.ToInt32(ds.Tables[0].Rows[i][2]); objLeaves.NoOfLeaves = Convert.ToInt32(ds.Tables[0].Rows[i][3]); objLeaves.IsPromoted = Convert.ToBoolean(ds.Tables[0].Rows[i][4]); objLeaves.RoleName = (ds.Tables[0].Rows[i][5]).ToString(); objLeaves.LeaveName = (ds.Tables[0].Rows[i][6]).ToString(); lstLeaveType.Add(objLeaves); i++; } return(lstLeaveType); } }
public bool GetLeavesAssignedByRoleById(int id, out LeaveAssignedByRole objLeaves) { DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; List <SqlParameter> lstparameter = new List <SqlParameter>(); lstparameter.Add(new SqlParameter("@id", id)); DataTable dt = new DataTable(); DataSet ds; int i = 0; string query = "Select * from tblLeaveAssignedByRole where Id = @id"; LeaveAssignedByRole objLeaves1 = new LeaveAssignedByRole(); using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstparameter); List <LeaveAssignedByRole> lstLeaveType = new List <LeaveAssignedByRole>(); Leaves objLeave = new Leaves(); foreach (DataRow rows in ds.Tables[0].Rows) { objLeaves1.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); objLeaves1.RoleId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); objLeaves1.LeaveTypeId = Convert.ToInt32(ds.Tables[0].Rows[i][2]); objLeaves1.NoOfLeaves = Convert.ToInt32(ds.Tables[0].Rows[i][3]); objLeaves1.IsPromoted = Convert.ToBoolean(ds.Tables[0].Rows[i][4]); GetLeavesById(objLeaves1.LeaveTypeId, out objLeave); objLeaves1.LeaveName = objLeave.LeaveName; objLeaves1.RoleName = GetRoleById(objLeaves1.RoleId); lstLeaveType.Add(objLeaves1); i++; } objLeaves = objLeaves1; return(true); } }
public List<LeaveAssignedByRole> GetAllTypeOfLeavesAssignedByRole() { DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; DataTable dt = new DataTable(); DataSet ds; int i = 0; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet("spGetAllTypeOfLeavesAssignedByRole", SQLTextType.Stored_Proc); List<LeaveAssignedByRole> lstLeaveType = new List<LeaveAssignedByRole>(); foreach (DataRow rows in ds.Tables[0].Rows) { LeaveAssignedByRole objLeaves = new LeaveAssignedByRole(); objLeaves.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); objLeaves.RoleId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); objLeaves.LeaveTypeId = Convert.ToInt32(ds.Tables[0].Rows[i][2]); objLeaves.NoOfLeaves = Convert.ToInt32(ds.Tables[0].Rows[i][3]); objLeaves.IsPromoted = Convert.ToBoolean(ds.Tables[0].Rows[i][4]); objLeaves.RoleName = (ds.Tables[0].Rows[i][5]).ToString(); objLeaves.LeaveName = (ds.Tables[0].Rows[i][6]).ToString(); lstLeaveType.Add(objLeaves); i++; } return lstLeaveType; } }
public bool GetLeavesAssignedByRoleById(int id, out LeaveAssignedByRole objLeaves) { DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; List<SqlParameter> lstparameter = new List<SqlParameter>(); lstparameter.Add(new SqlParameter("@id", id)); DataTable dt = new DataTable(); DataSet ds; int i = 0; string query = "Select * from tblLeaveAssignedByRole where Id = @id"; LeaveAssignedByRole objLeaves1 = new LeaveAssignedByRole(); using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstparameter); List<LeaveAssignedByRole> lstLeaveType = new List<LeaveAssignedByRole>(); Leaves objLeave = new Leaves(); foreach (DataRow rows in ds.Tables[0].Rows) { objLeaves1.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); objLeaves1.RoleId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); objLeaves1.LeaveTypeId = Convert.ToInt32(ds.Tables[0].Rows[i][2]); objLeaves1.NoOfLeaves = Convert.ToInt32(ds.Tables[0].Rows[i][3]); objLeaves1.IsPromoted = Convert.ToBoolean(ds.Tables[0].Rows[i][4]); GetLeavesById(objLeaves1.LeaveTypeId, out objLeave); objLeaves1.LeaveName = objLeave.LeaveName; objLeaves1.RoleName = GetRoleById(objLeaves1.RoleId); lstLeaveType.Add(objLeaves1); i++; } objLeaves = objLeaves1; return true; } }