Esempio n. 1
0
        private void LoadOwnerGridData(Int32 ownerCode)
        {
            //WUIN-746 clearing sort hidden files
            hdnSortExpression.Value = string.Empty;
            hdnSortDirection.Value  = string.Empty;

            royaltorStatementBL = new RoyaltorStatementBL();
            DataSet ownerStmtData = royaltorStatementBL.GetOwnerStmtData(ownerCode, out errorId);

            royaltorStatementBL = null;
            if (ownerStmtData.Tables.Count != 0 && errorId != 2)
            {
                //If there are royaltors, stmt periods to be added or removed then show owner record
                if (ownerStmtData.Tables[0].Rows.Count > 0)
                {
                    DataTable tempDt    = ownerStmtData.Tables[0].Copy();
                    DataView  dv        = new DataView(tempDt);
                    DataTable dtResults = dv.ToTable(true, "owner_code", "owner_name", "statement_period_id", "statement_type_code", "stmt_period", "add_owner", "remove_owner");
                    Session["RoyStmtChangesOwnerData"] = dtResults;
                    gvOwnerStmt.DataSource             = dtResults;
                    if (dtResults.Rows.Count == 0)
                    {
                        gvOwnerStmt.EmptyDataText = "No data found for the selected owner.";
                        hdnAddBtnEnable.Value     = string.Empty;
                        hdnRemoveBtnEnable.Value  = string.Empty;
                    }
                    gvOwnerStmt.DataBind();
                    Session["StmtsToBeProcessed"] = ownerStmtData.Tables[0];
                }
                else
                {
                    dtEmpty = new DataTable();
                    gvOwnerStmt.DataSource    = dtEmpty;
                    gvOwnerStmt.EmptyDataText = "No data found for the selected owner.";
                    gvOwnerStmt.DataBind();
                    hdnAddBtnEnable.Value    = string.Empty;
                    hdnRemoveBtnEnable.Value = string.Empty;
                }
            }
            else if (ownerStmtData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvOwnerStmt.DataSource    = dtEmpty;
                gvOwnerStmt.EmptyDataText = "No data found for the selected owner.";
                gvOwnerStmt.DataBind();
                hdnAddBtnEnable.Value    = string.Empty;
                hdnRemoveBtnEnable.Value = string.Empty;
            }
            else
            {
                ExceptionHandler("Error in loading grid data.", string.Empty);
            }
        }
Esempio n. 2
0
        private void LoadDropdowns()
        {
            royaltorStatementBL = new RoyaltorStatementBL();
            DataSet royaltors = royaltorStatementBL.GetRoyaltors(out errorId);

            royaltorStatementBL = null;
            if (royaltors.Tables.Count != 0 && errorId != 2)
            {
                Session["StmtChangesOwnerList"] = royaltors.Tables[0];
            }
            else if (royaltors.Tables.Count == 0 && errorId != 2)
            {
                Session["StmtChangesOwnerList"] = royaltors.Tables[0];
            }
            else
            {
                ExceptionHandler("Error in loading royaltors dropdown.", string.Empty);
            }
        }
Esempio n. 3
0
        private void LoadGridData(Int32 royaltorId)
        {
            //WUIN-746 clearing sort hidden files
            hdnSortExpression.Value = string.Empty;
            hdnSortDirection.Value  = string.Empty;

            royaltorStatementBL = new RoyaltorStatementBL();
            DataSet royStmtData = royaltorStatementBL.GetRoyStmtData(royaltorId, out errorId);

            royaltorStatementBL = null;
            if (royStmtData.Tables.Count != 0 && errorId != 2)
            {
                Session["RoyStmtChangesRoyData"] = royStmtData.Tables[0];
                gvRoyStmt.DataSource             = royStmtData.Tables[0];
                if (royStmtData.Tables[0].Rows.Count == 0)
                {
                    gvRoyStmt.EmptyDataText  = "No data found for the selected royaltor.";
                    hdnAddBtnEnable.Value    = string.Empty;
                    hdnRemoveBtnEnable.Value = string.Empty;
                }
                gvRoyStmt.DataBind();
            }
            else if (royStmtData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvRoyStmt.DataSource    = dtEmpty;
                gvRoyStmt.EmptyDataText = "No data found for the selected royaltor.";
                gvRoyStmt.DataBind();
                hdnAddBtnEnable.Value    = string.Empty;
                hdnRemoveBtnEnable.Value = string.Empty;
            }
            else
            {
                ExceptionHandler("Error in loading grid data.", string.Empty);
            }
        }
Esempio n. 4
0
        private void UpdateRoyStmtRun()
        {
            List <int> stmtsToAdd    = new List <int>();
            List <int> stmtsToRemove = new List <int>();

            CheckBox cbAdd;
            CheckBox cbRemove;
            string   stmtPeriodID;

            //loop thorugh grid and get selected list of statement ids to be add/removed
            foreach (GridViewRow row in gvRoyStmt.Rows)
            {
                cbAdd        = (CheckBox)row.FindControl("cbAdd");
                cbRemove     = (CheckBox)row.FindControl("cbRemove");
                stmtPeriodID = (row.FindControl("hdnStmtPeriodID") as Label).Text;

                if (cbAdd.Enabled == true && cbAdd.Checked == true)
                {
                    stmtsToAdd.Add(Convert.ToInt32(stmtPeriodID));
                }
                else if (cbRemove.Enabled == true && cbRemove.Checked == true)
                {
                    stmtsToRemove.Add(Convert.ToInt32(stmtPeriodID));
                }
            }

            royaltorStatementBL = new RoyaltorStatementBL();
            string loggedUserID = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString());

            royaltorId = Convert.ToInt32(txtRoyaltor.Text.Substring(0, txtRoyaltor.Text.IndexOf("-") - 1));
            DataSet royStmtData = royaltorStatementBL.UpdateRoyStmt(royaltorId.ToString(), stmtsToAdd.ToArray(), stmtsToRemove.ToArray(), loggedUserID, out errorId);

            royaltorStatementBL = null;

            //WUIN-746 clearing sort hidden files
            hdnSortExpression.Value = string.Empty;
            hdnSortDirection.Value  = string.Empty;
            if (errorId == 1)
            {
                ExceptionHandler("Error in triggering statement removal job.", string.Empty);
                return;
            }
            else if (errorId == 2)
            {
                ExceptionHandler("Error in updating data.", string.Empty);
                return;
            }
            else if (royStmtData.Tables.Count != 0)
            {
                gvRoyStmt.DataSource = royStmtData.Tables[0];
                if (royStmtData.Tables[0].Rows.Count == 0)
                {
                    gvRoyStmt.EmptyDataText  = "Data updated and no data found to display for the selected royaltor.";
                    hdnAddBtnEnable.Value    = string.Empty;
                    hdnRemoveBtnEnable.Value = string.Empty;
                }
                gvRoyStmt.DataBind();
            }
            else if (royStmtData.Tables.Count == 0)
            {
                dtEmpty = new DataTable();
                gvRoyStmt.DataSource    = dtEmpty;
                gvRoyStmt.EmptyDataText = "Data updated and no data found to display for the selected royaltor.";
                gvRoyStmt.DataBind();
                hdnAddBtnEnable.Value    = string.Empty;
                hdnRemoveBtnEnable.Value = string.Empty;
            }
            else
            {
                ExceptionHandler("Error in updating data.", string.Empty);
            }

            EnableDisableButtons();
        }
Esempio n. 5
0
        private void UpdateOwnerStmtRun()
        {
            if (gvOwnerStmt.Rows.Count > 0)
            {
                if (Session["StmtsToBeProcessed"] == null)
                {
                    ExceptionHandler("Error in updating data.", string.Empty);
                    return;
                }

                List <int> royaltors     = new List <int>();
                List <int> stmtsToAdd    = new List <int>();
                List <int> stmtsToRemove = new List <int>();

                CheckBox cbAdd;
                CheckBox cbRemove;
                string   stmtPeriodID;

                DataTable dtStmtsToBeProcessed = Session["StmtsToBeProcessed"] as DataTable;

                //foreach (DataRow dRow in dtStmtsToBeProcessed.Rows)
                //{
                //    royaltors.Add(Convert.ToInt32(dRow["royaltor_id"].ToString()));
                //    stmtsToAdd.Add(Convert.ToInt32(dRow["statement_period_id"].ToString()));
                //    stmtsToRemove.Add(Convert.ToInt32(dRow["statement_period_id"].ToString()));
                //}

                //GridViewRow gvRow = gvOwnerStmt.Rows[0];
                //if ((gvRow.FindControl("cbAdd") as CheckBox).Checked)
                //{
                //    stmtsToRemove.Clear();
                //}
                //else if ((gvRow.FindControl("cbRemove") as CheckBox).Checked)
                //{
                //    stmtsToAdd.Clear();
                //}

                //loop thorugh grid and get selected list of statement ids to be add/removed
                foreach (GridViewRow row in gvOwnerStmt.Rows)
                {
                    cbAdd        = (CheckBox)row.FindControl("cbAdd");
                    cbRemove     = (CheckBox)row.FindControl("cbRemove");
                    stmtPeriodID = (row.FindControl("hdnStmtPeriodID") as Label).Text;

                    if (cbAdd.Enabled == true && cbAdd.Checked == true)
                    {
                        //loop through the datatable to get royaltor id
                        foreach (DataRow dRow in dtStmtsToBeProcessed.Rows)
                        {
                            if (dRow["statement_period_id"].ToString() == stmtPeriodID)
                            {
                                royaltors.Add(Convert.ToInt32(dRow["royaltor_id"].ToString()));
                                stmtsToAdd.Add(Convert.ToInt32(stmtPeriodID));
                            }
                        }
                    }
                    else if (cbRemove.Enabled == true && cbRemove.Checked == true)
                    {
                        foreach (DataRow dRow in dtStmtsToBeProcessed.Rows)
                        {
                            if (dRow["statement_period_id"].ToString() == stmtPeriodID)
                            {
                                royaltors.Add(Convert.ToInt32(dRow["royaltor_id"].ToString()));
                                stmtsToRemove.Add(Convert.ToInt32(stmtPeriodID));
                            }
                        }
                    }
                }

                royaltorStatementBL = new RoyaltorStatementBL();
                string  loggedUserID  = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString());
                int     ownerCode     = Convert.ToInt32(txtOwner.Text.Substring(0, txtOwner.Text.IndexOf("-") - 1));
                DataSet ownerStmtData = royaltorStatementBL.UpdateOwnerStmt(ownerCode, royaltors.ToArray(), stmtsToAdd.ToArray(), stmtsToRemove.ToArray(), loggedUserID, out errorId);
                royaltorStatementBL = null;
                if (ownerStmtData.Tables.Count != 0 && errorId != 2)
                {
                    //WUIN-746 clearing sort hidden files
                    hdnSortExpression.Value = string.Empty;
                    hdnSortDirection.Value  = string.Empty;

                    //If there are royaltors, stmt periods to be added or removed then show owner record
                    if (ownerStmtData.Tables[0].Rows.Count > 0)
                    {
                        DataTable tempDt    = ownerStmtData.Tables[0].Copy();
                        DataView  dv        = new DataView(tempDt);
                        DataTable dtResults = dv.ToTable(true, "owner_code", "owner_name", "statement_period_id", "statement_type_code", "stmt_period", "add_owner", "remove_owner");

                        gvOwnerStmt.DataSource = dtResults;
                        if (dtResults.Rows.Count == 0)
                        {
                            gvOwnerStmt.EmptyDataText = "No data found for the selected owner.";
                            hdnAddBtnEnable.Value     = string.Empty;
                            hdnRemoveBtnEnable.Value  = string.Empty;
                        }
                        gvOwnerStmt.DataBind();
                        Session["StmtsToBeProcessed"] = ownerStmtData.Tables[0];
                    }
                    else
                    {
                        dtEmpty = new DataTable();
                        gvOwnerStmt.DataSource    = dtEmpty;
                        gvOwnerStmt.EmptyDataText = "Data updated and no data found to display for the selected owner.";
                        gvOwnerStmt.DataBind();
                        hdnAddBtnEnable.Value    = string.Empty;
                        hdnRemoveBtnEnable.Value = string.Empty;
                    }
                }
                else if (ownerStmtData.Tables.Count == 0 && errorId != 2)
                {
                    dtEmpty = new DataTable();
                    gvOwnerStmt.DataSource    = dtEmpty;
                    gvOwnerStmt.EmptyDataText = "Data updated and no data found to display for the selected owner.";
                    gvOwnerStmt.DataBind();
                    hdnAddBtnEnable.Value    = string.Empty;
                    hdnRemoveBtnEnable.Value = string.Empty;
                }
                else
                {
                    ExceptionHandler("Error in updating data.", string.Empty);
                }

                EnableDisableButtons();
            }
        }