Пример #1
0
        private void PopulateDropDowns()
        {
            roySearchBL = new RoyaltorSearchBL();
            DataSet dropdownListData = roySearchBL.GetDropdownData(out errorId);

            roySearchBL = null;

            if (dropdownListData.Tables.Count != 0 && errorId != 2)
            {
                //responsibility dropdown
                ddlResponsibility.DataTextField  = "responsibility";
                ddlResponsibility.DataValueField = "responsibility_code";
                ddlResponsibility.DataSource     = dropdownListData.Tables[0];
                ddlResponsibility.DataBind();
                ddlResponsibility.Items.Insert(0, new ListItem("-"));

                //status dropdown
                ddlStatus.DataTextField  = "status_desc";
                ddlStatus.DataValueField = "status_code";
                ddlStatus.DataSource     = dropdownListData.Tables[1];
                ddlStatus.DataBind();
                ddlStatus.Items.Insert(0, new ListItem("-"));

                //contract type dropdown
                ddlContractType.DataTextField  = "contract_type";
                ddlContractType.DataValueField = "contract_type_code";
                ddlContractType.DataSource     = dropdownListData.Tables[2];
                ddlContractType.DataBind();
                ddlContractType.Items.Insert(0, new ListItem("-"));

                //Update status dropdown
                ddlUpdateStatus.DataTextField  = "status_desc";
                ddlUpdateStatus.DataValueField = "status_code";
                ddlUpdateStatus.DataSource     = dropdownListData.Tables[1];
                ddlUpdateStatus.DataBind();
                ddlUpdateStatus.Items.Insert(0, new ListItem("-"));
            }
            else
            {
                ExceptionHandler("Error in loading the dropdown list values", string.Empty);
            }
        }
Пример #2
0
        private void LoadGridData()
        {
            //if (txtRoyaltor.Text == "" && txtOwner.Text == "" && txtPlgRoyaltor.Text == ""
            //    && ddlResponsibility.SelectedIndex == 0 && ddlStatus.SelectedIndex == 0)
            //{
            //    LoadEmptyGrid();
            //    return;
            //}

            //Create a table to hold the filter values
            DataTable dtSearchedFilters = new DataTable();

            dtSearchedFilters.Columns.Add("filter_name", typeof(string));
            dtSearchedFilters.Columns.Add("filter_value", typeof(string));

            //Add the filter values to the above created table
            dtSearchedFilters.Rows.Add("txtRoyaltor", txtRoyaltor.Text);
            dtSearchedFilters.Rows.Add("txtPlgRoyaltor", txtPlgRoyaltor.Text);
            if (cbCompanySelected.Checked)
            {
                dtSearchedFilters.Rows.Add("cbCompanySelected", "Y");
            }
            dtSearchedFilters.Rows.Add("txtOwner", txtOwner.Text);
            dtSearchedFilters.Rows.Add("ddlResponsibility", ddlResponsibility.SelectedValue);
            dtSearchedFilters.Rows.Add("ddlStatus", ddlStatus.SelectedValue);

            if (cbRoyaltorHeld.Checked)
            {
                dtSearchedFilters.Rows.Add("cbRoyaltorHeld", "Y");
            }
            dtSearchedFilters.Rows.Add("ddlContractType", ddlContractType.SelectedValue);

            dtSearchedFilters.Rows.Add("txtUploadRoyList", txtUploadRoyList.Text);

            Session["RSSearchedFilters"] = dtSearchedFilters;

            //set gridview panel height
            PnlGrid.Style.Add("height", hdnGridPnlHeight.Value);
            //JIRA-1048 Changes to handle single quote while searching --Start
            string royaltor    = (txtRoyaltor.Text == "" ? string.Empty : txtRoyaltor.Text.Replace("'", "").Trim());
            string plgRoyaltor = (txtPlgRoyaltor.Text == "" ? string.Empty : txtPlgRoyaltor.Text.Replace("'", "").Trim());
            //JIRA-1048 Changes to handle single quote while searching --End
            string ownerCode         = (txtOwner.Text == "" ? string.Empty : txtOwner.Text.Split('-')[0].Trim());
            string isCompanySelected = cbCompanySelected.Checked == true ? "Y" : "N";
            string isRoyaltorHeld    = cbRoyaltorHeld.Checked == true ? "Y" : "N";

            //WUIN-746 clearing sort hidden files
            hdnSortExpression.Value = string.Empty;
            hdnSortDirection.Value  = string.Empty;

            roySearchBL = new RoyaltorSearchBL();
            DataSet roySearchData = roySearchBL.GetSearchData(royaltor, plgRoyaltor, ownerCode, isCompanySelected, ddlResponsibility.SelectedValue, ddlStatus.SelectedValue, isRoyaltorHeld, ddlContractType.SelectedValue, txtUploadRoyList.Text.ToUpper().Trim().Replace("\r\n", string.Empty).Split(';').ToArray(), out errorId);

            roySearchBL = null;


            if (roySearchData.Tables.Count != 0 && errorId != 2)
            {
                if (roySearchData.Tables[0].Rows.Count == 0)
                {
                    Session["RoySrchRoyDetails"] = null;
                    gvRoyaltors.DataSource       = roySearchData.Tables[0];
                    gvRoyaltors.EmptyDataText    = "No data found for the selected filter criteria";
                    gvRoyaltors.DataBind();
                }
                else
                {
                    Session["RoySrchRoyDetails"] = roySearchData.Tables[0];
                    gvRoyaltors.DataSource       = roySearchData.Tables[0];
                    gvRoyaltors.DataBind();

                    if (gvRoyaltors.Rows.Count == 1 && hdnIsNewRequest.Value == "Y")
                    {
                        Response.Redirect(@"~/Contract/RoyaltorContract.aspx?RoyaltorId=" + roySearchData.Tables[0].Rows[0]["royaltor_id"], false);
                    }
                }
            }
            else if (roySearchData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvRoyaltors.DataSource    = dtEmpty;
                gvRoyaltors.EmptyDataText = "No data found for the selected filter criteria";
                gvRoyaltors.DataBind();
            }
            else
            {
                ExceptionHandler("Error in loading grid data", string.Empty);
            }
        }
Пример #3
0
        protected void btnYes_Click(object sender, EventArgs e)
        {
            try
            {
                List <string> royaltors = new List <string>();
                CheckBox      cbRoyChecked;
                string        royaltorId;

                PnlGrid.Style.Add("height", hdnGridPnlHeight.Value);
                string royaltor          = (txtRoyaltor.Text == "" ? string.Empty : txtRoyaltor.Text.Replace("'", "").Trim());       //JIRA-1048 --Changes to handle single quote
                string plgRoyaltor       = (txtPlgRoyaltor.Text == "" ? string.Empty : txtPlgRoyaltor.Text.Replace("'", "").Trim()); //JIRA-1048 --Changes to handle single quote
                string ownerCode         = (txtOwner.Text == "" ? string.Empty : txtOwner.Text.Split('-')[0].Trim());
                string isCompanySelected = cbCompanySelected.Checked == true ? "Y" : "N";
                string isRoyaltorHeld    = cbRoyaltorHeld.Checked == true ? "Y" : "N";
                string lockUnlock        = string.Empty;
                string lockUnlockAll     = "N";
                if (!(hdnButtonText.Value == "LockAll" || hdnButtonText.Value == "UnLockAll" || hdnButtonText.Value == "UpdateStatus"))
                {
                    foreach (GridViewRow row in gvRoyaltors.Rows)
                    {
                        cbRoyChecked = (CheckBox)row.FindControl("cbRoyChecked");
                        royaltorId   = (row.FindControl("hdnRoyaltorId") as HiddenField).Value;

                        if (cbRoyChecked.Checked == true)
                        {
                            royaltors.Add(royaltorId);
                        }
                    }

                    if (hdnLockUnlock.Value == "Lock")
                    {
                        lockUnlock = "Y";
                    }
                    else if (hdnLockUnlock.Value == "UnLock")
                    {
                        lockUnlock = "N";
                    }

                    roySearchBL = new RoyaltorSearchBL();
                    DataSet roySearchData = roySearchBL.UpdateRoyaltor(royaltor, plgRoyaltor, ownerCode, isCompanySelected, ddlResponsibility.SelectedValue, ddlStatus.SelectedValue, isRoyaltorHeld, ddlContractType.SelectedValue,
                                                                       royaltors.ToArray(), lockUnlock, lockUnlockAll, hdnUpdateStatus.Value, Convert.ToString(Session["UserCode"]), out errorId);
                    roySearchBL = null;

                    if (roySearchData.Tables.Count != 0 && errorId != 2)
                    {
                        if (roySearchData.Tables[0].Rows.Count == 0)
                        {
                            gvRoyaltors.DataSource    = roySearchData.Tables[0];
                            gvRoyaltors.EmptyDataText = "No data found for the selected filter criteria";
                            gvRoyaltors.DataBind();
                        }
                        else
                        {
                            gvRoyaltors.DataSource = roySearchData.Tables[0];
                            gvRoyaltors.DataBind();
                        }
                    }
                    else if (roySearchData.Tables.Count == 0 && errorId != 2)
                    {
                        dtEmpty = new DataTable();
                        gvRoyaltors.DataSource    = dtEmpty;
                        gvRoyaltors.EmptyDataText = "No data found for the selected filter criteria";
                        gvRoyaltors.DataBind();
                    }
                    else
                    {
                        ExceptionHandler("Error in loading grid data", string.Empty);
                        return;
                    }

                    if (hdnLockUnlock.Value == "Lock")
                    {
                        msgView.SetMessage("Selected royaltors have been locked", MessageType.Warning, PositionType.Auto);
                    }
                    else if (hdnLockUnlock.Value == "UnLock")
                    {
                        msgView.SetMessage("Selected royaltors have been unlocked", MessageType.Warning, PositionType.Auto);
                    }
                }
                else
                {
                    if (hdnButtonText.Value == "UpdateStatus")
                    {
                        foreach (GridViewRow row in gvRoyaltors.Rows)
                        {
                            royaltorId = (row.FindControl("hdnRoyaltorId") as HiddenField).Value;
                            royaltors.Add(royaltorId);
                        }
                    }
                    else
                    {
                        lockUnlockAll = "Y";
                    }


                    roySearchBL = new RoyaltorSearchBL();
                    DataSet roySearchData = roySearchBL.UpdateRoyaltor(royaltor, plgRoyaltor, ownerCode, isCompanySelected, ddlResponsibility.SelectedValue, ddlStatus.SelectedValue, isRoyaltorHeld, ddlContractType.SelectedValue,
                                                                       royaltors.ToArray(), hdnLockUnlock.Value, lockUnlockAll, hdnUpdateStatus.Value, Convert.ToString(Session["UserCode"]), out errorId);
                    roySearchBL = null;

                    if (errorId == 2)
                    {
                        ExceptionHandler("Error in updating royaltors", string.Empty);
                        return;
                    }

                    if (roySearchData.Tables.Count != 0)
                    {
                        if (roySearchData.Tables[0].Rows.Count == 0)
                        {
                            gvRoyaltors.DataSource    = roySearchData.Tables[0];
                            gvRoyaltors.EmptyDataText = "No data found for the selected filter criteria";
                            gvRoyaltors.DataBind();
                        }
                        else
                        {
                            gvRoyaltors.DataSource = roySearchData.Tables[0];
                            gvRoyaltors.DataBind();
                        }
                    }
                    else if (roySearchData.Tables.Count == 0)
                    {
                        dtEmpty = new DataTable();
                        gvRoyaltors.DataSource    = dtEmpty;
                        gvRoyaltors.EmptyDataText = "No data found for the selected filter criteria";
                        gvRoyaltors.DataBind();
                    }
                    else
                    {
                        ExceptionHandler("Error in loading grid data", string.Empty);
                        return;
                    }

                    if (hdnButtonText.Value == "LockAll")
                    {
                        msgView.SetMessage("All royaltors are locked", MessageType.Warning, PositionType.Auto);
                    }
                    else if (hdnButtonText.Value == "UnLockAll")
                    {
                        msgView.SetMessage("All royaltors are unlocked", MessageType.Warning, PositionType.Auto);
                    }

                    hdnButtonText.Value = string.Empty;
                }

                hdnLockUnlock.Value = string.Empty;
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in locking/unlocking royaltors", ex.Message);
            }
            finally
            {
                mpeConfirm.Hide();
            }
        }