Esempio n. 1
0
        private void LoadData()
        {
            userAccountMaintBL = new UserAccountMaintBL();
            DataSet gridData = userAccountMaintBL.GetData(string.Empty, out errorId);

            userAccountMaintBL = null;

            if (gridData.Tables.Count != 0 && errorId != 2)
            {
                dtResponsibilityList = gridData.Tables[0];
                dtRoleList           = gridData.Tables[1];
                dtPaymentRoleList    = gridData.Tables[2];
                Session["FuzzyUserMaintUserList"] = gridData.Tables[3];

                Session["UserAccountResponsibility"] = dtResponsibilityList;
                ddlResponsibilityAdd.DataSource      = dtResponsibilityList;
                ddlResponsibilityAdd.DataTextField   = "responsibility_desc";
                ddlResponsibilityAdd.DataValueField  = "responsibility_code";
                ddlResponsibilityAdd.DataBind();
                ddlResponsibilityAdd.Items.Insert(0, new ListItem("-"));

                Session["UserAccountRole"] = dtRoleList;
                ddlroleAdd.DataSource      = dtRoleList;
                ddlroleAdd.DataTextField   = "role_desc";
                ddlroleAdd.DataValueField  = "role_id";
                ddlroleAdd.DataBind();
                ddlroleAdd.Items.Insert(0, new ListItem("-"));

                Session["UserAccountPaymentRole"] = dtPaymentRoleList;
                ddlPaymentRoleAdd.DataSource      = dtPaymentRoleList;
                ddlPaymentRoleAdd.DataTextField   = "role_desc";
                ddlPaymentRoleAdd.DataValueField  = "role_id";
                ddlPaymentRoleAdd.DataBind();
                ddlPaymentRoleAdd.Items.Insert(0, new ListItem("-"));

                if (gridData.Tables[4].Rows.Count == 0)
                {
                    gvUserAccount.DataSource    = gridData.Tables[4];
                    gvUserAccount.EmptyDataText = "No data found";
                    gvUserAccount.DataBind();
                }
                else
                {
                    Session["UserAccountData"] = gridData.Tables[4];
                    gvUserAccount.DataSource   = gridData.Tables[4];
                    gvUserAccount.DataBind();
                }
            }
            else if (gridData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvUserAccount.DataSource    = dtEmpty;
                gvUserAccount.EmptyDataText = "No data found";
                gvUserAccount.DataBind();
            }
            else
            {
                ExceptionHandler("Error in loading grid data.", string.Empty);
            }
        }
Esempio n. 2
0
        private void UserSelected()
        {
            //WUIN-746 clearing sort hidden files
            hdnSortExpression.Value = string.Empty;
            hdnSortDirection.Value  = string.Empty;

            hdnChangeNotSaved.Value         = "N";
            hdnGridRowSelectedPrvious.Value = "";
            hdnChangeNotSavedAdd.Value      = "N";
            if (txtUserSearch.Text != string.Empty && (txtUserSearch.Text == "No results found" || hdnUserSearchSelected.Value == "N"))
            {
                msgView.SetMessage("Please select a valid user from the list", MessageType.Warning, PositionType.Auto);
                txtUserSearch.Text = string.Empty;
                return;
            }

            userAccountMaintBL = new UserAccountMaintBL();
            DataSet gridData = userAccountMaintBL.GetData(txtUserSearch.Text == string.Empty ? string.Empty : txtUserSearch.Text.Split('-')[1].ToString().Trim(), out errorId);

            userAccountMaintBL = null;

            if (gridData.Tables.Count != 0 && errorId != 2)
            {
                dtResponsibilityList = gridData.Tables[0];
                dtRoleList           = gridData.Tables[1];
                dtPaymentRoleList    = gridData.Tables[2];
                Session["FuzzyUserMaintUserList"] = gridData.Tables[3];

                if (gridData.Tables[4].Rows.Count == 0)
                {
                    gvUserAccount.DataSource    = gridData.Tables[4];
                    gvUserAccount.EmptyDataText = "No data found";
                    gvUserAccount.DataBind();
                }
                else
                {
                    gvUserAccount.DataSource = gridData.Tables[4];
                    gvUserAccount.DataBind();
                }
            }
            else if (gridData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvUserAccount.DataSource    = dtEmpty;
                gvUserAccount.EmptyDataText = "No data found for the selected filter criteria";
                gvUserAccount.DataBind();
            }
            else
            {
                ExceptionHandler("Error in loading grid data", string.Empty);
            }
        }
Esempio n. 3
0
        protected void btnReset_Click(object sender, EventArgs e)
        {
            hdnSortExpression.Value         = string.Empty;
            hdnSortDirection.Value          = string.Empty;
            hdnChangeNotSaved.Value         = "N";
            hdnGridRowSelectedPrvious.Value = "";
            hdnChangeNotSavedAdd.Value      = "N";
            ClearAddFields();
            txtUserSearch.Text = string.Empty;


            userAccountMaintBL = new UserAccountMaintBL();
            DataSet gridData = userAccountMaintBL.GetData(string.Empty, out errorId);

            userAccountMaintBL = null;

            if (gridData.Tables.Count != 0 && errorId != 2)
            {
                dtResponsibilityList = gridData.Tables[0];
                dtRoleList           = gridData.Tables[1];
                dtPaymentRoleList    = gridData.Tables[2];
                Session["FuzzyUserMaintUserList"] = gridData.Tables[3];

                if (gridData.Tables[4].Rows.Count == 0)
                {
                    gvUserAccount.DataSource    = gridData.Tables[4];
                    gvUserAccount.EmptyDataText = "No data found";
                    gvUserAccount.DataBind();
                }
                else
                {
                    gvUserAccount.DataSource = gridData.Tables[4];
                    gvUserAccount.DataBind();
                }
            }
            else if (gridData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvUserAccount.DataSource    = dtEmpty;
                gvUserAccount.EmptyDataText = "No data found";
                gvUserAccount.DataBind();
            }
            else
            {
                ExceptionHandler("Error in loading grid data.", string.Empty);
            }
        }
Esempio n. 4
0
        protected void btnRespUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                userAccountMaintBL = new UserAccountMaintBL();
                userAccountMaintBL.UpdateRespChanges(Convert.ToInt32(ddlRespToReplace.SelectedValue), Convert.ToInt32(hdnNewResp.Value), Convert.ToString(Session["UserCode"]), out errorId);
                userAccountMaintBL = null;

                if (errorId != 2)
                {
                    mpeRespUpdate.Hide();
                }
                else
                {
                    ExceptionHandler("Error in updating responsibility changes", string.Empty);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in updating responsibility changes", ex.Message);
            }
        }
Esempio n. 5
0
        protected void btnUpdate_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                hdnChangeNotSaved.Value         = "N";
                hdnGridRowSelectedPrvious.Value = "";
                hdnChangeNotSavedAdd.Value      = "N";

                ImageButton btnUpdate         = (ImageButton)sender;
                GridViewRow gvr               = ((ImageButton)sender).NamingContainer as GridViewRow;
                string      userAccIdToUpdate = (gvr.FindControl("hdnUserAccId") as HiddenField).Value;
                string      userCodeToUpdate  = (gvr.FindControl("hdnUserCode") as HiddenField).Value;
                string      respCodeToUpdate  = (gvr.FindControl("hdnRespCode") as HiddenField).Value;
                string      userName          = (gvr.FindControl("txtUserName") as TextBox).Text;
                string      userCode          = (gvr.FindControl("txtUserCode") as TextBox).Text;
                string      userAccId         = (gvr.FindControl("txtUserAccId") as TextBox).Text;
                string      respCode          = (gvr.FindControl("ddlResponsibility") as DropDownList).SelectedValue;
                string      roleId            = (gvr.FindControl("ddlrole") as DropDownList).SelectedValue;
                string      paymentRoleId     = (gvr.FindControl("ddlPaymentRole") as DropDownList).SelectedValue;
                string      isActive          = (gvr.FindControl("cbActive") as CheckBox).Checked == true ? "Y" : string.Empty;

                userAccountMaintBL = new UserAccountMaintBL();
                DataSet gridData = userAccountMaintBL.UpdateUserAccount(userAccIdToUpdate, userCodeToUpdate, respCodeToUpdate, userName, userCode, userAccId, respCode, roleId, paymentRoleId, isActive,
                                                                        txtUserSearch.Text == string.Empty ? string.Empty : txtUserSearch.Text.Split('-')[1].ToString().Trim(), Convert.ToString(Session["UserCode"]), out errorId);
                userAccountMaintBL = null;

                if (errorId == 1)
                {
                    msgView.SetMessage("User account alredy exists", MessageType.Warning, PositionType.Auto);
                    return;
                }

                if (gridData.Tables.Count != 0 && errorId != 2)
                {
                    dtResponsibilityList = gridData.Tables[0];
                    dtRoleList           = gridData.Tables[1];
                    dtPaymentRoleList    = gridData.Tables[2];
                    Session["FuzzyUserMaintUserList"] = gridData.Tables[3];

                    if (gridData.Tables[4].Rows.Count == 0)
                    {
                        gvUserAccount.DataSource    = gridData.Tables[4];
                        gvUserAccount.EmptyDataText = "No data found";
                        gvUserAccount.DataBind();
                    }
                    else
                    {
                        gvUserAccount.DataSource = gridData.Tables[4];
                        gvUserAccount.DataBind();
                    }

                    if (respCodeToUpdate != respCode)
                    {
                        txtNewResp.Text  = (gvr.FindControl("ddlResponsibility") as DropDownList).SelectedItem.Text;
                        hdnNewResp.Value = (gvr.FindControl("ddlResponsibility") as DropDownList).SelectedValue;

                        ddlRespToReplace.DataSource     = dtResponsibilityList;
                        ddlRespToReplace.DataTextField  = "responsibility_desc";
                        ddlRespToReplace.DataValueField = "responsibility_code";
                        ddlRespToReplace.DataBind();
                        ddlRespToReplace.Items.Insert(0, new ListItem("-"));

                        mpeRespUpdate.Show();
                    }


                    ddlResponsibilityAdd.DataSource     = dtResponsibilityList;
                    ddlResponsibilityAdd.DataTextField  = "responsibility_desc";
                    ddlResponsibilityAdd.DataValueField = "responsibility_code";
                    ddlResponsibilityAdd.DataBind();
                    ddlResponsibilityAdd.Items.Insert(0, new ListItem("-"));

                    ddlroleAdd.DataSource     = dtRoleList;
                    ddlroleAdd.DataTextField  = "role_desc";
                    ddlroleAdd.DataValueField = "role_id";
                    ddlroleAdd.DataBind();
                    ddlroleAdd.Items.Insert(0, new ListItem("-"));
                }
                else if (gridData.Tables.Count == 0 && errorId != 2)
                {
                    dtEmpty = new DataTable();
                    gvUserAccount.DataSource    = dtEmpty;
                    gvUserAccount.EmptyDataText = "No data found";
                    gvUserAccount.DataBind();
                }
                else
                {
                    ExceptionHandler("Error in updating user", string.Empty);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in updating user", ex.Message);
            }

            ClearAddFields();
        }
Esempio n. 6
0
        //JIRA-746 CHanges by Ravi on 05/03/2019 -- End

        protected void btnAdd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                hdnChangeNotSaved.Value         = "N";
                hdnGridRowSelectedPrvious.Value = "";
                hdnChangeNotSavedAdd.Value      = "N";
                //WUIN-746 clearing sort hidden files
                hdnSortExpression.Value = string.Empty;
                hdnSortDirection.Value  = string.Empty;


                userAccountMaintBL = new UserAccountMaintBL();
                DataSet gridData = userAccountMaintBL.AddUserAccount(txtUserNameAdd.Text.Trim(), txtUserCodeAdd.Text.Trim(), txtUserAccIdAdd.Text.Trim(),
                                                                     ddlResponsibilityAdd.SelectedValue, ddlroleAdd.SelectedValue, ddlPaymentRoleAdd.SelectedValue, cbActiveAdd.Checked == true ? "Y" : string.Empty,
                                                                     txtUserSearch.Text == string.Empty ? string.Empty : txtUserSearch.Text.Split('-')[1].ToString().Trim(), Convert.ToString(Session["UserCode"]), out errorId);
                userAccountMaintBL = null;

                if (errorId == 1)
                {
                    msgView.SetMessage("User account alredy exists", MessageType.Warning, PositionType.Auto);
                    return;
                }

                if (gridData.Tables.Count != 0 && errorId != 2)
                {
                    dtResponsibilityList = gridData.Tables[0];
                    dtRoleList           = gridData.Tables[1];
                    dtPaymentRoleList    = gridData.Tables[2];
                    Session["FuzzyUserMaintUserList"] = gridData.Tables[3];

                    if (gridData.Tables[4].Rows.Count == 0)
                    {
                        gvUserAccount.DataSource    = gridData.Tables[4];
                        gvUserAccount.EmptyDataText = "No data found";
                        gvUserAccount.DataBind();
                    }
                    else
                    {
                        gvUserAccount.DataSource = gridData.Tables[4];
                        gvUserAccount.DataBind();
                    }

                    txtNewResp.Text  = ddlResponsibilityAdd.SelectedItem.Text;
                    hdnNewResp.Value = ddlResponsibilityAdd.SelectedValue;

                    ddlResponsibilityAdd.DataSource     = dtResponsibilityList;
                    ddlResponsibilityAdd.DataTextField  = "responsibility_desc";
                    ddlResponsibilityAdd.DataValueField = "responsibility_code";
                    ddlResponsibilityAdd.DataBind();
                    ddlResponsibilityAdd.Items.Insert(0, new ListItem("-"));

                    ddlroleAdd.DataSource     = dtRoleList;
                    ddlroleAdd.DataTextField  = "role_desc";
                    ddlroleAdd.DataValueField = "role_id";
                    ddlroleAdd.DataBind();
                    ddlroleAdd.Items.Insert(0, new ListItem("-"));

                    ddlRespToReplace.DataSource     = dtResponsibilityList;
                    ddlRespToReplace.DataTextField  = "responsibility_desc";
                    ddlRespToReplace.DataValueField = "responsibility_code";
                    ddlRespToReplace.DataBind();
                    ddlRespToReplace.Items.Insert(0, new ListItem("-"));

                    ClearAddFields();

                    mpeRespUpdate.Show();
                }
                else if (gridData.Tables.Count == 0 && errorId != 2)
                {
                    dtEmpty = new DataTable();
                    gvUserAccount.DataSource    = dtEmpty;
                    gvUserAccount.EmptyDataText = "No data found";
                    gvUserAccount.DataBind();

                    ClearAddFields();
                }
                else
                {
                    ExceptionHandler("Error in adding user", string.Empty);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in adding user", ex.Message);
            }
        }