public Expression Scalar(Expression valueType, BondDataType expectedType, ValueHandler handler) { throw new System.NotImplementedException(); }
/// <summary> /// 新宝典导入验证 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string CheckXFBColumns(string obj) { string flag = "true"; try { ArrayList arr = JSON.getPara(obj); using (var client = new System.Net.WebClient()) { client.DownloadFile(ValueHandler.GetStringValue(arr[0]), HttpContext.Current.Request.PhysicalApplicationPath + "UpFile\\Files\\" + System.IO.Path.GetFileName(ValueHandler.GetStringValue(arr[0]).Substring(ValueHandler.GetStringValue(arr[0]).LastIndexOf('/') + 1))); } string fileName = ValueHandler.GetStringValue(arr[0]).Substring(ValueHandler.GetStringValue(arr[0]).LastIndexOf('/') + 1); string abPath = System.AppDomain.CurrentDomain.BaseDirectory + "\\UpFile\\Files\\"; using (StreamReader sr = new StreamReader(abPath + fileName, System.Text.Encoding.GetEncoding("gb2312"))) { string str; int i = 0; while ((str = sr.ReadLine()) != null) { i++; string[] temp = str.Replace("\"", "").Split((char)9); if (str.Contains("\"") || str.Contains(",")) { flag = "special|" + i + "|" + str; break; } if (temp.Length < 4) { flag = "contentLen|" + i + "|" + str; break; } if (!IsTelephone(temp[1]) && i != 1) { flag = "false|" + i + "|" + str; break; } if (temp[3].Length > 500 && i != 1) { flag = "remark|" + i + "|" + str; break; } } } } catch { flag = "false"; } return(flag); }
public string GetWQTOriginalDataDts(object obj) { ArrayList arr = JSON.getPara(obj); DataTable dt = dAL_OriginalData.GetWQTOriginalDataDts(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[1]), ValueHandler.GetStringValue(arr[2])); string json = JSON.DataTableToArrayList(dt); return(json); }
/// <summary> /// 得到原数据数量 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string GetOriginalDataCount(object obj) { ArrayList arr = JSON.getPara(obj); return(dAL_OriginalData.GetOriginalDataCount(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[1]), ValueHandler.GetStringValue(arr[2]), ValueHandler.GetStringValue(arr[3]), ValueHandler.GetStringValue(arr[4]))); }
/// <summary> /// 批量导入有效数据 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string BatchImportValidData(object obj) { ArrayList arr = JSON.getPara(obj); bool flag = dAL_OriginalData.BatchImportValidData(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[2]), ValueHandler.GetStringValue(BLL_User.User_Name)); return("true"); }
public Expression Bonded(ValueHandler handler) { if (schemaType.IsBonded()) { return handler(value); } var bondedType = typeof(Bonded<>).MakeGenericType(objectType); var bondedCtor = bondedType.GetConstructor(objectType); return handler(Expression.New(bondedCtor, value)); }
/// <summary> /// 查询资讯信息 /// </summary> /// <param name="Pub_Code">资讯编号</param> /// <returns>资讯信息</returns> public DataTable GetPublicInfo(string Pub_Code) { string sql = string.Format("SELECT Pub_Code,Pub_LS_Code1,Pub_LS_Code2,Pub_LS_Code3,Pub_LS_Code4,Pub_SA_Code1,Pub_SA_Code2,Pub_SA_Code3,Pub_Title,Pub_Pic1,Pub_Pic2,Pub_Pic3,Pub_Content,Pub_Content,Pub_ArticleSource,Pub_KeyWords,Pub_ReadCount,Pub_PraiseCount FROM XXSD_PublicInfo WHERE Pub_Code = '{0}'", ValueHandler.GetStringValue(Pub_Code)); return(SearchData(sql)); }
/// <summary> /// Create a TextLabel for each bar in the GraphPane. /// Call this method only after calling AxisChange() /// </summary> /// <remarks> /// This method will go through the bars, create a label that corresponds to the bar value, /// and place it on the graph depending on user preferences. This works for horizontal or /// vertical bars in clusters or stacks.</remarks> /// <param name="pane">The GraphPane in which to place the text labels.</param> /// <param name="isBarCenter">true to center the labels inside the bars, false to /// place the labels just above the top of the bar.</param> /// <param name="valueFormat">The double.ToString string format to use for creating /// the labels /// </param> private void CreateBarLabels(GraphPane pane, bool isBarCenter, string valueFormat) { bool isVertical = pane.BarSettings.Base == BarBase.X; // Make the gap between the bars and the labels = 2% of the axis range float labelOffset; if (isVertical) { labelOffset = (float)(pane.YAxis.Scale.Max - pane.YAxis.Scale.Min) * 0.02f; } else { labelOffset = (float)(pane.XAxis.Scale.Max - pane.XAxis.Scale.Min) * 0.02f; } // keep a count of the number of BarItems int curveIndex = 0; // Get a valuehandler to do some calculations for us ValueHandler valueHandler = new ValueHandler(pane, true); // Loop through each curve in the list foreach (CurveItem curve in pane.CurveList) { // work with BarItems only BarItem bar = curve as BarItem; if (bar != null) { IPointList points = curve.Points; // Loop through each point in the BarItem for (int i = 0; i < points.Count; i++) { // Get the high, low and base values for the current bar // note that this method will automatically calculate the "effective" // values if the bar is stacked double baseVal, lowVal, hiVal; valueHandler.GetValues(curve, i, out baseVal, out lowVal, out hiVal); // Get the value that corresponds to the center of the bar base // This method figures out how the bars are positioned within a cluster float centerVal = (float)valueHandler.BarCenterValue(bar, bar.GetBarWidth(pane), i, baseVal, curveIndex); // Create a text label -- note that we have to go back to the original point // data for this, since hiVal and lowVal could be "effective" values from a bar stack string barLabelText = (isVertical ? points[i].Y : points[i].X).ToString(valueFormat); // Calculate the position of the label -- this is either the X or the Y coordinate // depending on whether they are horizontal or vertical bars, respectively float position; if (isBarCenter) { position = (float)(hiVal + lowVal) / 2.0f; } else { position = (float)hiVal + labelOffset; } // Create the new TextObj TextObj label; if (isVertical) { label = new TextObj(barLabelText, centerVal, position); } else { label = new TextObj(barLabelText, position, centerVal); } // Configure the TextObj label.Location.CoordinateFrame = CoordType.AxisXYScale; label.FontSpec.Size = 12; label.FontSpec.FontColor = Color.Black; label.FontSpec.Angle = isVertical ? 90 : 0; label.Location.AlignH = isBarCenter ? AlignH.Center : AlignH.Left; label.Location.AlignV = AlignV.Center; label.FontSpec.Border.IsVisible = false; label.FontSpec.Fill.IsVisible = false; // Add the TextObj to the GraphPane pane.GraphObjList.Add(label); } } curveIndex++; } }
public bool SaveUserModule(ArrayList arr) { bool flag; SqlTransaction tran = null;//声明一个事务对象 try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnStringSQL"].ToString())) { conn.Open();//打开链接 using (tran = conn.BeginTransaction()) { StringBuilder sb = new StringBuilder(); SqlCommand cmd = new SqlCommand("DELETE FROM AF_UserPopedom WHERE UP_User_Code='" + ValueHandler.GetStringValue(arr[0]) + "'", conn); cmd.Transaction = tran; cmd.ExecuteNonQuery(); var userCode = arr[0].ToString(); var q1 = arr.ToArray().ToList(); q1.RemoveAt(0);//删除第一个 var qModule = (from q in q1 select q.ToString().Split('|')[0]).Distinct().ToList(); foreach (var moudle in qModule) { sb.Remove(0, sb.Length); var qModuleFuns = (from q in q1 where q.ToString().Contains(moudle + "|") select q.ToString().Replace(moudle + "|", "")).ToList(); DataTable dt = SearchData("SELECT SM_FunIDs FROM dbo.AF_SysModule WHERE SM_Code = '" + moudle + "'"); var mfuns = (from q in dt.AsEnumerable() select q.Field <string>("SM_FunIDs")).ToList(); if (mfuns.Count > 0) { sb.Append("\r INSERT INTO AF_UserPopedom("); sb.Append("UP_Code,UP_User_Code,UP_SM_Code,UP_SM_FunIDs"); sb.Append(") SELECT "); sb.Append("UP_Code = '" + GetCode() + "',"); sb.Append("UP_User_Code='" + userCode + "',UP_SM_Code='" + moudle + $"','{string.Join(",", mfuns[0].Split(',').ToList().Except(qModuleFuns).ToList())}';"); } cmd.CommandText = sb.ToString(); cmd.ExecuteNonQuery(); } tran.Commit(); //提交事务 flag = true; } } } catch { tran.Rollback(); //出错回滚 flag = false; } return(flag); }
public Expression Scalar(Expression valueType, BondDataType expectedType, ValueHandler handler) { return(MatchOrCompatible(valueType, expectedType, type => handler(reader.Read(type)))); }
///Returns a function that can convert from source type to target type with given func as the current value public static ValueHandler <T> GetConverterFuncFromTo <T>(Type sourceType, Type targetType, ValueHandler <object> func) { //assignables if (targetType.RTIsAssignableFrom(sourceType)) { return(() => { return (T)func(); }); } //convertibles if (typeof(IConvertible).RTIsAssignableFrom(targetType) && typeof(IConvertible).RTIsAssignableFrom(sourceType)) { return(() => { return (T)Convert.ChangeType(func(), targetType); }); } ///CUSTOM CONVENIENCE CONVERSIONS ///---------------------------------------------------------------------------------------------- //from anything to string if (targetType == typeof(string)) { return(() => { try { return (T)(object)(func().ToString()); } catch { return default(T); } }); } //from anything to Type if (targetType == typeof(Type)) { return(() => { try { return (T)(object)func().GetType(); } catch { return default(T); } }); } //from convertible to Vector3 if (targetType == typeof(Vector3) && typeof(IConvertible).RTIsAssignableFrom(sourceType)) { return(() => { var f = (float)Convert.ChangeType(func(), typeof(float)); return (T)(object)new Vector3(f, f, f); }); } //from UnityObject to bool if (targetType == typeof(bool) && typeof(UnityEngine.Object).RTIsAssignableFrom(sourceType)) { return(() => { return (T)(object)(func() as UnityEngine.Object != null); }); } ///---------------------------------------------------------------------------------------------- //upcasting if (targetType.RTIsSubclassOf(sourceType)) { return(() => { return (T)func(); }); } //handles implicit/explicit and prety much everything else. System.Linq.Expressions.UnaryExpression exp = null; if (ReflectionTools.CanConvert(sourceType, targetType, out exp)) { return(() => { try { return (T)func(); } catch { return (T)exp.Method.Invoke(null, ReflectionTools.SingleTempArgsArray(func())); } }); } ///---------------------------------------------------------------------------------------------- //from component to Vector3 (position) if (targetType == typeof(Vector3) && typeof(Component).RTIsAssignableFrom(sourceType)) { return(() => { try { return (T)(object)((func() as Component).transform.position); } catch { return default(T); } }); } //from gameobject to Vector3 (position) if (targetType == typeof(Vector3) && sourceType == typeof(GameObject)) { return(() => { try { return (T)(object)((func() as GameObject).transform.position); } catch { return default(T); } }); } //from component to Quaternion (rotation) if (targetType == typeof(Quaternion) && typeof(Component).RTIsAssignableFrom(sourceType)) { return(() => { try { return (T)(object)((func() as Component).transform.rotation); } catch { return default(T); } }); } //from gameobject to Quaternion (rotation) if (targetType == typeof(Quaternion) && sourceType == typeof(GameObject)) { return(() => { try { return (T)(object)((func() as GameObject).transform.rotation); } catch { return default(T); } }); } ///---------------------------------------------------------------------------------------------- //from component to component if (typeof(Component).RTIsAssignableFrom(targetType) && typeof(Component).RTIsAssignableFrom(sourceType)) { return(() => { try { return (T)(object)((func() as Component).GetComponent(targetType)); } catch { return default(T); } }); } //from gameobject to component if (typeof(Component).RTIsAssignableFrom(targetType) && sourceType == typeof(GameObject)) { return(() => { try { return (T)(object)((func() as GameObject).GetComponent(targetType)); } catch { return default(T); } }); } //from component to gameobject if (targetType == typeof(GameObject) && typeof(Component).RTIsAssignableFrom(sourceType)) { return(() => { try { return (T)(object)((func() as Component).gameObject); } catch { return default(T); } }); } ///---------------------------------------------------------------------------------------------- //From IEnumerable to IEnumerable for Lists and Arrays if (typeof(IEnumerable).RTIsAssignableFrom(sourceType) && typeof(IEnumerable).RTIsAssignableFrom(targetType)) { try { var elementFrom = sourceType.RTIsArray() ? sourceType.GetElementType() : sourceType.RTGetGenericArguments().Single(); var elementTo = targetType.RTIsArray() ? targetType.GetElementType() : targetType.RTGetGenericArguments().Single(); if (elementTo.RTIsAssignableFrom(elementFrom)) { var listType = typeof(List <>).RTMakeGenericType(elementTo); return(() => { var list = (IList)System.Activator.CreateInstance(listType); foreach (var o in (IEnumerable)func()) { list.Add(o); } return (T)list; }); } } catch { return(null); } } return(null); }
protected override void DrawSingleBar(Graphics g, GraphPane pane, CurveItem curve, int index, int pos, Axis baseAxis, Axis valueAxis, float barWidth, float scaleFactor) { base.DrawSingleBar(g, pane, curve, index, pos, baseAxis, valueAxis, barWidth, scaleFactor); PointPair pointPair = curve.Points[index]; ErrorTag errorTag = pointPair.Tag as ErrorTag; if (pointPair.IsInvalid || errorTag == null) { return; } double curBase, curLowVal, curHiVal; ValueHandler valueHandler = new ValueHandler(pane, false); valueHandler.GetValues(curve, index, out curBase, out curLowVal, out curHiVal); float pixBase = baseAxis.Scale.Transform(curve.IsOverrideOrdinal, index, curBase); double lowError = curHiVal - errorTag.Error; float pixLowError = valueAxis.Scale.Transform(lowError); float pixHiError = valueAxis.Scale.Transform(lowError + errorTag.Error * 2); float clusterWidth = pane.BarSettings.GetClusterWidth(); //float barWidth = curve.GetBarWidth( pane ); float clusterGap = pane.BarSettings.MinClusterGap * barWidth; float barGap = barWidth * pane.BarSettings.MinBarGap; // Calculate the pixel location for the side of the bar (on the base axis) float pixSide = pixBase - clusterWidth / 2.0F + clusterGap / 2.0F + pos * (barWidth + barGap); // Draw the bar if (pane.BarSettings.Base == BarBase.X) { if (barWidth >= 3 && errorTag.Error > 0) { // Draw whiskers float pixMidX = (float)Math.Round(pixSide + barWidth / 2); // Line g.DrawLine(ErrorPen, pixMidX, pixHiError, pixMidX, pixLowError); if (barWidth >= PIX_TERM_WIDTH) { // Ends float pixLeft = pixMidX - (float)Math.Round(PIX_TERM_WIDTH / 2); float pixRight = pixLeft + PIX_TERM_WIDTH - 1; g.DrawLine(ErrorPen, pixLeft, pixHiError, pixRight, pixHiError); g.DrawLine(ErrorPen, pixLeft, pixLowError, pixRight, pixLowError); } } } else { if (barWidth >= 3 && errorTag.Error > 0) { // Draw whiskers float pixMidY = (float)Math.Round(pixSide + barWidth / 2) + 1; // Line g.DrawLine(ErrorPen, pixLowError, pixMidY, pixHiError, pixMidY); if (barWidth >= PIX_TERM_WIDTH) { // Ends float pixTop = pixMidY - (float)Math.Round(PIX_TERM_WIDTH / 2); float pixBottom = pixTop + PIX_TERM_WIDTH - 1; g.DrawLine(ErrorPen, pixHiError, pixTop, pixHiError, pixBottom); g.DrawLine(ErrorPen, pixLowError, pixTop, pixLowError, pixBottom); } } } }
public override Expression Scalar(Expression valueType, BondDataType expectedType, ValueHandler handler) { JsonToken scalarTokenType; if (!ScalarTokenTypes.TryGetValue(expectedType, out scalarTokenType)) { Debug.Assert(false, "Scalar should be called only on scalar expected types."); } Expression convertedValue; if (scalarTokenType == JsonToken.Integer) { // reader.Value is a boxed long and must be unboxed to the right type in order to // avoid an InvalidCastException. convertedValue = Expression.Convert(Reader.Value, typeof(long)); } else if (scalarTokenType == JsonToken.Float) { convertedValue = Expression.Convert(Reader.Value, typeof(double)); } else { convertedValue = Reader.Value; } var errorMessage = string.Format( CultureInfo.InvariantCulture, "Invalid input, expected JSON token of type {0}", scalarTokenType); return (Expression.Block( Expression.IfThenElse( JsonTokenEquals(JsonToken.Null), handler(Expression.Constant(null)), Expression.IfThenElse( JsonTokenEquals(scalarTokenType), handler(convertedValue), ThrowUnexpectedInput(errorMessage))), Reader.Read())); }
/// <summary> /// 根据code删除数据 /// </summary> /// <param name="code"></param> /// <returns></returns> public bool DelKeyManager(string code) { string str = "DELETE FROM YX_KeyManager WHERE KM_Code='" + ValueHandler.GetStringValue(code) + "'"; return(UpdateData(str)); }
internal void HandleValue(ValueHandler handler, Udbus.Parsing.ICodeParamType paramtype) { this.ObjectDelegateValue += handler.ObjectDelegate; }
/// <summary> /// 根据code查询用户 /// </summary> /// <param name="code"></param> /// <returns></returns> public DataTable GetUser(string code) { string str = "SELECT *,CONVERT(NVARCHAR(10),User_EntryDate,120)[time] FROM AF_User WHERE User_Code='" + ValueHandler.GetStringValue(code) + "'"; return(SearchData(str)); }
public Expression Bonded(ValueHandler handler) { if (schemaType.IsBonded()) { return handler(value); } var newBonded = bondedFactory(objectType, value); return handler(newBonded); }
/// <summary> /// 保存用户 /// </summary> /// <param name="aF_User"></param> /// <returns></returns> public string SaveUser(AF_User aF_User) { StringBuilder strSql = new StringBuilder(); if (ValueHandler.GetStringValue(aF_User.User_Code) == "") { DataTable dt = SearchData("SELECT COUNT(0) FROM AF_User WHERE User_LoginName='" + ValueHandler.GetStringValue(aF_User.User_LoginName) + "' OR User_Name='" + ValueHandler.GetStringValue(aF_User.User_Name) + "'"); if (Convert.ToInt32(dt.Rows[0][0]) > 0) { return(null); } } else { DataTable dt = SearchData("SELECT COUNT(0) FROM AF_User WHERE (User_LoginName='" + ValueHandler.GetStringValue(aF_User.User_LoginName) + "' OR User_Name='" + ValueHandler.GetStringValue(aF_User.User_Name) + "') And User_Code<>'" + ValueHandler.GetStringValue(aF_User.User_Code) + "'"); if (Convert.ToInt32(dt.Rows[0][0]) > 0) { return(null); } } strSql.Append("\r IF NOT EXISTS(SELECT * FROM AF_User WHERE User_Code ='" + ValueHandler.GetStringValue(aF_User.User_Code) + "')"); strSql.Append("\r BEGIN "); strSql.Append("\r INSERT INTO AF_User("); strSql.Append("User_Code,User_LoginName,User_Password,User_Name,User_Sex,User_Age,User_Phone,User_Post,User_EntryDate,User_Place,JoinMan"); strSql.Append(") SELECT "); string strCode = ValueHandler.GetStringValue(aF_User.User_Code); if (aF_User.User_Code == "") { strCode = GetCode(); } strSql.Append("\r User_Code = '" + strCode + "',"); strSql.Append(ConSql(aF_User)); strSql.Append("\r END"); strSql.Append("\r ELSE"); strSql.Append("\r BEGIN "); strSql.Append("UPDATE AF_User SET "); strSql.Append(ConSql(aF_User)); strSql.Append(" WHERE User_Code ='" + ValueHandler.GetStringValue(aF_User.User_Code) + "'"); strSql.Append("\r END"); UpdateData(strSql.ToString()); return(strCode); }
/// <summary> /// 查询 /// </summary> /// <param name="km_ProcinceName">省</param> /// <param name="km_CItyName">市</param> /// <param name="km_Name">关键字</param> /// <param name="PageIndex">页数</param> /// <param name="PageNum">条数</param> /// <returns></returns> public DataTable SearchWord(string km_ProcinceName, string km_Name, string PageIndex, string PageNum, string PlatForm, string Danger) { StringBuilder sb = new StringBuilder(); sb.Append("SELECT TOP(" + ValueHandler.GetIntNumberValue(PageNum) + ")* FROM(SELECT *,ROW_NUMBER() OVER (ORDER BY JoinDate DESC) AS 'Num' FROM YX_KeyManager WHERE 1=1"); if (km_ProcinceName != "") { sb.Append(" AND KM_ProvinceName='" + ValueHandler.GetStringValue(km_ProcinceName) + "'"); } //if (km_CityName != "") // sb.Append(" AND KM_CityName ='"+ValueHandler.GetStringValue(km_CityName)+"'"); if (km_Name != "") { sb.Append(" AND KM_Name LIKE '%" + ValueHandler.GetStringValue(km_Name) + "%'"); } if (PlatForm != "") { sb.Append(" AND KM_PlatForm = '" + ValueHandler.GetIntNumberValue(PlatForm) + "'"); } if (Danger != "") { sb.Append(" AND KM_DangerousDegree =" + Danger); } sb.AppendFormat(") T WHERE T.Num >(0+({0}-1)*{1}) order by Num asc", ValueHandler.GetIntNumberValue(PageIndex), ValueHandler.GetIntNumberValue(PageNum)); return(SearchData(sb.ToString())); }
public PlayerData(ValueHandler value) { moneySaveData = value.MoneySave; }
/// <summary> /// 新增、修改资讯信息 /// </summary> /// <param name="model">咨询信息实体类</param> /// <returns></returns> public bool Update(XXSD_PublicInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("\r IF NOT EXISTS(SELECT * FROM XXSD_PublicInfo WHERE Pub_Code ='" + ValueHandler.GetStringValue(model.Pub_Code) + "')"); strSql.Append("\r BEGIN "); strSql.Append("\r INSERT INTO XXSD_PublicInfo("); strSql.Append("Pub_Code,Pub_LS_Code1,Pub_LS_Code2,Pub_LS_Code3,Pub_LS_Code4,Pub_LS_Code5,Pub_SA_Code1,Pub_SA_Code2,Pub_SA_Code3,Pub_SA_Name1,Pub_SA_Name2,Pub_SA_Name3,Pub_Title,Pub_Pic1,Pub_Pic2,Pub_Pic3,Pub_Content,Pub_ArticleSource,Pub_KeyWords,JoinMan "); strSql.Append(") SELECT "); strSql.Append(" Pub_Code = '" + GetCode() + "', "); strSql.AppendFormat(GetXXSD_PublicInfo(model) + ",JoinMan='{0}'", model.JoinMan); strSql.Append("\r END"); strSql.Append("\r ELSE"); strSql.Append("\r BEGIN "); strSql.Append("UPDATE XXSD_PublicInfo SET "); strSql.Append(GetXXSD_PublicInfo(model)); strSql.Append(" WHERE Pub_Code ='" + ValueHandler.GetStringValue(model.Pub_Code) + "'"); strSql.Append("\r END"); if (strSql.Length > 0) { return(UpdateData(strSql.ToString())); } else { throw new Exception("无数据操作!"); } }
public static IEnumerable <IDictionary <string, object> > ToProperties(this IEnumerable <IDictionary <string, object> > objs, ValueHandler getValue, params string[] columnNames) { if (columnNames != null && columnNames.Length > 0) { List <IDictionary <string, object> > values = new List <IDictionary <string, object> >(); if (getValue != null) { foreach (IDictionary <string, object> obj in objs) { IDictionary <string, object> props = new Dictionary <string, object>(); foreach (var pair in obj) { if (columnNames.Contains(pair.Key)) { props.Add(pair.Key, getValue(pair.Key, (pair.Value != null ? pair.Value.GetType() : typeof(object)), pair.Value)); } } values.Add(props); } } else { foreach (IDictionary <string, object> obj in objs) { IDictionary <string, object> props = new Dictionary <string, object>(); foreach (var pair in obj) { if (columnNames.Contains(pair.Key)) { props.Add(pair.Key, pair.Value); } } values.Add(props); } } return(values); } else if (getValue != null) { List <IDictionary <string, object> > values = new List <IDictionary <string, object> >(); foreach (IDictionary <string, object> obj in objs) { IDictionary <string, object> props = new Dictionary <string, object>(); foreach (var pair in obj) { props.Add(pair.Key, getValue(pair.Key, (pair.Value != null ? pair.Value.GetType() : typeof(object)), pair.Value)); } values.Add(props); } return(values); } else { return(objs); } }
/// <summary> /// 检查是否是6列 /// </summary> /// <param name="fileName"></param> /// <returns></returns> public string CheckColumns(string obj) { string flag = "true"; try { ArrayList arr = JSON.getPara(obj); bool hasCheckQhdm = arr.Count > 2; string telNo = string.Empty; using (var client = new System.Net.WebClient()) { client.DownloadFile(ValueHandler.GetStringValue(arr[0]), HttpContext.Current.Request.PhysicalApplicationPath + "UpFile\\Files\\" + Path.GetFileName(ValueHandler.GetStringValue(arr[0]).Substring(ValueHandler.GetStringValue(arr[0]).LastIndexOf('/') + 1))); } if (hasCheckQhdm) { DataTable dt = new SqlBase().SearchData("SELECT TelNo FROM dbo.SYS_Area WHERE SA_Code='" + arr[4] + "'"); if (dt.Rows.Count > 0) { telNo = dt.Rows[0][0].ToString(); } } string fileName = ValueHandler.GetStringValue(arr[0]).Substring(ValueHandler.GetStringValue(arr[0]).LastIndexOf('/') + 1); string abPath = AppDomain.CurrentDomain.BaseDirectory + "\\UpFile\\Files\\"; using (StreamReader sr = new StreamReader(abPath + fileName, Encoding.GetEncoding("gb2312"))) { string str; int i = 0; while ((str = sr.ReadLine()) != null) { i++; string[] temp = str.Replace("\"", "").Split((char)9); if (str.Contains("\"") || str.Contains(",")) { flag = "special|" + i + "|" + str; break; } if (temp.Length < 7) { flag = "contentLen|" + i + "|" + str; break; } if (hasCheckQhdm) { if (temp[6] != telNo && i != 1) { flag = "false|" + i + "|" + str; break; } } } } } catch (Exception) { flag = "false"; } return(flag); }
public static IEnumerable <IDictionary <string, object> > ToProperties <T>(this IEnumerable <T> objs, ValueHandler getValue, params string[] columnNames) { if (objs is IEnumerable <IDictionary <string, object> > ) { if (getValue != null || (columnNames != null && columnNames.Length > 0)) { return(ToProperties((IEnumerable <IDictionary <string, object> >)objs, getValue, columnNames)); } else { return((IEnumerable <IDictionary <string, object> >)objs); } } Type type = typeof(T); var columns = type.GetFields(BindingFlags.Public | BindingFlags.Instance) .Select(f => new { ColumnName = f.Name, ColumnType = f.FieldType, IsField = true, MemberInfo = (MemberInfo)f }) .Union( type.GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(p => p.CanRead) .Where(p => p.GetGetMethod(true).IsPublic) .Where(p => p.GetIndexParameters().Length == 0) .Select(p => new { ColumnName = p.Name, ColumnType = p.PropertyType, IsField = false, MemberInfo = (MemberInfo)p }) ) .Where(c => (columnNames != null && columnNames.Length > 0 ? columnNames.Contains(c.ColumnName) : true)); // columns exist List <IDictionary <string, object> > values = new List <IDictionary <string, object> >(); if (getValue != null) { foreach (var obj in objs) { var dic = new Dictionary <string, object>(); foreach (var column in columns) { dic.Add(column.ColumnName, getValue(column.ColumnName, column.ColumnType, (column.IsField ? ((FieldInfo)column.MemberInfo).GetValue(obj) : ((PropertyInfo)column.MemberInfo).GetValue(obj, null)))); } values.Add(dic); } } else { foreach (var obj in objs) { var dic = new Dictionary <string, object>(); foreach (var column in columns) { dic.Add(column.ColumnName, (column.IsField ? ((FieldInfo)column.MemberInfo).GetValue(obj) : ((PropertyInfo)column.MemberInfo).GetValue(obj, null))); } values.Add(dic); } } return(values); }
public string InvalidData(object obj) { ArrayList arr = JSON.getPara(obj); bool flag = dAL_OriginalData.InvalidData(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[1])); if (flag) { return("true"); } return("false"); }
public static IEnumerable <IDictionary <string, object> > ToProperties(this IEnumerable <object> objs, ValueHandler getValue, params string[] columnNames) { if (getValue == null && (columnNames == null || columnNames.Length == 0) && objs is IEnumerable <IDictionary <string, object> > ) { return((IEnumerable <IDictionary <string, object> >)objs); } List <IDictionary <string, object> > values = new List <IDictionary <string, object> >(); foreach (var obj in objs) { values.Add(ToProperties(obj, getValue, columnNames)); } return(values); }
/// <summary> /// 批量导入数据 只处理空 - , / 全角 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string PlImportWQTOrignData(object obj) { ArrayList arr = JSON.getPara(obj); bool flag = dAL_OriginalData.PlImportWQTOrignData(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[1]), ValueHandler.GetStringValue(arr[2]) , ValueHandler.GetStringValue(arr[3]), ValueHandler.GetStringValue(arr[4]), ValueHandler.GetStringValue(arr[5]), ValueHandler.GetStringValue(BLL_User.User_Name)); if (flag) { return("true"); } return("false"); }
/// <summary> /// 获取修改记录 /// </summary> /// <param name="obj"></param> public string GetBillHistoryInfo(object obj) { ArrayList arr = JSON.getPara(obj); DataTable dt = dAL_BillHistory.GetBillHistoryInfo(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetIntNumberValue(arr[1]), ValueHandler.GetIntNumberValue(arr[2])); string json = JSON.DataTableToArrayList(dt); return(json); }
public string GetWQTOriginalDataDtsCount(object obj) { ArrayList arr = JSON.getPara(obj); return(dAL_OriginalData.GetWQTOriginalDataDtsCount(ValueHandler.GetStringValue(arr[0]))); }
/// <summary> /// 获取修改记录条数 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string GetBillHistoryCount(object obj) { ArrayList arr = JSON.getPara(obj); return(dAL_BillHistory.GetBillHistoryCount(ValueHandler.GetStringValue(arr[0]))); }
public Expression Bonded(ValueHandler handler) { throw new System.NotImplementedException(); }
/// <summary> /// 修改节点信息 /// </summary> /// <param name="obj"></param> /// <returns></returns> public string UpdateLevelSet(object obj) { ArrayList arr = JSON.getPara(obj); return(dAL_LevelSetDts.UpdateLevelSet(ValueHandler.GetStringValue(arr[0]), ValueHandler.GetStringValue(arr[1]), ValueHandler.GetStringValue(arr[2]), ValueHandler.GetStringValue(arr[3]))); }
public virtual void HandleCodeParamTypeValue(Udbus.Parsing.ICodeParamType paramtype, ValueHandler valuehandler) { this.HandleCodeParamTypeValue(paramtype); this.valuehandler = valuehandler; }
public Expression Scalar(Expression valueType, BondDataType expectedType, ValueHandler handler) { Debug.Assert(valueType is ConstantExpression); return(handler(reader.Read((BondDataType)(valueType as ConstantExpression).Value))); }
public Expression Scalar(Expression valueType, BondDataType expectedType, ValueHandler handler) { Debug.Assert(expectedType == schemaType.GetBondDataType()); return handler(typeAlias.Convert(value, schemaType)); }
///Creates a generic instance of ValueOutput public static ValueOutput <T> CreateInstance <T>(FlowNode parent, string name, string ID, ValueHandler <T> getter) { return(new ValueOutput <T>(parent, name, ID, getter)); }
private Point HandlePointValues(Point mousePt) { GraphPane pane; using (Graphics g = CreateGraphics()) { int iPt; object nearestObj; if (_masterPane.FindNearestPaneObject(mousePt, g, out pane, out nearestObj, out iPt)) { if (nearestObj is CurveItem && iPt >= 0) { CurveItem curve = (CurveItem) nearestObj; // Provide Callback for User to customize the tooltips if (PointValueEvent != null) { string label = PointValueEvent(this, pane, curve, iPt); if (!string.IsNullOrEmpty(label)) { pointToolTip.SetToolTip(this, label); pointToolTip.Active = true; } else pointToolTip.Active = false; } else { if (curve is PieItem) { pointToolTip.SetToolTip(this, ((PieItem) curve).Value.ToString(_pointValueFormat)); } // else if ( curve is OHLCBarItem || curve is JapaneseCandleStickItem ) // { // StockPt spt = (StockPt)curve.Points[iPt]; // this.pointToolTip.SetToolTip( this, ( (XDate) spt.Date ).ToString( "MM/dd/yyyy" ) + "\nOpen: $" + // spt.Open.ToString( "N2" ) + // "\nHigh: $" + // spt.High.ToString( "N2" ) + "\nLow: $" + // spt.Low.ToString( "N2" ) + "\nClose: $" + // spt.Close.ToString // ( "N2" ) ); // } else { PointPair pt = curve.Points[iPt]; if (pt.Tag is string) pointToolTip.SetToolTip(this, (string) pt.Tag); else { double xVal, yVal, lowVal; ValueHandler valueHandler = new ValueHandler(pane, false); if ((curve is BarItem || curve is ErrorBarItem || curve is HiLowBarItem) && pane.BarSettings.Base != BarBase.X) valueHandler.GetValues(curve, iPt, out yVal, out lowVal, out xVal); else valueHandler.GetValues(curve, iPt, out xVal, out lowVal, out yVal); string xStr = MakeValueLabel(curve.GetXAxis(pane), xVal, iPt, curve.IsOverrideOrdinal); string yStr = MakeValueLabel(curve.GetYAxis(pane), yVal, iPt, curve.IsOverrideOrdinal); pointToolTip.SetToolTip(this, "( " + xStr + ", " + yStr + " )"); //this.pointToolTip.SetToolTip( this, // curve.Points[iPt].ToString( this.pointValueFormat ) ); } } pointToolTip.Active = true; } } else pointToolTip.Active = false; } else pointToolTip.Active = false; //g.Dispose(); } return mousePt; }
private static void AddAttributes(ResultBox box, MethodInfo mi, ValueHandler valueHandler) { AddAttributes(box, valueHandler, mi.GetCustomAttribute <OptionAttribute>()); }