Ejemplo n.º 1
0
        public ResultPojo mzValidSche(string zdbh, string jydm, int zjmz)
        {
            string     strResult = client.mzValidSche(zdbh, jydm, zjmz);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 2
0
        public ResultPojo yyOrderTake(string zdbh, string jydm, string brid, string yyxh, string ysdm, string ksdm)
        {
            string     strResult = client.yyOrderTake(zdbh, jydm, brid, yyxh, ysdm, ksdm);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 3
0
        public ResultPojo yyOrderCancel(string zdbh, string jydm, string yyxh)
        {
            string     strResult = client.yyOrderCancel(zdbh, jydm, yyxh);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 4
0
        public ResultPojo yyOrderQuery(string zdbh, string jydm, string brid, string jzrq)
        {
            string     strResult = client.yyOrderQuery(zdbh, jydm, brid, jzrq);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 5
0
        public ResultPojo yyOrder(string zdbh, string jydm, string brid, string ksdm, string ysdm, string jzrq, int sxw, string pdhm, string pbsb)
        {
            string     strResult = client.yyOrder(zdbh, jydm, brid, ksdm, ysdm, jzrq, sxw, pdhm, pbsb);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 6
0
        public ResultPojo yyValidPool(string zdbh, string jydm, string ksdm, string ysdm, string gzrq, int sxw, string pbsb, int cxfs)
        {
            string     strResult = client.yyValidPool(zdbh, jydm, ksdm, ysdm, gzrq, sxw, pbsb, cxfs);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 7
0
        public ResultPojo yyValidSche(string zdbh, string jydm, string ksdm, int zjmz, string ysdm, string gzrq, int sxw)
        {
            string     strResult = client.yyValidSche(zdbh, jydm, ksdm, zjmz, ysdm, gzrq, sxw);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 8
0
        public ResultPojo mzValid(string zdbh, string jydm, string brid, string ksdm, string ysdm, string ybkmm, string ybkxx, string pbsb)
        {
            string     strResult = client.mzValid(zdbh, jydm, brid, ksdm, ysdm, ybkmm, ybkxx, pbsb);
            ResultPojo pojo      = JSONHelper.FromJSON <ResultPojo>(strResult);

            return(pojo);
        }
Ejemplo n.º 9
0
        public Z FlushTo <Z>(DataRow dr)
        {
            Z obj = default(Z);


            if (dr == null)
            {
                return(default(Z));
            }
            var cacheKey = typeof(Z).FullName;

            PropertyInfo[] PIS = null;
            if (_缓存反射.ContainsKey(cacheKey))
            {
                PIS = _缓存反射[cacheKey];
            }
            else
            {
                //Type t = obj.GetType();
                PIS = typeof(Z).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
                if (!_缓存反射.ContainsKey(cacheKey))
                {
                    _缓存反射.AddOrUpdate(cacheKey, PIS, (k, v) => { return(v); });
                }
            }
            Dictionary <string, bool> setKey = new Dictionary <string, bool>();

            obj = (Z)Activator.CreateInstance(typeof(Z));
            #region 绑定值
            foreach (PropertyInfo pi in PIS)
            {
                if (!pi.CanWrite)
                {
                    continue;
                }

                string piName = pi.Name;
                //object v = pi.GetValue(this, null);
                //dr.Table.Columns.Contains(name) 或者Regex.IsMatch(piName, "^" + Columns + "$", RegexOptions.IgnoreCase | RegexOptions.Compiled)
                if (dr.Table.Columns.Contains(piName) && !dr[piName].Equals(System.DBNull.Value))
                {
                    if (!setKey.ContainsKey(piName))
                    {
                        setKey.Add(piName, true);
                    }

                    if (pi.PropertyType.IsEnum)
                    {
                        pi.SetValue(obj, Enum.ToObject(pi.PropertyType, dr[piName]), null);
                    }
                    else if (pi.PropertyType.Equals(typeof(int)) && !dr[piName].GetType().Equals(typeof(int)))
                    {
                        int dv   = 0;
                        var rawv = dr[piName].ToString();
                        if (int.TryParse(rawv, out dv))
                        {
                            pi.SetValue(obj, dv, null);
                        }
                        else if ("True" == rawv || "true" == rawv || "是" == rawv)
                        {
                            pi.SetValue(obj, 1, null);
                        }
                    }
                    else if (dr[piName].GetType().Equals(typeof(System.Guid)) && pi.PropertyType.Equals(typeof(string)))
                    {
                        pi.SetValue(obj, dr[piName].ToString(), null);
                    }
                    else if (dr[piName].GetType().Equals(typeof(System.DateTime)) && pi.PropertyType.Equals(typeof(string)))
                    {
                        pi.SetValue(obj, dr[piName].ToString(), null);//yyyy-MM-dd HH:mm:ss
                    }
                    else if ((!dr[piName].GetType().Equals(typeof(System.String))) && pi.PropertyType.Equals(typeof(string)))
                    {
                        pi.SetValue(obj, dr[piName].ToString(), null);
                    }
                    else if ((dr[piName].GetType().Equals(typeof(System.Boolean))) && pi.PropertyType.Equals(typeof(int)))
                    {
                        pi.SetValue(obj, ((bool)dr[piName]) ? 1 : 0, null);
                    }
                    else if ((dr[piName].GetType().Equals(typeof(System.UInt64))) && pi.PropertyType.Equals(typeof(System.Int64)))
                    {
                        pi.SetValue(obj, long.Parse(dr[piName].ToString()), null);
                    }
                    else if (pi.PropertyType.Equals(typeof(Dictionary <string, string>)))
                    {
                        pi.SetValue(obj, JSONHelper.FromJSON <Dictionary <string, string> >(dr[piName].ToString()), null);
                    }
                    else if (!pi.PropertyType.IsValueType && pi.PropertyType != typeof(string))
                    {
                        var tos = JSONHelper.FromJSON(dr[piName].ToString(), pi.PropertyType);
                        pi.SetValue(obj, tos, null);
                    }
                    else
                    {
                        pi.SetValue(obj, dr[piName], null);
                    }
                }
            }
            #endregion
            var skipColumns = from xi in PIS where xi.PropertyType.Equals(typeof(Dictionary <string, string>)) select xi;

            PropertyInfo 扩展字段 = null;
            foreach (var xi in skipColumns)
            {
                if (setKey.ContainsKey(xi.Name))
                {
                    continue;
                }
                if (xi.Name.Contains("ExtVals"))
                {
                    扩展字段 = xi;
                    break;
                }
            }
            if (扩展字段 != null)
            {
                Dictionary <string, string> LastSkips = new Dictionary <string, string>();
                foreach (DataColumn c in dr.Table.Columns)
                {
                    if (setKey.ContainsKey(c.ColumnName))
                    {
                        continue;
                    }
                    if (MatchColumns.Contains("|" + c.ColumnName + "|"))
                    {
                        continue;
                    }
                    var ko = dr[c.ColumnName].ToString();
                    if (!string.IsNullOrEmpty(ko))
                    {
                        LastSkips.Add(c.ColumnName, ko);
                    }
                }
                扩展字段.SetValue(obj, LastSkips, null);
            }


            return(obj);
        }