protected void btnsave_Click(object sender, EventArgs e) { if (FieldValidations() == false) { return; } int UserGroupID = 0; int Flag = 0; int EditCareEnd = 0; int PIdentifiers = 0; DataSet theDS = new DataSet(); IUserRole UserRoleManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration"); try { if (Request.QueryString["name"] == "Add") { GroupId = 0; int EnrollmentPrivilage = 1; theDS = FacilityServiceUserGroupData(out EditCareEnd, out PIdentifiers); int CareEndPrivilage = EditCareEnd; int EditIdentifierPrivilage = PIdentifiers; if (theDS.Tables[0].Rows.Count <= 0 && CareEndPrivilage == 0 && EditIdentifierPrivilage == 0) { IQCareMsgBox.Show("BlankRow", this); return; } UserGroupID = (int)UserRoleManager.SaveUserGroupDetail(GroupId, txtusergroupname.Text, theDS, Convert.ToInt32(Session["AppUserId"].ToString()), Flag, EnrollmentPrivilage, CareEndPrivilage, EditIdentifierPrivilage); if (UserGroupID == 0) { IQCareMsgBox.Show("UserGroupDetailExists", this); return; } else { IQCareMsgBox.Show("UserGroupDetailSave", this); } } else if (Request.QueryString["name"] == "Edit") { int EnrollmentPrivilage = 1; GroupId = Convert.ToInt32(Request.QueryString["GroupID"]); Flag = 1; theDS = FacilityServiceUserGroupData(out EditCareEnd, out PIdentifiers); int CareEndPrivilage = EditCareEnd; int EditIdentifierPrivilage = PIdentifiers; if (theDS.Tables[0].Rows.Count <= 0 && theDS.Tables[1].Rows.Count <= 0 && theDS.Tables[2].Rows.Count <= 0) { IQCareMsgBox.Show("BlankRow", this); return; } UserRoleManager.UpdateUserGroup(GroupId, txtusergroupname.Text, theDS, Convert.ToInt32(Session["AppUserId"].ToString()), Flag, EnrollmentPrivilage, CareEndPrivilage, EditIdentifierPrivilage); IQCareMsgBox.Show("UserGroupDetailUpdate", this); } string theUrl = "frmAdmin_UserGroupList.aspx"; Response.Redirect(theUrl); } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } finally { UserRoleManager = null; } }
protected void btnsave_Click(object sender, EventArgs e) { if (FieldValidations() == false) { return; } int UserGroupID = 0; int Flag = 0; DataSet theDS = new DataSet(); IUserRole UserRoleManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration"); try { if (Request.QueryString["name"] == "Add") { GroupId = 0; CheckBox chkSelectAll = (CheckBox)grdUserGroupsForm.HeaderRow.Cells[0].FindControl("chkFormAll"); CheckBox chkSelectAllOther = (CheckBox)grdUserGroupsOther.HeaderRow.Cells[0].FindControl("chkOtherAll"); CheckBox chkSelectAllForms = (CheckBox)grdUserGroupAdminForm.HeaderRow.Cells[0].FindControl("chkAllForm"); theDS = UserGroupData(); if (theDS.Tables[0].Rows.Count <= 0 && theDS.Tables[1].Rows.Count <= 0 && theDS.Tables[2].Rows.Count <= 0) { IQCareMsgBox.Show("BlankRow", this); return; } int EnrollmentPrivilage = chkspenroll.Checked == true ? 1 : 0; int CareEndPrivilage = chkCareEndPrivilege.Checked == true ? 1 : 0; int EditIdentifierPrivilage = chkpatientIdentifiers.Checked == true ? 1 : 0; UserGroupID = (int)UserRoleManager.SaveUserGroupDetail(GroupId, txtusergroupname.Text, theDS, Convert.ToInt32(Session["AppUserId"].ToString()), Flag, EnrollmentPrivilage, CareEndPrivilage, EditIdentifierPrivilage); if (UserGroupID == 0) { IQCareMsgBox.Show("UserGroupDetailExists", this); return; } else { IQCareMsgBox.Show("UserGroupDetailSave", this); } } else if (Request.QueryString["name"] == "Edit") { int EnrollmentPrivilage = chkspenroll.Checked == true ? 1 : 0; int CareEndPrivilage = chkCareEndPrivilege.Checked == true ? 1 : 0; int EditIdentifierPrivilage = chkpatientIdentifiers.Checked == true ? 1 : 0; GroupId = Convert.ToInt32(Request.QueryString["GroupID"]); Flag = 1; if (iAllFormCount != 0) { CheckBox chkSelectAll = (CheckBox)grdUserGroupsForm.HeaderRow.Cells[0].FindControl("chkFormAll"); } if (iReportsCount != 0) { CheckBox chkSelectAllOther = (CheckBox)grdUserGroupsOther.HeaderRow.Cells[0].FindControl("chkOtherAll"); } if (iAdminCount != 0) { CheckBox chkSelectAllForms = (CheckBox)grdUserGroupAdminForm.HeaderRow.Cells[0].FindControl("chkAllForm"); } theDS = UserGroupData(); if (theDS.Tables[0].Rows.Count <= 0 && theDS.Tables[1].Rows.Count <= 0 && theDS.Tables[2].Rows.Count <= 0) { IQCareMsgBox.Show("BlankRow", this); return; } UserRoleManager.UpdateUserGroup(GroupId, txtusergroupname.Text, theDS, Convert.ToInt32(Session["AppUserId"].ToString()), Flag, EnrollmentPrivilage, CareEndPrivilage, EditIdentifierPrivilage); IQCareMsgBox.Show("UserGroupDetailUpdate", this); } string theUrl = "frmAdmin_UserGroupList.aspx"; Response.Redirect(theUrl); } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } finally { UserRoleManager = null; } }