Ejemplo n.º 1
0
        private void JPM_refNum_button_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string    path = ofd.FileName;
                DataSet   ds   = HssExcel.Excel_to_DS(path);
                DataTable dt   = ds.Tables["JPM"];

                Bulk_DBcmd bk = new Bulk_DBcmd();
                foreach (DataRow row in dt.Rows)
                {
                    string JPM_refNum = row["JPM CUSTODIAN REF NUMBER"].ToString();
                    if (string.IsNullOrEmpty(JPM_refNum))
                    {
                        continue;
                    }

                    string    shortName = row["Short\nName"].ToString();
                    Custodian cust      = CustodianMaster.GetCustodian_name(shortName);
                    if (cust == null)
                    {
                        continue;
                    }

                    cust.JPM_Custodian_Ref_Num.Value = JPM_refNum;
                    bk.Add_DBcmd(cust.Get_DBupdate());
                }

                MessageBox.Show("" + bk.SaveToDB(Utility.Get_DRWIN_hDB()));
                CustodianMaster.Reset();
            }
        }
Ejemplo n.º 2
0
        private void custMapping_button_Click(object sender, EventArgs e)
        {//DRWIN-467
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string    path = ofd.FileName;
                DataSet   ds   = HssExcel.Excel_to_DS(path);
                DataTable dt   = ds.Tables["Export Worksheet"];

                Bulk_DBcmd bk = new Bulk_DBcmd();
                foreach (DataRow row in dt.Rows)
                {
                    int cNum = -1;
                    if (int.TryParse(row["Custodian #"].ToString(), out cNum))
                    {
                        Custodian cust = CustodianMaster.GetCustodian_num(cNum);
                        if (cust == null)
                        {
                            Console.WriteLine("cNum " + cNum + " not found");
                            continue;
                        }

                        string str = row["Custodian"].ToString();

                        if (string.IsNullOrEmpty(cust.Custodian_Alias.Value))
                        {
                            cust.Custodian_Alias.Value = row["Custodian"].ToString();
                        }
                        else if (cust.Custodian_Alias.Value.ToUpper().Contains(str.ToUpper()))
                        {
                            continue;
                        }
                        else
                        {
                            cust.Custodian_Alias.Value = cust.Custodian_Alias.Value + "," + row["Custodian"].ToString();
                        }

                        bk.Add_DBcmd(cust.Get_DBupdate());
                    }
                    else
                    {
                        string custName = row["Custodian"].ToString();
                        if (string.IsNullOrEmpty(custName))
                        {
                            continue;
                        }

                        string    ctyName = row["Country"].ToString();
                        Country   cty     = CountryMaster.GetCountry_name(ctyName);
                        Custodian cust    = CustodianMaster.GetCustodian_name(custName);

                        if (cust == null)
                        {
                            cust = new Custodian();
                        }

                        cust.Custodian_ShortName.Value = custName;
                        cust.Custodian_FullName.Value  = custName;
                        if (cty != null)
                        {
                            cust.Country_Code.Value = cty.cntry_cd.Value;
                        }
                        else
                        {
                            cust.Country_Code.Value = "000";
                        }

                        if (cust.Custodian_Number > 0)
                        {
                            bk.Add_DBcmd(cust.Get_DBupdate());
                        }
                        else
                        {
                            bk.Add_DBcmd(cust.Get_DBinsert());
                        }
                    }
                }
                MessageBox.Show("" + bk.SaveToDB(Utility.Get_DRWIN_hDB()));
                CustodianMaster.Reset();
            }
        }