public static TWIssueInfo Prompt(string ric, string warrantName, string orgName)
        {
            IssuerAdd form = new IssuerAdd();

            form.tbRIC.Text         = ric;
            form.tbWarrantName.Text = warrantName;
            form.tbOrgName.Text     = orgName;
            form.ShowDialog();
            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                string      chineseShortName = form.tbChineseShortName.Text.Trim();
                string      englishBriefName = form.tbEnglishBriefName.Text.Trim();
                string      englishShortName = form.tbEnglishShortName.Text.Trim();
                string      englishName      = form.tbEnglishName.Text.Trim();
                string      englishFullName  = form.tbEnglishFullName.Text.Trim();
                string      issuerCode       = form.tbIssuerCode.Text.Trim();
                string      warrantIssuer    = form.tbWarrantIssuer.Text.Trim();
                string      chineseChain     = form.tbWarrantName.Text.Trim();
                TWIssueInfo issuer           = new TWIssueInfo();
                issuer.ChineseShortName = chineseShortName;
                issuer.EnglishBriefName = englishBriefName;
                issuer.EnglishShortName = englishShortName;
                issuer.EnglishName      = englishName;
                issuer.EnglishFullName  = englishFullName;
                issuer.IssueCode        = issuerCode;
                issuer.WarrantIssuer    = warrantIssuer;
                return(issuer);
            }
            return(null);
        }
Example #2
0
        public List <TWIssueInfo> GetAll()
        {
            List <TWIssueInfo> infoList = new List <TWIssueInfo>();

            try
            {
                using (SqlConnection conn = new SqlConnection(Config.ConnectionString))
                {
                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }

                    using (SqlCommand comm = new SqlCommand("select * from ETI_TW_ISSUE_INFO", conn))
                    {
                        using (SqlDataReader dr = comm.ExecuteReader())
                        {
                            if (dr.HasRows)
                            {
                                while (dr.Read())
                                {
                                    TWIssueInfo info = new TWIssueInfo();
                                    info.ChineseShortName = Convert.ToString(dr["ChineseShortName"]);
                                    info.EnglishShortName = Convert.ToString(dr["EnglishShortName"]);
                                    info.EnglishBriefName = Convert.ToString(dr["EnglishBriefName"]);
                                    info.EnglishName      = Convert.ToString(dr["EnglishName"]);
                                    info.EnglishFullName  = Convert.ToString(dr["EnglishFullName"]);
                                    info.IssueCode        = Convert.ToString(dr["IssueCode"]);
                                    infoList.Add(info);
                                }
                            }
                        }
                    }
                }

                return(infoList);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #3
0
 public static int InsertNewIssuer(TWIssueInfo issuer)
 {
     if (issuer == null)
     {
         return(0);
     }
     string where = string.Format("where ChineseShortName = N'{0}'", issuer.ChineseShortName);
     System.Data.DataTable dt = Select(ETI_TW_ISSUE_TABLE_NAME, new string[] { "*" }, where);
     if (dt == null || dt.Rows.Count > 0)
     {
         return(0);
     }
     System.Data.DataRow dr = dt.NewRow();
     dr["ChineseShortName"] = issuer.ChineseShortName;
     dr["EnglishShortName"] = issuer.EnglishShortName;
     dr["EnglishBriefName"] = issuer.EnglishBriefName;
     dr["EnglishName"]      = issuer.EnglishName;
     dr["EnglishFullName"]  = issuer.EnglishFullName;
     dr["IssueCode"]        = issuer.IssueCode;
     dr["WarrantIssuer"]    = issuer.WarrantIssuer;
     dt.Rows.Add(dr);
     return(UpdateDbTable(dt, ETI_TW_ISSUE_TABLE_NAME));
 }
Example #4
0
        public static TWIssueInfo GetByChineseShortName(string ChineseShortName)
        {
            using (SqlConnection conn = new SqlConnection(Config.ConnectionString))
            {
                if (conn.State != System.Data.ConnectionState.Open)
                {
                    conn.Open();
                }

                using (SqlCommand comm = new SqlCommand())
                {
                    comm.Connection  = conn;
                    comm.CommandText = "select * from ETI_TW_ISSUE_INFO where ChineseShortName=N'" + ChineseShortName + "'";

                    using (SqlDataReader dr = comm.ExecuteReader())
                    {
                        if (dr.HasRows && dr.Read())
                        {
                            TWIssueInfo info = new TWIssueInfo();
                            info.ChineseShortName = Convert.ToString(dr["ChineseShortName"]);
                            info.EnglishShortName = Convert.ToString(dr["EnglishShortName"]);
                            info.EnglishBriefName = Convert.ToString(dr["EnglishBriefName"]);
                            info.EnglishName      = Convert.ToString(dr["EnglishName"]);
                            info.EnglishFullName  = Convert.ToString(dr["EnglishFullName"]);
                            info.WarrantIssuer    = Convert.ToString(dr["WarrantIssuer"]);
                            info.IssueCode        = Convert.ToString(dr["IssueCode"]);
                            return(info);
                        }

                        else
                        {
                            throw new Exception(string.Format("Cannot find TWUnderlyingNameInfo object with ChiENgName: {0} in Table TWIssuer", ChineseShortName));
                        }
                    }
                }
            }
        }