コード例 #1
0
    protected void btnAddrDup_Click(object sender, EventArgs e)
    {
        DataTable     dtAddrDup;
        ImportYEBData iObj = new ImportYEBData();

        if (Session["yrmo"] != null)
        {
            usryrmo = Session["yrmo"].ToString();
        }

        if (Session["pilotind"] != null)
        {
            pilotind = Session["pilotind"].ToString();
        }
        if ((usryrmo == ""))
        {
            lbl_error.Text = "Please select YRMO (year month) value to continue ";
            return;
        }
        if ((pilotind == ""))
        {
            lbl_error.Text = "Please select PilotIndicator (PI or NP) value to continue ";
            return;
        }
        status = "EBAADDR";

        if (pilotind != "" && status != "")
        {
            try
            {
                //retrieve the datatable for the criteria specified based on status
                dtAddrDup = ImportYEBData.getYEBDuplicateRecs(pilotind, usryrmo, "ADDR1").Tables[0];
                if (dtAddrDup.Rows.Count > 0)

                {
                    //Delete any previously imported data for the specified YRMO and criteria
                    ImportYEBData.Rollback("DUPADDR" + pilotind, usryrmo);
                    //loop thru the datatable rows for inserting to YEB_Dup_Detail table
                    ImportYEBData.DisplayProgressBar();
                    _counter = iObj.insertYEBDupData(dtAddrDup, "ADDR1");
                    ImportYEBData.HideProgressBar(_counter);
                    if (_counter > 0)
                    {
                        MultiView1.SetActiveView(view_result);
                        lbl_result.Text = "Identified the Duplicate (Addr1+City) records successfully -- " + _counter + "  Records identified for YEB Distribution from " + dtAddrDup.Rows.Count + " records";
                    }
                    else if
                    (_counter == 0)
                    {
                        MultiView1.SetActiveView(view_result);
                        lbl_result.Text = "No Duplicate (Addr1+City) records were identified from the YEB Detail table based on the existing data ";
                    }
                }
                else
                {
                    MultiView1.SetActiveView(view_result);
                    lbl_result.Text = "No Duplicate ADDR1+City records exist in the YEBDetail table currently";
                }
            }
            catch (Exception ex)
            {
                //resultDiv.Visible = false;
                ImportYEBData.Rollback("DUPADDR" + pilotind, usryrmo);
                lbl_error.Text = "Error - " + ex.Message;
            }
        }
    }