public static void GetDBNullData(DBNull instance, SerializationInfo info, StreamingContext ctx) { info.AddValue("Data", null); info.AddValue("UnityType", (int)UnityType.DBNull); info.AddValue("AssemblyName", instance.GetType().Assembly.FullName); info.SetType(typeof(UnitySerializationHolder)); }
/// <summary> /// 将各类型值转为 Excel 能接受的值 /// </summary> /// <param name="obj"></param> /// <returns></returns> public static object ToExcelObject(object obj) { #region DBNull System.DBNull dbNull = obj as System.DBNull; if (dbNull != null) { return(string.Empty); } #endregion #region bool || byte if (obj is bool || obj is byte) { int n = System.Convert.ToInt32(obj); return(ToExcelObject(n)); } #endregion #region Guid if (obj is System.Guid) { return(obj.ToString()); } #endregion #region byte[] byte[] aryBytes = obj as byte[]; if (aryBytes != null) { return(Apq.Data.SqlClient.Common.ConvertToSqlON(System.Data.SqlDbType.VarBinary, aryBytes)); } #endregion return(obj); }
public int Save(MODEL.WeightEntries weightentries, DBNull t2) { var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtweightentriesType = new DataTable(); dtweightentriesType.Columns.Add("WeightTrackerID", typeof(int)); dtweightentriesType.Columns.Add("ProfileID", typeof(int)); dtweightentriesType.Columns.Add("Weight", typeof(decimal)); dtweightentriesType.Columns.Add("CreatedDate",typeof(DateTime)); DateTime stcreateddate =Convert.ToDateTime(weightentries.CreatedDate); dtweightentriesType.Rows.Add(weightentries.WeightTrackerID, weightentries.ProfileID, weightentries.Weight, stcreateddate); // dtweightentriesType.Rows.Add(null,6,null,"2015-12-30 18:05:54.993"); var spsaveweightTracker = new SqlParameter(); spsaveweightTracker.ParameterName = "@WeightTrackerType"; spsaveweightTracker.Value = dtweightentriesType; spsaveweightTracker.SqlDbType = SqlDbType.Structured; spsaveweightTracker.TypeName = "WeightTrackerType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); // caseId.Value = "PTG"; caseId.Value = weightentries.LoggedInUser; result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveweightTracker + " @WeightTrackerType, @LoggedInUser", new object[] { spsaveweightTracker, caseId }); if (result == 0) { return 0; } else { return 1; } }
static public Int32DbField GetCdEstado(System.DBNull val) { Int32DbField dbfield = _GetCdEstado(); dbfield.IsNullValue = true; return(dbfield); }
static public StringDbField GetUfEstado(System.DBNull val) { StringDbField dbfield = _GetUfEstado(); dbfield.IsNullValue = true; return(dbfield); }
public static void GetDBNullData (DBNull instance, SerializationInfo info, StreamingContext ctx) { info.AddValue ("Data", null); info.AddValue ("UnityType", (int) UnityType.DBNull); info.AddValue ("AssemblyName", instance.GetType().Assembly.FullName); info.SetType (typeof (UnitySerializationHolder)); }
public static string CadenaRecortada(System.DBNull valor, int longitud) { try { return(""); } catch (System.Exception ex) { return(""); } }
public static bool Bool(System.DBNull valor) { try { return(false); } catch (System.Exception ex) { return(false); } }
public static string Cadena(System.DBNull valor) { try { return(""); } catch (System.Exception ex) { return(""); } }
public void DumpAndLogLocals(Desharp.Level logLevel) { System.DateTimeOffset a = DateTimeOffset.Now; System.DateTime b = DateTime.Now; System.TimeSpan c = TimeSpan.FromTicks(DateTime.Now.Ticks); System.DBNull d = System.DBNull.Value; System.Guid e = this.GetType().GUID; System.Text.StringBuilder f = new System.Text.StringBuilder("String builder test value"); Desharp.Debug.Dump(a, b, c, d, e, f); Desharp.Debug.Log(a, logLevel); Desharp.Debug.Log(b, logLevel); Desharp.Debug.Log(c, logLevel); Desharp.Debug.Log(d, logLevel); Desharp.Debug.Log(e, logLevel); Desharp.Debug.Log(f, logLevel); }
public int Save(MODEL.ProfileJournal profilejournal, DBNull t2) { var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtProfileJournalType = new DataTable(); dtProfileJournalType.Columns.Add("ProfileJournalID", typeof(string)); dtProfileJournalType.Columns.Add("ProfileID", typeof(int)); dtProfileJournalType.Columns.Add("JournalTitle", typeof(string)); dtProfileJournalType.Columns.Add("JournalInfo", typeof(string)); dtProfileJournalType.Columns.Add("JournalAsset", typeof(string)); dtProfileJournalType.Columns.Add("JournalTypeID", typeof(int)); //dtProfileJournalType.Columns.Add("CreatedDate", typeof(string)); dtProfileJournalType.Columns.Add("CreatedDate", typeof(DateTime)); //dtProfileJournalType.Columns.Add("CreatedBy", typeof(string)); dtProfileJournalType.Rows.Add(profilejournal.ProfileJournalID, profilejournal.ProfileID, profilejournal.JournalTitle, profilejournal.JournalInfo, profilejournal.JournalAsset, profilejournal.JournalTypeID, profilejournal.CreatedDate); // dtProfileJournalType.Rows.Add(5, 2, "sirisha", null, "~/Images-Upload/gallery_img1.png", 2); var spSaveProfileJournal = new SqlParameter(); spSaveProfileJournal.ParameterName = "@ProfileJournalType"; spSaveProfileJournal.Value = dtProfileJournalType; spSaveProfileJournal.SqlDbType = SqlDbType.Structured; spSaveProfileJournal.TypeName = "ProfileJournalType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); // caseId.Value = "PTG"; caseId.Value = profilejournal.LoggedInUser; result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileJournal + " @ProfileJournalType, @LoggedInUser", new object[] { spSaveProfileJournal, caseId }); if (result == 0) { return 0; } else { return 1; } }
public int Save(MODEL.NotificationType notificationtype, DBNull t2) { var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtnotificationType = new DataTable(); dtnotificationType.Columns.Add("NotificationID", typeof(int)); dtnotificationType.Columns.Add("NotificationTypeID", typeof(int)); dtnotificationType.Columns.Add("ProfileID", typeof(int)); dtnotificationType.Columns.Add("Title", typeof(string)); dtnotificationType.Columns.Add("Comments", typeof(string)); dtnotificationType.Columns.Add("IsRead", typeof(bool)); dtnotificationType.Columns.Add("CreatedDate", typeof(DateTime)); dtnotificationType.Columns.Add("CreatedBy", typeof(string)); dtnotificationType.Rows.Add(notificationtype.NotificationID, notificationtype.NotificationTypeID, notificationtype.ProfileID, notificationtype.Title, notificationtype.Comments, notificationtype.IsRead, notificationtype.CreatedDate, notificationtype.CreatedBy); //dtnotificationType.Rows.Add(7,1,3,"Pregnancy",null,null,null,null); var spSaveNotifications = new SqlParameter(); spSaveNotifications.ParameterName = "@NotificationType"; spSaveNotifications.Value = dtnotificationType; spSaveNotifications.SqlDbType = SqlDbType.Structured; spSaveNotifications.TypeName = "NotificationType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); caseId.Value = notificationtype.LoggedInUser; // caseId.Value = "PTG"; result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveNotifications + " @NotificationType, @LoggedInUser", new object[] { spSaveNotifications, caseId }); if (result == 0) { return 0; } else { return 1; } }
public int Save(HospitalInfo hospitalinfo, DBNull t2) { var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtHospitalInfoType = new DataTable(); dtHospitalInfoType.Columns.Add("HospitalID", typeof(int)); dtHospitalInfoType.Columns.Add("HospitalName", typeof(string)); dtHospitalInfoType.Columns.Add("Description", typeof(string)); dtHospitalInfoType.Columns.Add("CreatedDate", typeof(DateTime)); dtHospitalInfoType.Columns.Add("CreatedBy", typeof(string)); dtHospitalInfoType.Columns.Add("ModifiedDate", typeof(DateTime)); dtHospitalInfoType.Columns.Add("ModifiedBy", typeof(string)); //dtHospitalInfoType.Rows.Add(hospitalinfo.HospitalID, hospitalinfo.HospitalName, hospitalinfo.Description, // hospitalinfo.CreatedDate, hospitalinfo.CreatedBy, hospitalinfo.ModifiedDate, // hospitalinfo.ModifiedBy); dtHospitalInfoType.Rows.Add(7, "dsggcxcf", "dsggfsf", null, null, null, null); var spSaveHospitalInfo = new SqlParameter(); spSaveHospitalInfo.ParameterName = "@HospitalType"; spSaveHospitalInfo.Value = dtHospitalInfoType; spSaveHospitalInfo.SqlDbType = SqlDbType.Structured; spSaveHospitalInfo.TypeName = "HospitalType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); //caseId.Value = hospitalinfo.LoggedInUser; caseId.Value = "PTG"; result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveHospitalInfo + "@HospitalType, @LoggedInUser", new object[] { spSaveHospitalInfo, caseId }); if (result == 0) { return 0; } else { return 1; } }
/// <summary> /// run sql return decimal. /// </summary> /// <param name="sql"></param> /// <param name="isNullAsVal"></param> /// <returns></returns> public static decimal RunSQLReturnDecimalVal(string sql, decimal isNullAsVal) { object obj = DBAccessOfOracle1.RunSQLReturnVal(sql); try { System.DBNull dbnull = (System.DBNull)obj; return(isNullAsVal); } catch { } try { return(decimal.Parse(obj.ToString())); } catch { throw new Exception("@执行方法DBAccessOfOracle1.RunSQLReturnDecimalVal(sql,isNullAsVal)错误,运行的结果是[" + obj + "].不能向float 转换,请检查sql=" + sql); } }
/// <summary> /// This method is used to save the Hospital Images /// </summary> /// <param name="hospitalimages"></param> /// <param name="t2"></param> /// <returns></returns> public int Save(MODEL.HospitalImages hospitalimages, DBNull t2) { var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtHospitalImagesType = new DataTable(); dtHospitalImagesType.Columns.Add("HospitalImagesID", typeof(int)); dtHospitalImagesType.Columns.Add("HospitalID", typeof(int)); dtHospitalImagesType.Columns.Add("AssetURL", typeof(string)); dtHospitalImagesType.Columns.Add("AssetText", typeof(string)); dtHospitalImagesType.Columns.Add("AssetImage", typeof(string)); dtHospitalImagesType.Columns.Add("AssetPositionID", typeof(byte)); dtHospitalImagesType.Rows.Add(hospitalimages.HospitalImagesID, hospitalimages.HospitalID, hospitalimages.AssetURL, hospitalimages.AssetText, hospitalimages.AssetImage,hospitalimages.AssetPositionID); // dtHospitalImagesType.Rows.Add(null,4,null); var spSaveHospitalImages = new SqlParameter(); spSaveHospitalImages.ParameterName = "@HospitalImagesType"; spSaveHospitalImages.Value = dtHospitalImagesType; spSaveHospitalImages.SqlDbType = SqlDbType.Structured; spSaveHospitalImages.TypeName = "HospitalImagesType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); //caseId.Value = "PTG"; caseId.Value = hospitalimages.LoggedInUser; result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveHospitalImages + " @HospitalImagesType, @LoggedInUser", new object[] { spSaveHospitalImages, caseId }); if (result == 0) { return 0; } else { return 1; } }
// Delete the Otdelen by ID_Room. public int DeleteRecord(int ID_Manufacture, DBNull Parent_ID) { SqlConnection conn = new SqlConnection(_connectionString); SqlCommand cmd = new SqlCommand("DELETE FROM Manufacture WHERE ID_Manufacture = @ID_Manufacture", conn); cmd.Parameters.Add("@ID_Manufacture", SqlDbType.Int).Value = ID_Manufacture; int result = 0; try { conn.Open(); result = cmd.ExecuteNonQuery(); } catch (SqlException e) { // Handle exception. } finally { conn.Close(); } return result; }
public static DbParameter AddParameterWithValue(this DbCommand command, String name, System.DBNull value) { var param = command.CreateParameter(); param.ParameterName = name; param.DbType = System.Data.DbType.Object; param.Value = value; command.Parameters.Add(param); return(param); }
public void BadBobbyBoJangles (string one, DBNull two, string bing) { }
/// <summary> /// This Method is for create new Profile . /// </summary> /// <param name="profileinfo"></param> /// <param name="t2"></param> /// <returns></returns> public int Save(ProfileInfo profileinfo, DBNull t2) { // byte[] byteArray = profileinfo.picture1; // MemoryStream ms = new MemoryStream(byteArray); // System.Drawing.Image im = System.Drawing.Image.FromStream(ms); //// im.Save("~/images/1111.jpg"); // System.Web.Hosting.HostingEnvironment.MapPath("~/Images-Upload/1111.jpg"); var result = 0; var dbCtx = new AdvocateHealthCareEntities(); var dtProfileInfoType = new DataTable(); dtProfileInfoType.Columns.Add("ProfileID", typeof(int)); dtProfileInfoType.Columns.Add("FirstName", typeof(string)); dtProfileInfoType.Columns.Add("LastName", typeof(string)); dtProfileInfoType.Columns.Add("Email", typeof(string)); dtProfileInfoType.Columns.Add("Password", typeof(string)); dtProfileInfoType.Columns.Add("LMPdate", typeof(DateTime)); dtProfileInfoType.Columns.Add("Picture", typeof(string)); dtProfileInfoType.Columns.Add("HospitalID", typeof(int)); dtProfileInfoType.Columns.Add("CreatedDate", typeof(DateTime)); dtProfileInfoType.Rows.Add(profileinfo.ProfileID, profileinfo.FirstName, profileinfo.LastName, profileinfo.Email, profileinfo.Password, profileinfo.LMPdate, profileinfo.Picture, profileinfo.HospitalID, profileinfo.CreatedDate); //dtProfileInfoType.Rows.Add(null, "dsggcxcf", "dsggfsf", "*****@*****.**", 123, null, null, 1, // DateTime.Now); var spSaveProfileInfo1 = new SqlParameter(); spSaveProfileInfo1.ParameterName = "@ProfileType"; spSaveProfileInfo1.Value = dtProfileInfoType; spSaveProfileInfo1.SqlDbType = SqlDbType.Structured; spSaveProfileInfo1.TypeName = "ProfileType"; var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar); // caseId.Value = "PTG"; caseId.Value = profileinfo.LoggedInUser; //This code is for Return the Output value var spReturn = new SqlParameter("RetVal", SqlDbType.Int, 100); spReturn.Direction = ParameterDirection.Output; //result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileInfo + " @ProfileType, @LoggedInUser", new object[] { spSaveProfileInfo1, caseId }); result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileInfo1 + " @ProfileType, @LoggedInUser,@RetVal OUTPUT", new object[] { spSaveProfileInfo1, caseId, spReturn }); return (int)spReturn.Value == 0 ? 0 : 1; //if (result >1) //{ // return 1; //} //else //{ // return 0; //} }
/// <summary> /// Return NULL /// </summary> /// <param name="p_data"></param> /// <returns></returns> public static string ExpressionFormat(System.DBNull p_data) { return("NULL"); }
public DBBoolean(DBNull aDBNull) { this.myValue = aDBNull; }
public static DBNull Placeholder(DBNull a, DBNull b) { throw ExceptionBuilder.InternalError("Placeholder(DBNull,DBNull) should never get called."); }
public static int Entero(System.DBNull valor) { return(0); }
public IDataParameter CriarParameter(string nomeParameter, DBNull dbType) { switch (this.banco) { case Banco.SQLSERVER: dbParameter = new SqlParameter(nomeParameter, dbType); break; case Banco.ORACLE: //dbParameter = new OracleParameter(nomeParameter, dbType); dbParameter = new SqlParameter(nomeParameter, dbType); break; default: break; } return dbParameter; }
public void WriteValue(DBNull value) { _output.WriteValue(value); }
public abstract void Add(string parameter, DBNull value);
public void Init() { _type = typeof (string); _type2 = typeof (SomeValues); _dbnull = DBNull.Value; _assembly = typeof (SomeValues).Assembly; _intEnum = IntEnum.bbb; _byteEnum = ByteEnum.ccc; _bool = true; _bool2 = false; _byte = 254; _char = 'A'; _dateTime = new DateTime (1972,7,13,1,20,59); _decimal = (decimal)101010.10101; _double = 123456.6789; _short = -19191; _int = -28282828; _long = 37373737373; _sbyte = -123; _float = (float)654321.321; _ushort = 61616; _uint = 464646464; _ulong = 55555555; Point p = new Point(); p.x = 56; p.y = 67; object boxedPoint = p; long i = 22; object boxedLong = i; _objects = new object[] { "string", (int)1234, null , /*boxedPoint, boxedPoint,*/ boxedLong, boxedLong}; _strings = new string[] { "an", "array", "of", "strings","I","repeat","an", "array", "of", "strings" }; _ints = new int[] { 4,5,6,7,8 }; _intsMulti = new int[2,3,4] { { {1,2,3,4},{5,6,7,8},{9,10,11,12}}, { {13,14,15,16},{17,18,19,20},{21,22,23,24} } }; _intsJagged = new int[2][] { new int[3] {1,2,3}, new int[2] {4,5} }; _simples = new SimpleClass[] { new SimpleClass('a'),new SimpleClass('b'),new SimpleClass('c') }; _simplesMulti = new SimpleClass[2,3] {{new SimpleClass('d'),new SimpleClass('e'),new SimpleClass('f')}, {new SimpleClass('g'),new SimpleClass('j'),new SimpleClass('h')}}; _simplesJagged = new SimpleClass[2][] { new SimpleClass[1] { new SimpleClass('i') }, new SimpleClass[2] {null, new SimpleClass('k')}}; _almostEmpty = new object[2000]; _almostEmpty[1000] = 4; _emptyObjectArray = new object[0]; _emptyTypeArray = new Type[0]; _emptySimpleArray = new SimpleClass[0]; _emptyIntArray = new int[0]; _emptyStringArray = new string[0]; _emptyPointArray = new Point[0]; _doubles = new double[] { 1010101.101010, 292929.29292, 3838383.38383, 4747474.474, 56565.5656565, 0, Double.NaN, Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity }; _sampleDelegate = new SampleDelegate(SampleCall); _sampleDelegate2 = new SampleDelegate(_simples[0].SampleCall); _sampleDelegate3 = new SampleDelegate(new SimpleClass('x').SampleCall); _sampleDelegateStatic = new SampleDelegate(SampleStaticCall); _sampleDelegateCombined = (SampleDelegate)Delegate.Combine (new Delegate[] {_sampleDelegate, _sampleDelegate2, _sampleDelegate3, _sampleDelegateStatic }); // This is to test that references are correctly solved _shared1 = new SimpleClass('A'); _shared2 = new SimpleClass('A'); _shared3 = _shared1; _falseSerializable = new FalseISerializable (2); }
/// <summary> /// Convert value to bytes and place in ByteContent at correct location /// </summary> /// <param name="field">Column information for the conversion</param> /// <param name="dbNull"></param> public void SetColumn(Field field, DBNull dbNull) { var chars = new char[field.Length]; for (var j = 0; j < field.Length; j++) chars[j] = ' '; Encoding.Default.GetBytes(chars, 0, chars.Length, ByteContent, field.DataAddress); Modified = true; }
private void registrar_Click(object sender, EventArgs e) { this.username = randomUser(); this.password = randomPassword(); this.intentosLogin = 0; this.habilitado = 1; this.primeraVez = 1; this.cantPubliGratuitas = DBNull.Value; this.reputacion = DBNull.Value; this.ventasSinRendir = DBNull.Value; if (chequearCampos()) { //MessageBox.Show("Usuario:\n\nusername: "******"\npassword: "******"\nintentosLogin: "******"\nhabilitado: " + habilitado.ToString() + "\nprimeraVez: " + primeraVez.ToString()); //MessageBox.Show("Empresa:\n\nrazonSocial: " + this.razonSocial + "\ncuit: " + this.cuit + "\ntelefono: " + this.telefono + "\ndireccion: " + this.direccion + "\ncodigoPostal: " + this.codigoPostal + "\nciudad: " + this.ciudad + "\nmail: " + this.mail + "\nnombreContacto: " + this.nombreContacto + "\nfechaCreacion: " + this.fechaCreacion.ToString()); cargarUsuario(); cargarEmpresa(); //MessageBox.Show("Alta de usuario realizada exitosamente.\n\nPuede ingresar al sistema mediante con los siguientes datos:\nUsername: "******"\nPassword: " + this.passwordNoHash); new Abm_Cliente.Confirmacion(this.username, this.passwordNoHash).Show(); } }
public void WriteMember(string name, DBNull value) { _output.WriteMember(name, value); }
public DBDecimal(DBNull aDBNull) { this.myValue = aDBNull; }
public DBNull[] ReverseDBNullArrayFromBody(DBNull[] input) { return (input == null) ? null : input.Reverse().ToArray(); }
public static bool __nonzero__(DBNull value) { return false; }
public DBInt64(DBNull aDBNull) { this.myValue = aDBNull; }
public static bool IsPrimitive(DBNull o) { return true; }
public void AddParameter(string mParameterName, System.DBNull mParameterValue) { _sqlCommand.Parameters.AddWithValue(mParameterName, mParameterValue); }
private void registrar_Click(object sender, EventArgs e) { this.username = randomUser(); this.password = randomPassword(); this.intentosLogin = 0; this.habilitado = 1; this.primeraVez = 1; this.cantPubliGratuitas = DBNull.Value; this.reputacion = DBNull.Value; this.ventasSinRendir = DBNull.Value; if (chequearCampos()) { //MessageBox.Show("Usuario:\n\nusername: "******"\npassword: "******"\nintentosLogin: "******"\nhabilitado: " + habilitado.ToString() + "\nprimeraVez: " + primeraVez.ToString()); //MessageBox.Show("Cliente:\n\ntipoDoc: " + this.tipoDoc + "\nnumDoc: " + this.numDoc.ToString() + "\nnombre: " + this.nombre + "\napellido: " + this.apellido + "\nemail: " + this.email + "\ntelefono: " + this.telefono + "\ndireccion: " + this.direccion + "\ncodPostal: " + this.codPostal + "\nfechaNacimiento: " + this.fechaNacimiento.ToString()); cargarUsuario(); cargarCliente(); //MessageBox.Show("Alta de usuario realizada exitosamente.\n\nPuede ingresar al sistema mediante con los siguientes datos:\nUsername: "******"\nPassword: " + this.passwordNoHash); new Confirmacion(this.username, this.passwordNoHash).Show(); } }
public DateTime BoJangles (string one, DBNull two, TestObject three) { return DateTime.Now; }
/// <summary> /// Returns a true null if the object is DBNull. /// </summary> /// <param name="obj">The obj.</param> /// <returns></returns> public static string CheckNull(DBNull obj) { return null; }
public Task<DBNull> EchoDBNullFromBody(DBNull input) // FromBody by default { return Task.Factory.StartNew(() => input); }
public DBString(DBNull aDBNull) { this.myValue = aDBNull; }
internal NameObjectCollectionBase(DBNull dummy) { }