Beispiel #1
0
        private void LoadDataByRegNo(string sTransNo, string sRegNo, string sApprovalStaus, string sType)
        {
            LienDAL oLienDAL = new LienDAL();
            Result  oResult  = null;

            TotalClear();

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Reg No", typeof(string)));
            dt.Columns.Add(new DataColumn("Issue Date", typeof(string)));
            dt.Columns.Add(new DataColumn("Bond Holder", typeof(string)));
            dt.Columns.Add(new DataColumn("Certificate No", typeof(string)));
            dt.Columns.Add(new DataColumn("Denomination", typeof(string)));
            dt.Columns.Add(new DataColumn("Amount", typeof(string)));

            DataRow   row = null;
            ArrayList al  = new ArrayList();

            if (sType.Equals("LM")) //LienMark search
            {
                oResult = (Result)oLienDAL.LoadLienMarkByTransactionNo(sTransNo, sApprovalStaus);
                if (oResult.Status)
                {
                    Lien oLien = (Lien)oResult.Return;
                    if (oLien != null)
                    {
                        txtLienBank.Text    = oLien.LienBank + (oLien.LienBankAddress == "" ? "" : "," + oLien.LienBankAddress);
                        txtOurRefNo.Text    = oLien.OurRef;
                        txtThierRefNo.Text  = oLien.TheirRef;
                        txtLienTransNo.Text = oLien.LienTransNo;
                        txtLienDate.Text    = oLien.LienDate.ToString(Constants.DATETIME_FORMAT);


                        if (oLien.DtLienDetails.Rows.Count > 0)
                        {
                            for (int i = 0; i < oLien.DtLienDetails.Rows.Count; i++)
                            {
                                if (!al.Contains(oLien.DtLienDetails.Rows[i]["SP Series"]))
                                {
                                    row                   = dt.NewRow();
                                    row["Reg No"]         = oLien.Issue.RegNo;
                                    row["Issue Date"]     = oLien.Issue.VersionIssueDate.ToString(Constants.DATETIME_dd_MMM_yyyy);
                                    row["Bond Holder"]    = oLien.Issue.BondHolderName;
                                    row["Certificate No"] = oLien.DtLienDetails.Rows[i]["SP Series"] + "-" + oLien.DtLienDetails.Rows[i]["SPScripID"];
                                    row["Denomination"]   = oLien.DtLienDetails.Rows[i]["Denomination"];
                                    row["Amount"]         = oLien.DtLienDetails.Rows[i]["Denomination"];

                                    dt.Rows.Add(row);
                                    al.Add(oLien.DtLienDetails.Rows[i]["SP Series"]);
                                }
                                else
                                {
                                    dt.Rows[al.IndexOf(oLien.DtLienDetails.Rows[i]["SP Series"])]["Amount"]         = Convert.ToDouble(dt.Rows[al.IndexOf(oLien.DtLienDetails.Rows[i]["SP Series"])]["Amount"]) + Convert.ToDouble(oLien.DtLienDetails.Rows[i]["Denomination"]);
                                    dt.Rows[al.IndexOf(oLien.DtLienDetails.Rows[i]["SP Series"])]["Certificate No"] = dt.Rows[al.IndexOf(oLien.DtLienDetails.Rows[i]["SP Series"])]["Certificate No"] + ", " + oLien.DtLienDetails.Rows[i]["SP Series"] + "-" + oLien.DtLienDetails.Rows[i]["SPScripID"];
                                }
                            }
                        }

                        if (dt.Rows.Count > 0)
                        {
                            gvData.DataSource = dt;
                        }
                        else
                        {
                            gvData.DataSource = null;
                        }
                        gvData.DataBind();
                    }
                }
            }
            else if (sType.Equals("LMR")) //LienMark remove search
            {
                oResult = (Result)oLienDAL.LoadLienRemoveMarkByRegNo(sTransNo, "", sRegNo, sApprovalStaus);
                if (oResult.Status)
                {
                    LienRemove oLienRemove = (LienRemove)oResult.Return;
                    if (oLienRemove != null)
                    {
                        txtLienBank.Text   = oLienRemove.LienBank + (oLienRemove.LienBankAddress == "" ? "" : "," + oLienRemove.LienBankAddress);
                        txtOurRefNo.Text   = oLienRemove.OurRef;
                        txtThierRefNo.Text = oLienRemove.TheirRef;
                        //txtLienTransNo.Text = oLienRemove.Lien.LienTransNo;
                        txtLienTransNo.Text = sTransNo;
                        txtLienDate.Text    = oLienRemove.Lien.LienDate.ToString(Constants.DATETIME_FORMAT);

                        if (oLienRemove.DtLienRemoveDetail.Rows.Count > 0)
                        {
                            for (int i = 0; i < oLienRemove.DtLienRemoveDetail.Rows.Count; i++)
                            {
                                if (!al.Contains(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"]))
                                {
                                    row                   = dt.NewRow();
                                    row["Reg No"]         = oLienRemove.Issue.RegNo;
                                    row["Issue Date"]     = oLienRemove.Issue.VersionIssueDate.ToString(Constants.DATETIME_dd_MMM_yyyy);
                                    row["Bond Holder"]    = oLienRemove.Issue.BondHolderName;
                                    row["Certificate No"] = oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"] + "-" + oLienRemove.DtLienRemoveDetail.Rows[i]["SPScripID"];
                                    row["Denomination"]   = oLienRemove.DtLienRemoveDetail.Rows[i]["Denomination"];
                                    row["Amount"]         = oLienRemove.DtLienRemoveDetail.Rows[i]["Denomination"];

                                    dt.Rows.Add(row);
                                    al.Add(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"]);
                                }
                                else
                                {
                                    dt.Rows[al.IndexOf(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"])]["Amount"]         = Convert.ToDouble(dt.Rows[al.IndexOf(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"])]["Amount"]) + Convert.ToDouble(oLienRemove.DtLienRemoveDetail.Rows[i]["Denomination"]);
                                    dt.Rows[al.IndexOf(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"])]["Certificate No"] = dt.Rows[al.IndexOf(oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"])]["Certificate No"] + ", " + oLienRemove.DtLienRemoveDetail.Rows[i]["SP Series"] + "-" + oLienRemove.DtLienRemoveDetail.Rows[i]["SPScripID"];
                                }
                            }
                        }

                        if (dt.Rows.Count > 0)
                        {
                            gvData.DataSource = dt;
                        }
                        else
                        {
                            gvData.DataSource = null;
                        }
                        gvData.DataBind();
                    }
                }
            }
        }