private void SaveAndLoadUserSelectedPreferences() { DataTable dtPreference = new DataTable(); Label RoleId=new Label(); Label RoleName = new Label(); Label CompanyId = new Label(); Label CompanyName = new Label(); Label DeptId = new Label(); Label DeptName = new Label(); for (int i = 0; i < grdCompanyRoleasp.Rows.Count; i++) { if (grdCompanyRoleasp.Rows[i].FindControl("rbCompanyRole") != null) { if (((RadioButton)grdCompanyRoleasp.Rows[i].Cells[0].FindControl("rbCompanyRole")).Checked) { RoleId = (Label)grdCompanyRoleasp.Rows[i].Cells[6].FindControl("lblroleid"); RoleName = (Label)grdCompanyRoleasp.Rows[i].Cells[4].FindControl("lblrolename"); CompanyId = (Label)grdCompanyRoleasp.Rows[i].Cells[5].FindControl("lblcmpid"); CompanyName = (Label)grdCompanyRoleasp.Rows[i].Cells[1].FindControl("lblcmpname"); DeptId = (Label)grdCompanyRoleasp.Rows[i].Cells[7].FindControl("lbldeptid"); DeptName = (Label)grdCompanyRoleasp.Rows[i].Cells[3].FindControl("lbldeptname"); objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization]; objAuthorizationDal = new AuthorizationDal(); int Result = objAuthorizationDal.UpdateUserDefaultPreference(objAuthorizationBDto.UserProfile.UserId, int.Parse(CompanyId.Text),int.Parse(RoleId.Text),int.Parse(DeptId.Text)); } } } dtPreference = objAuthorizationDal.PreferenceGridByUserId(objAuthorizationBDto.UserProfile.UserId).Tables[0]; if (objAuthorizationBDto != null) objAuthorizationBDto.SetUserSelectedPreferences(dtPreference, int.Parse(CompanyId.Text), CompanyName.Text, int.Parse(RoleId.Text), RoleName.Text,int.Parse(DeptId.Text),DeptName.Text); }
private void SaveAndLoadUserSelectedPreferences() { int RoleId = 0; int CompanyId = 0; int DeptId = 0; string RoleName = string.Empty; string CompanyName = string.Empty; string DeptName = string.Empty; for (int i = 0; i < grdCompanyRole.Items.Count; i++) { if (grdCompanyRole.Items[i].FindControl("rbCompanyRole") != null) { if (((RadioButton)grdCompanyRole.Items[i].FindControl("rbCompanyRole")).Checked) { RoleId = Convert.ToInt32(grdCompanyRole.Items[i]["ROLE_ID"].Text.Trim()); RoleName = grdCompanyRole.Items[i]["ROLE_NAME"].Text.Trim(); CompanyId = Convert.ToInt32(grdCompanyRole.Items[i]["COMPANY_ID"].Text.Trim()); CompanyName = grdCompanyRole.Items[i]["COMPANY_NAME"].Text.Trim(); DeptId = Convert.ToInt32(grdCompanyRole.Items[i]["DEPARTMENT_ID"].Text.Trim()); DeptName = grdCompanyRole.Items[i]["DEPARTMENT_NAME"].Text.Trim(); //objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization]; if (objAuthorizationBDto != null) objAuthorizationBDto.SetUserSelectedPreferences(CompanyId, CompanyName, RoleId, RoleName, DeptId, DeptName); objAuthorizationDal = new AuthorizationDal(); int Result = objAuthorizationDal.UpdateUserDefaultPreference(objAuthorizationBDto.UserProfile.UserId, CompanyId, RoleId,DeptId); } } } }