| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Core.LZMes.Client.UIL
- {
- public class FixDBManager
- {
- public static object[] FixValues(object[] values)
- {
- for (int i = 0; i < values.Length; i++)
- {
- if (values[i] == null)
- {
- values[i] = DBNull.Value;
- }
- else if (values[i].GetType().FullName == "System.String")
- {
- values[i] = ((string)values[i]).Length != 0 ? values[i] : DBNull.Value;
- }
- }
- return values;
- }
- public static string CheckNullStr(object obj)
- {
- if (obj == null || obj.GetType() == typeof(System.DBNull))
- {
- return "";
- }
- else
- {
- return Convert.ToString(obj);
- }
- }
- public static int CheckNullInt(object obj)
- {
- if (obj == null || obj.GetType() == typeof(System.DBNull))
- {
- return 0;
- }
- else
- {
- return Convert.ToInt32(obj);
- }
- }
- public static System.Decimal CheckNullDecimal(object obj)
- {
- if (obj == null || obj.GetType() == typeof(System.DBNull))
- {
- return 0;
- }
- else
- {
- return Convert.ToDecimal(obj);
- }
- }
- }
- }
|