private static GpCw convertToCw(Dictionary<String, String> data) { GpCw cw = null; string mgxjhl_str = ""; string mgjzc = "0"; string mgsy = "0"; string mgxjlh = "0"; string zyywsr = "0"; string jlr = "0"; string jzrq = ""; if (data != null && data.Count > 0) { cw = new GpCw(); mgjzc = data["每股净资产"].Replace("元", ""); mgjzc = string.IsNullOrEmpty(mgjzc) ? "0" : mgjzc; mgsy = data["每股收益"].Replace("元", ""); mgsy = string.IsNullOrEmpty(mgsy) ? "0" : mgsy; mgxjlh = data["每股现金含量"].Replace("元", ""); mgxjlh = string.IsNullOrEmpty(mgxjlh) ? "0" : mgxjlh; zyywsr = data["主营业务收入"].Replace("万元", ""); zyywsr = string.IsNullOrEmpty(zyywsr) ? "0" : zyywsr; jlr = data["净利润"].Replace("万元", ""); jlr = string.IsNullOrEmpty(jlr) ? "0" : jlr; jzrq = data["截止日期"]; cw.mgjzc = Convert.ToDouble(mgjzc); cw.mgsy = Convert.ToDouble(mgsy); mgxjhl_str = mgxjlh; if (!data.Keys.Contains("每股现金含量")) { mgxjhl_str = "0"; } cw.mgxjhl = Convert.ToDouble(mgxjhl_str.Replace("元", "")); //cw.mgzbgjj = Convert.ToDouble(data["每股资本公积金"].Replace("元", "")); cw.zyywsr = Convert.ToDouble(zyywsr); cw.jll = Convert.ToDouble(jlr); cw.date = Convert.ToDateTime(jzrq); } return cw; }
public static void insertGpCw(GpCw cw) { if (cw != null && !String.IsNullOrEmpty(cw.code)) { if (!checkLoadCwFlag(cw.code,cw.date)) { GPUtil.helper.ExecuteNonQuery("insert into gpcw (code,mgjzc,mgsy,mgxjhl,zyywsr,jll,date) values ('" + cw.code + "'," + cw.mgjzc + ","+cw.mgsy+","+cw.mgxjhl+","+cw.zyywsr+","+cw.jll+",'"+cw.date+"')"); } } }