protected void GetUserGroupById(string userGroupId) { UserGroupBLL userGroup = new UserGroupBLL(); try { DataTable dt = userGroup.GetUserGroupById(userGroupId); if (dt.Rows.Count > 0) { userGroupNameLabel.Text = dt.Rows[0]["UserGroupName"].ToString(); descriptionLabel.Text = dt.Rows[0]["Description"].ToString(); } else { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { userGroup = null; } }
protected void saveButton_Click(object sender, EventArgs e) { UserGroupBLL userGroup = new UserGroupBLL(); try { if (userGroupNameTextBox.Text == "") { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User Group Name field is required."; } else if (descriptionTextBox.Text == "") { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; } else { userGroup.UserGroupName = userGroupNameTextBox.Text.Trim(); userGroup.Description = descriptionTextBox.Text.Trim(); if (!userGroup.CheckDuplicateUserGroup(userGroup.UserGroupName.Trim())) { DataTable dt = userGroup.SaveUserGroup(); if (dt.Rows.Count > 0) { // MyAlertBox("alert(\"User Group Created Successfully with User Group ID: " + dt.Rows[0][0].ToString() + " \"); window.location=\"/HRUI/UserGroup/List.aspx\""); string message = " <span class='actionTopic'>" + " User Group Created Successfully with User Group ID: " + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox("var callbackOk = function () { window.location = \"/setting/UserGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Failed to Create User Group!!!"; msgDetailLabel.Text = ""; } } else { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This User Group already exist, try another one."; } } } catch (Exception ex) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { userGroup = null; } }
protected void deactivateLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; UserGroupBLL userGroup = new UserGroupBLL(); userGroup.UpdateUserGroupActivation(userGroupListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); // MyAlertBox("alert(\"User Group Deactivated Successfully.\"); window.location=\"/HRUI/UserGroup/List.aspx\""); GetUserGroupList(); string message = " <span class='actionTopic'>" + " User Group Deactivated Successfully.</span>."; MyAlertBox("var callbackOk = function () { window.location = \"/setting/UserGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } catch (Exception ex) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } }
protected void GetUserGroupList() { UserGroupBLL userGroup = new UserGroupBLL(); try { DataTable dt = userGroup.GetUserGroupList(); userGroupListGridView.DataSource = dt; userGroupListGridView.DataBind(); gridviewStyleSet(); if (dt.Rows.Count < 1) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { userGroup = null; } }
protected void updateButton_Click(object sender, EventArgs e) { UserGroupBLL userGroup = new UserGroupBLL(); try { if (userGroupIdForUpdateHiddenField.Value.Trim() == "") { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "User Group not found to update."; } else if (userGroupNameTextBox.Text == "") { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User Group Name field is required."; } else if (descriptionTextBox.Text == "") { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; } else { userGroup.UserGroupId = userGroupIdForUpdateHiddenField.Value.Trim(); userGroup.UserGroupName = userGroupNameTextBox.Text.Trim(); userGroup.Description = descriptionTextBox.Text.Trim(); if (!userGroup.CheckDuplicateUserGroup(userGroupNameTextBox.Text.Trim())) { userGroup.UpdateUserGroup(); userGroupNameForUpdateHiddenField.Value = ""; userGroupIdForUpdateHiddenField.Value = ""; string message = " <span class='actionTopic'>" + " User Group Updated Successfully</span>."; MyAlertBox("var callbackOk = function () { window.location = \"/setting/UserGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { if (userGroupNameForUpdateHiddenField.Value == userGroupNameTextBox.Text.Trim()) { userGroup.UserGroupName = "WithOut"; userGroup.UpdateUserGroup(); userGroupNameForUpdateHiddenField.Value = ""; userGroupIdForUpdateHiddenField.Value = ""; //MyAlertBox("alert(\"User Group Updated Successfully.\"); window.location=\"/HRUI/UserGroup/List.aspx\""); string message = " <span class='actionTopic'>" + " User Group Updated Successfully.</span>."; MyAlertBox("var callbackOk = function () { window.location = \"/setting/UserGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This User Group already exist, try another one."; } } } } catch (Exception ex) { msgbox.Attributes.Add("Class", "alert alert-warning"); msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { userGroup = null; } }
private void LoadUserGroups() { try { UserGroupBLL usergroupbll = new UserGroupBLL(); DataTable dt = usergroupbll.GetActiveUserGroupList(); drpdownGroup.DataTextField = "UserGroupName"; drpdownGroup.DataValueField = "UserGroupId"; drpdownGroup.DataSource = dt; drpdownGroup.DataBind(); drpdownGroup.Items.Insert(0, "Select Group"); drpdownGroup.SelectedIndex = 0; drpdownGroup.Items[0].Value = ""; } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
protected void LoadUserGroups() { UserGroupBLL userGroup = new UserGroupBLL(); try { DataTable dt = userGroup.GetActiveUserGroupList(); drpdownGroup.DataSource = dt; drpdownGroup.DataValueField = "UserGroupId"; drpdownGroup.DataTextField = "UserGroupName"; drpdownGroup.DataBind(); drpdownGroup.Items.Insert(0, "----------Select----------"); drpdownGroup.SelectedIndex = 0; } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; msgbox.Attributes.Add("Class", "alert alert-warning"); } finally { userGroup = null; } }
public void UpdateUserGroup(UserGroupBLL userGroup, LumexDBPlayer db) { try { db.AddParameters("@UserGroupId", userGroup.UserGroupId.Trim()); db.AddParameters("@UserGroupName", userGroup.UserGroupName.Trim()); db.AddParameters("@Description", userGroup.Description.Trim()); db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId")); db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal()); db.AddParameters("@GroupOrder","1"); db.ExecuteNonQuery("UPDATE_USER_GROUP_BY_ID", true); } catch (Exception) { throw; } finally { userGroup = null; } }
public DataTable SaveUserGroup(UserGroupBLL userGroup, LumexDBPlayer db) { try { db.AddParameters("@UserGroupName", userGroup.UserGroupName.Trim()); db.AddParameters("@Description", userGroup.Description.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId")); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); db.AddParameters("@BranchId", LumexSessionManager.Get("UserBranchId")); db.AddParameters("@GroupOrder","1"); DataTable dt = db.ExecuteDataTable("INSERT_USER_GROUP", true); return dt; } catch (Exception) { throw; } finally { userGroup = null; } }
protected void LoadUserGroups() { UserGroupBLL userGroup = new UserGroupBLL(); try { DataTable dt = userGroup.GetActiveUserGroupList(); userGroupDropDownList.DataSource = dt; userGroupDropDownList.DataValueField = "UserGroupId"; userGroupDropDownList.DataTextField = "UserGroupName"; userGroupDropDownList.DataBind(); userGroupDropDownList.Items.Insert(0, "--Select Group--"); userGroupDropDownList.SelectedIndex = 1; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "User Group Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { userGroup = null; } }