コード例 #1
0
ファイル: ScglBDService.cs プロジェクト: s7loves/mypowerscgl
        public List<bd_sb> GetGtList(string xlcode) {
            List<bd_sb> list = new List<bd_sb>();
            IList<BD_SBTZ> list2 = Client.ClientHelper.PlatformSqlMap.GetList<BD_SBTZ>("where OrgCode='" + xlcode + "'");
            IDictionary dic = Client.ClientHelper.PlatformSqlMap.GetDictionary<BD_SBTZ_ZL>(null, "dm", "mc");
            Dictionary<string, IList<BD_SBTZ_SX>> dicsx = new Dictionary<string, IList<BD_SBTZ_SX>>();
            Dictionary<int, string> dicvalue = new Dictionary<int, string>();
            foreach (BD_SBTZ gt in list2) {
                bd_sb psgt = new bd_sb() {
                    sbid= gt.sb_id, bdzdm=gt.OrgCode, sbmc=gt.sbname, sbzl=gt.sbtype,sbzlmc=dic[gt.sbtype].ToString()
                };
                
                psgt.jsonData = getjsonData(gt.sb_id);
                try { psgt.jsonData2 = getjsonData(gt, dicsx,dicvalue); } catch(Exception err) {
                    Console.WriteLine(err.Message);
                    Console.WriteLine(err.Source);
                    Console.WriteLine(err.StackTrace);
                }
                list.Add(psgt);
            }

            return list;
        }
コード例 #2
0
ファイル: ScglBDService.cs プロジェクト: s7loves/mypowerscgl
        public string UpdateGtOne(bd_sb data) {
            BD_SBTZ gt = Ebada.Client.ClientHelper.PlatformSqlMap.GetOneByKey<BD_SBTZ>(data.sbid);
            if (gt != null) {
               
                if (!string.IsNullOrEmpty(data.jsonData2)) {
                    Console.WriteLine("data.jsonData2;\r\n"+data.jsonData2);
                    List<bd_sbsxz> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<bd_sbsxz>>(data.jsonData2);
                    if (list != null) {
                        Type t = gt.GetType(); gt.sbname = data.sbmc;
                        foreach (var sx in list) {
                            t.GetProperty(sx.k).SetValue(gt, sx.v,null);
                        }
                        int n=Client.ClientHelper.PlatformSqlMap.Update<BD_SBTZ>(gt);
                        ncount += n>0?n:0;
                    }
                }
                if (!string.IsNullOrEmpty(data.jsonData)) {
                    Console.WriteLine("data.jsonData;\r\n" + data.jsonData);
                    List<ps_gtsb> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ps_gtsb>>(data.jsonData);
                    if (list != null) {
                        List<SqlQueryObject> sqllist = new List<SqlQueryObject>();
                        SqlQueryObject sqo = new SqlQueryObject(SqlQueryType.Delete, "Delete", "delete from bd_sbtz_fssb where gtid='" + gt.sb_id + "'");
                        sqllist.Add(sqo);
                        int num = 0;
                        foreach (ps_gtsb sb in list) {
                            num++;
                            bd_sbtz_fssb gtsb = new bd_sbtz_fssb() { gtID = gt.sb_id, sbModle = sb.xh, sbType = sb.zldm, sbNumber = short.Parse(sb.sl), sbName = sb.zl, sbCode = num.ToString("000") };
                            gtsb.sbID = gt.sb_id + num.ToString("000");
                            sqo = new SqlQueryObject(SqlQueryType.Insert, gtsb);
                            sqllist.Add(sqo);
                        }
                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(sqllist);
                    }
                    //Console.WriteLine(list != null ? list.Count : 0);
                }
                //Console.WriteLine("update {0} count {1}", gt.gtCode, n);
            }

            return "";
        }