/// <summary> /// Creates a new instance of the ViewAuditoriaListaVerificacionDetalleCross class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewAuditoriaListaVerificacionDetalleCrossInfo MakeViewAuditoriaListaVerificacionDetalleCross(SqlDataReader dataReader) { ViewAuditoriaListaVerificacionDetalleCrossInfo viewAuditoriaListaVerificacionDetalleCross = new ViewAuditoriaListaVerificacionDetalleCrossInfo(); if (dataReader.IsDBNull(AuditoriaListaVerificacionDetalleCargoId) == false) viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionDetalleCargoId = dataReader.GetInt32(AuditoriaListaVerificacionDetalleCargoId); if (dataReader.IsDBNull(AuditoriaListaVerificacionDetalleId) == false) viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionDetalleId = dataReader.GetInt32(AuditoriaListaVerificacionDetalleId); if (dataReader.IsDBNull(AuditoriaListaVerificacionId) == false) viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionId = dataReader.GetInt32(AuditoriaListaVerificacionId); if (dataReader.IsDBNull(CargoId) == false) viewAuditoriaListaVerificacionDetalleCross.CargoId = dataReader.GetInt32(CargoId); if (dataReader.IsDBNull(Cargo) == false) viewAuditoriaListaVerificacionDetalleCross.Cargo = dataReader.GetString(Cargo); if (dataReader.IsDBNull(Activo) == false) viewAuditoriaListaVerificacionDetalleCross.Activo = dataReader.GetBoolean(Activo); if (dataReader.IsDBNull(AuditoriaPunto) == false) viewAuditoriaListaVerificacionDetalleCross.AuditoriaPunto = dataReader.GetString(AuditoriaPunto); if (dataReader.IsDBNull(AuditoriaControl) == false) viewAuditoriaListaVerificacionDetalleCross.AuditoriaControl = dataReader.GetString(AuditoriaControl); if (dataReader.IsDBNull(PuntajeRequerido) == false) viewAuditoriaListaVerificacionDetalleCross.PuntajeRequerido = dataReader.GetDecimal(PuntajeRequerido); if (dataReader.IsDBNull(Empresa) == false) viewAuditoriaListaVerificacionDetalleCross.Empresa = dataReader.GetString(Empresa); if (dataReader.IsDBNull(Orden) == false) viewAuditoriaListaVerificacionDetalleCross.Orden = dataReader.GetByte(Orden); return viewAuditoriaListaVerificacionDetalleCross; }
/// <summary> /// Creates a new instance of the ViewSeguridadUsuario class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewSeguridadUsuarioInfo MakeViewSeguridadUsuario(SqlDataReader dataReader) { ViewSeguridadUsuarioInfo viewSeguridadUsuario = new ViewSeguridadUsuarioInfo(); if (dataReader.IsDBNull(SeguridadUsuarioId) == false) viewSeguridadUsuario.SeguridadUsuarioId = dataReader.GetInt32(SeguridadUsuarioId); if (dataReader.IsDBNull(SeguridadRolId) == false) viewSeguridadUsuario.SeguridadRolId = dataReader.GetInt32(SeguridadRolId); if (dataReader.IsDBNull(Rol) == false) viewSeguridadUsuario.Rol = dataReader.GetString(Rol); if (dataReader.IsDBNull(NombreUsuario) == false) viewSeguridadUsuario.NombreUsuario = dataReader.GetString(NombreUsuario); if (dataReader.IsDBNull(Nombres) == false) viewSeguridadUsuario.Nombres = dataReader.GetString(Nombres); if (dataReader.IsDBNull(Apellidos) == false) viewSeguridadUsuario.Apellidos = dataReader.GetString(Apellidos); if (dataReader.IsDBNull(PaswordHash) == false) viewSeguridadUsuario.PaswordHash = dataReader.GetString(PaswordHash); if (dataReader.IsDBNull(Salt) == false) viewSeguridadUsuario.salt = dataReader.GetString(Salt); if (dataReader.IsDBNull(Activo) == false) viewSeguridadUsuario.Activo = dataReader.GetBoolean(Activo); if (dataReader.IsDBNull(NombreCompleto) == false) viewSeguridadUsuario.NombreCompleto = dataReader.GetString(NombreCompleto); return viewSeguridadUsuario; }
/// <summary> /// Loads the entity from a <b>SqlDataReader</b> object. /// </summary> /// <param name="dr">The data reader to read from.</param> /// <returns>Returns the number of columns read.</returns> /// <remarks> /// Always reads at the current cursor position, doesn't calls the <b>Read</b> function /// on the <b>SqlDataReader</b> object. Reads data columns by their ordinal position in /// the query and not by their names. /// </remarks> internal override int LoadFromDataReader(SqlDataReader dr) { int o = base.LoadFromDataReader(dr); ++o; // skip guid this.workflowTypeName = dr.GetString(++o); this.dateStarted = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o); this.dateFinished = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o); this.jobExecutionStatus = (JobExecutionState)dr.GetInt32(++o); this.suspendTimeout = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o); this.scheduleType = (ScheduleType)dr.GetInt32(++o); this.scheduleTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o); this.recurringPeriod = (RecurringPeriod)dr.GetInt32(++o); this.recurringInterval = dr.GetInt32(++o); this.recurringMask = dr.GetInt64(++o); this.workflowInstanceId = dr.IsDBNull(++o) ? Guid.Empty : dr.GetGuid(o); this.adminRequestTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o); if (!dr.IsDBNull(++o)) { XmlSerializer ser = new XmlSerializer(typeof(JobAdminRequestData)); StringReader sr = new StringReader(dr.GetString(o)); this.adminRequestData = (JobAdminRequestData)ser.Deserialize(sr); } else { this.adminRequestData = null; } this.adminRequestResult = dr.GetInt32(++o); this.exceptionMessage = dr.IsDBNull(++o) ? null : dr.GetString(o); return o; }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT FILE_INDEX, FILE_NEW_NAME, FILE_ORI_NAME, FILE_MD5, FILE_IMG, RECSTA, LDATE, LUSER FROM MIP_FILE_STORE WHERE FILE_INDEX=@FILE_INDEX_PARAM"; cmd.Parameters.AddWithValue("@FILE_INDEX_PARAM", _fILE_INDEX); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _fILE_INDEX = reader.GetInt32(0); _fILE_NEW_NAME = reader.GetString(1); _fILE_ORI_NAME = reader.GetString(2); _fILE_MD5 = reader.GetString(3); //_fILE_IMG = reader.GetByte(4); _fILE_IMG = (byte[])reader[4]; _rECSTA = reader.GetInt32(5); _lDATE = reader.GetDateTime(6); _lUSER = reader.GetString(7); } reader.Close(); } }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT MIP_MSG_NO, MSG_TARGET, RESERVATION, ONLINE_TIME, OFFLINE_TIME, DOPUSH, MSG_KIND_1, MSG_KIND_2, MSG_TITLE, MSG_CONTENT, MSG_STATE, LDATE, LUSER, SELECTALL, PROCESSED, ISNEW FROM MIP_MSG_MAIN WHERE "; System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _mIP_MSG_NO = reader.GetInt32(0); _mSG_TARGET = reader.GetString(1); _rESERVATION = reader.GetString(2); _oNLINE_TIME = reader.GetDateTime(3); _oFFLINE_TIME = reader.GetDateTime(4); _dOPUSH = reader.GetString(5); _mSG_KIND_1 = reader.GetString(6); _mSG_KIND_2 = reader.GetString(7); _mSG_TITLE = reader.GetString(8); _mSG_CONTENT = reader.GetString(9); _mSG_STATE = reader.GetString(10); _lDATE = reader.GetDateTime(11); _lUSER = reader.GetString(12); _sELECTALL = reader.GetInt32(13); _pROCESSED = reader.GetInt32(14); _iSNEW = reader.GetInt32(15); } reader.Close(); } }
/// <summary> /// 数据转用户实体 /// </summary> public static UserInfo DataToModel(SqlDataReader rdr) { UserInfo user = new UserInfo(); if (!rdr.IsDBNull(0)) user.UserID = rdr.GetInt32(0); if (!rdr.IsDBNull(1)) user.UserName = rdr.GetString(1); if (!rdr.IsDBNull(2)) user.UserPassword = rdr.GetString(2); if (!rdr.IsDBNull(3)) user.UserNickName = rdr.GetString(3); if (!rdr.IsDBNull(4)) user.UserImage = rdr.GetString(4); if (!rdr.IsDBNull(5)) user.UserPhone = rdr.GetString(5); if (!rdr.IsDBNull(6)) user.UserEmail = rdr.GetString(6); if (!rdr.IsDBNull(7)) user.UserTheme = rdr.GetString(7); if (!rdr.IsDBNull(8)) user.UserLevel = rdr.GetByte(8); if (!rdr.IsDBNull(9)) user.UserFrom = rdr.GetString(9); if (!rdr.IsDBNull(10)) user.ModifyDate = rdr.GetDateTime(10); if (!rdr.IsDBNull(11)) user.CreateDate = rdr.GetDateTime(11); if (!rdr.IsDBNull(12)) user.UserCity = rdr.GetString(12); if (!rdr.IsDBNull(13)) user.UserMoney = rdr.GetDecimal(13); if (!rdr.IsDBNull(14)) user.UserWorkDay = rdr.GetString(14); if (!rdr.IsDBNull(15)) user.UserFunction = rdr.GetString(15); if (!rdr.IsDBNull(16)) user.CategoryRate = rdr.GetInt32(16); if (!rdr.IsDBNull(17)) user.Synchronize = rdr.GetByte(17); if (!rdr.IsDBNull(18)) user.MoneyStart = rdr.GetDecimal(18); if (!rdr.IsDBNull(19)) user.IsUpdate = rdr.GetByte(19); return user; }
/// <summary> /// Creates a new instance of the ViewControlesAsignados class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewControlesAsignadosInfo MakeViewControlesAsignados(SqlDataReader dataReader) { ViewControlesAsignadosInfo viewControlesAsignados = new ViewControlesAsignadosInfo(); if (dataReader.IsDBNull(AuditoriaResultadoId) == false) viewControlesAsignados.AuditoriaResultadoId = dataReader.GetInt32(AuditoriaResultadoId); if (dataReader.IsDBNull(AuditoriaControlId) == false) viewControlesAsignados.AuditoriaControlId = dataReader.GetInt32(AuditoriaControlId); if (dataReader.IsDBNull(AuditoriaPuntoId) == false) viewControlesAsignados.AuditoriaPuntoId = dataReader.GetInt32(AuditoriaPuntoId); if (dataReader.IsDBNull(Punto) == false) viewControlesAsignados.Punto = dataReader.GetString(Punto); if (dataReader.IsDBNull(Control) == false) viewControlesAsignados.Control = dataReader.GetString(Control); if (dataReader.IsDBNull(AuditoriaId) == false) viewControlesAsignados.AuditoriaId = dataReader.GetInt32(AuditoriaId); if (dataReader.IsDBNull(PuntajeRequerido) == false) viewControlesAsignados.PuntajeRequerido = dataReader.GetDecimal(PuntajeRequerido); if (dataReader.IsDBNull(EsNoConformidad) == false) viewControlesAsignados.EsNoConformidad = dataReader.GetBoolean(EsNoConformidad); if (dataReader.IsDBNull(AuditoriaCausaRaizId) == false) viewControlesAsignados.AuditoriaCausaRaizId = dataReader.GetInt32(AuditoriaCausaRaizId); if (dataReader.IsDBNull(Observacion) == false) viewControlesAsignados.Observacion = dataReader.GetString(Observacion); if (dataReader.IsDBNull(Orden) == false) viewControlesAsignados.Orden = dataReader.GetByte(Orden); return viewControlesAsignados; }
public bool AuthTest(string username, string password, ref userType theUser) { bool autorised = false; OpenConnection(); Console.WriteLine("Debugging:"); soHigh(username, ref password); sqlCmd.CommandText = string.Format("select StaffName, Password, StaffTypeID, StaffID from Staff WHERE StaffName='{0}' AND Password='******';", username, password); sqlCmd.Connection = dbConnection; reader = sqlCmd.ExecuteReader(); if (reader.HasRows) { reader.Read(); if ((username == reader.GetString(0)) && (password == reader.GetString(1))) { userid = reader.GetInt32(3); theUser = (userType)reader.GetInt32(2); autorised = true; } } if(debugging){ AuthDebugging(username, password); } CloseConnection(); return autorised; }
/// <summary> /// 根据sqldatareader进行获取模型 /// </summary> /// <param name="sdr"></param> /// <returns></returns> public T_Member GetModelBySDR(SqlDataReader sdr) { T_Member t_m = null; if (sdr.Read()) { t_m = new T_Member(); t_m.F_Id = sdr.GetInt32(0); t_m.F_Email = sdr.GetString(1); t_m.F_Password = sdr.GetString(2); t_m.F_Sex = sdr.GetBoolean(3); t_m.F_NickName = sdr.GetString(4); t_m.F_Headpic = sdr.GetString(5); t_m.F_SecurityPassWord = sdr.GetString(6); t_m.F_Alipay = sdr.GetString(7); t_m.F_Issues = sdr.GetString(8); t_m.F_Answer = sdr.GetString(9); t_m.F_InitPassWord = sdr.GetString(10); t_m.F_Mobile = sdr.GetString(11); t_m.F_QQ = sdr.GetString(12); t_m.F_Level = sdr.GetInt32(13); t_m.F_Gold = sdr.GetInt32(14); t_m.F_Diamond = sdr.GetInt32(15); t_m.F_VIP = sdr.GetBoolean(16); t_m.F_KEY = sdr.GetString(17); t_m.F_Status = sdr.GetInt32(18); t_m.F_CreateDate = sdr.GetDateTime(19); } return t_m; }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT MIP_MSG_ID, MSG_NO, MSG_SOURCE, PCA_MSG_ID, ACCOUNTID, RESERVATION, ONLINE_TIME, OFFLINE_TIME, DOPUSH, MSG_KIND_1, MSG_KIND_2, MSG_TITLE, MSG_CONTENT, READ_STATE, READ_TIME, LDATE, REC_STA, PUSHED FROM MIP_MSG_DETAIL WHERE "; System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _mIP_MSG_ID = reader.GetInt32(0); _mSG_NO = reader.GetInt32(1); _mSG_SOURCE = reader.GetString(2); _pCA_MSG_ID = reader.GetString(3); _aCCOUNTID = reader.GetString(4); _rESERVATION = reader.GetString(5); _oNLINE_TIME = reader.GetDateTime(6); _oFFLINE_TIME = reader.GetDateTime(7); _dOPUSH = reader.GetString(8); _mSG_KIND_1 = reader.GetString(9); _mSG_KIND_2 = reader.GetString(10); _mSG_TITLE = reader.GetString(11); _mSG_CONTENT = reader.GetString(12); _rEAD_STATE = reader.GetString(13); _rEAD_TIME = reader.GetDateTime(14); _lDATE = reader.GetDateTime(15); _rEC_STA = reader.GetString(16); _pUSHED = reader.GetInt32(17); } reader.Close(); } }
/// <summary> /// Creates a new instance of the ViewLDV class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewLDVInfo MakeViewLDV(SqlDataReader dataReader) { ViewLDVInfo viewLDV = new ViewLDVInfo(); if (dataReader.IsDBNull(Cod_LDV) == false) viewLDV.Cod_LDV = dataReader.GetInt32(Cod_LDV); if (dataReader.IsDBNull(Cod_TipoLDV) == false) viewLDV.Cod_TipoLDV = dataReader.GetInt32(Cod_TipoLDV); if (dataReader.IsDBNull(Tipo_LDV) == false) viewLDV.Tipo_LDV = dataReader.GetString(Tipo_LDV); if (dataReader.IsDBNull(Nombre_Lugar) == false) viewLDV.Nombre_Lugar = dataReader.GetString(Nombre_Lugar); if (dataReader.IsDBNull(Cod_Direccion) == false) viewLDV.Cod_Direccion = dataReader.GetInt32(Cod_Direccion); if (dataReader.IsDBNull(Calle) == false) viewLDV.Calle = dataReader.GetString(Calle); if (dataReader.IsDBNull(Cod_Localidad) == false) viewLDV.Cod_Localidad = dataReader.GetInt32(Cod_Localidad); if (dataReader.IsDBNull(Localidad) == false) viewLDV.Localidad = dataReader.GetString(Localidad); if (dataReader.IsDBNull(Cod_Provincia) == false) viewLDV.Cod_Provincia = dataReader.GetInt32(Cod_Provincia); if (dataReader.IsDBNull(Provincia) == false) viewLDV.Provincia = dataReader.GetString(Provincia); return viewLDV; }
public Customer ReturnCustomer(int id) { Customer a = new Customer(); System.Data.SqlClient.SqlDataReader reader = null; string strSQL = "SELECT * FROM Customer WHERE ID = @id"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(strSQL, conn); cmd.Parameters.AddWithValue("@id", id); reader = cmd.ExecuteReader(); if (reader.Read()) { a.ID = reader.GetInt32(0); a.Email = reader.GetString(1); a.FirstName = reader.GetString(2); a.LastName = reader.GetString(3); a.Age = reader.GetInt32(4); a.PhoneNumber = reader.GetInt32(4); return(a); } else { return(null); } }
/// <summary> /// Constructs an instance of IStoreShardMap using a row from SqlDataReader starting at specified offset. /// </summary> /// <param name="reader">SqlDataReader whose row has shard map information.</param> /// <param name="offset">Reader offset for column that begins shard map information..</param> internal SqlShardMap(SqlDataReader reader, int offset) { this.Id = reader.GetGuid(offset); this.Name = reader.GetString(offset + 1); this.MapType = (ShardMapType)reader.GetInt32(offset + 2); this.KeyType = (ShardKeyType)reader.GetInt32(offset + 3); }
/// <summary> /// Creates a new instance of the ViewCalidadPlanAccion class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewCalidadPlanAccionInfo MakeViewCalidadPlanAccion(SqlDataReader dataReader) { ViewCalidadPlanAccionInfo viewCalidadPlanAccion = new ViewCalidadPlanAccionInfo(); if (dataReader.IsDBNull(CalidadPlanAccionId) == false) viewCalidadPlanAccion.CalidadPlanAccionId = dataReader.GetInt32(CalidadPlanAccionId); if (dataReader.IsDBNull(AuditorId) == false) viewCalidadPlanAccion.AuditorId = dataReader.GetInt32(AuditorId); if (dataReader.IsDBNull(NombreAuditor) == false) viewCalidadPlanAccion.NombreAuditor = dataReader.GetString(NombreAuditor); if (dataReader.IsDBNull(TerritorioId) == false) viewCalidadPlanAccion.TerritorioId = dataReader.GetInt32(TerritorioId); if (dataReader.IsDBNull(Territorio) == false) viewCalidadPlanAccion.Territorio = dataReader.GetString(Territorio); if (dataReader.IsDBNull(AuditoriaCausaRaizId) == false) viewCalidadPlanAccion.AuditoriaCausaRaizId = dataReader.GetInt32(AuditoriaCausaRaizId); if (dataReader.IsDBNull(CausaRaiz) == false) viewCalidadPlanAccion.CausaRaiz = dataReader.GetString(CausaRaiz); if (dataReader.IsDBNull(AccionPreventiva) == false) viewCalidadPlanAccion.AccionPreventiva = dataReader.GetString(AccionPreventiva); if (dataReader.IsDBNull(FechaPlaneada) == false) viewCalidadPlanAccion.FechaPlaneada = dataReader.GetDateTime(FechaPlaneada); if (dataReader.IsDBNull(Observacion) == false) viewCalidadPlanAccion.Observacion = dataReader.GetString(Observacion); if (dataReader.IsDBNull(FechaCierre) == false) viewCalidadPlanAccion.FechaCierre = dataReader.GetDateTime(FechaCierre); if (dataReader.IsDBNull(Estatus) == false) viewCalidadPlanAccion.Estatus = dataReader.GetString(Estatus); return viewCalidadPlanAccion; }
/// <summary> /// Creates a new instance of the ViewAuditoriaListaVerificacionDetalle class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewAuditoriaListaVerificacionDetalleInfo MakeViewAuditoriaListaVerificacionDetalle(SqlDataReader dataReader) { ViewAuditoriaListaVerificacionDetalleInfo viewAuditoriaListaVerificacionDetalle = new ViewAuditoriaListaVerificacionDetalleInfo(); if (dataReader.IsDBNull(AuditoriaListaVerificacionDetalleId) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaListaVerificacionDetalleId = dataReader.GetInt32(AuditoriaListaVerificacionDetalleId); if (dataReader.IsDBNull(AuditoriaListaVerificacionId) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaListaVerificacionId = dataReader.GetInt32(AuditoriaListaVerificacionId); if (dataReader.IsDBNull(AuditoriaPuntoId) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaPuntoId = dataReader.GetInt32(AuditoriaPuntoId); if (dataReader.IsDBNull(AuditoriaControlId) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaControlId = dataReader.GetInt32(AuditoriaControlId); if (dataReader.IsDBNull(PuntajeRequerido) == false) viewAuditoriaListaVerificacionDetalle.PuntajeRequerido = dataReader.GetDecimal(PuntajeRequerido); if (dataReader.IsDBNull(AuditoriaPunto) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaPunto = dataReader.GetString(AuditoriaPunto); if (dataReader.IsDBNull(AuditoriaControl) == false) viewAuditoriaListaVerificacionDetalle.AuditoriaControl = dataReader.GetString(AuditoriaControl); if (dataReader.IsDBNull(Orden) == false) viewAuditoriaListaVerificacionDetalle.Orden = dataReader.GetByte(Orden); if (dataReader.IsDBNull(Activo) == false) viewAuditoriaListaVerificacionDetalle.Activo = dataReader.GetBoolean(Activo); return viewAuditoriaListaVerificacionDetalle; }
public static NewMemberBalancePrediction Factory(SqlDataReader reader) { var newMemberId = reader.GetInt32(0); var dependentId = reader.GetInt32(1); var birthYear = reader.GetInt32(2); var state = reader.GetString(3); var lastCptCode = reader.GetString(4); var cachedBalance = reader.GetString(5); var recommendedBalance = reader.GetValue(6); double d; double.TryParse(recommendedBalance == null ? "0" : recommendedBalance.ToString(), out d); var sufficientAmount = reader.GetInt32(7); var serviceEnd = reader.GetDateTime(8); return new NewMemberBalancePrediction { NewMemberId = newMemberId, DependentId = dependentId, BirthYear = birthYear, State = state, LastCptCode = lastCptCode, CachedBalance = cachedBalance, RecommendedBalance = Math.Round(d, 2), SufficientAmount = sufficientAmount, ServiceEnd = serviceEnd }; }
public List <Product> SearchProductListByName(string searchvalue) { List <Product> ProductList = new List <Product>(); Dao dao = new Dao(); string sqlStatement = "SELECT ProductID, ProductName, Price, Quantity, Image, Description, CategoryID FROM Product where ProductName Like N'%" + searchvalue + "%'"; System.Data.SqlClient.SqlDataReader reader = dao.Get(sqlStatement); if (reader == null) { return(null); } while (reader.Read()) { try { int id = reader.GetInt32(0); string name = reader.GetString(1); double price = (double)reader.GetDecimal(2); int quantity = reader.GetInt32(3); string image = reader.GetString(4); string description = "sss"; int categoryID = reader.GetInt32(6); ProductList.Add(new Product(id, name, price, quantity, image, description, categoryID)); } catch (Exception) { } } dao.Con.Close(); return(ProductList); }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT MAIL_ID, APP_TYPE, SOURCE, EMAIL_ADDR, MAINORCC, NOTETXT, LDATA, LUSER FROM MIP_EMAIL WHERE MAIL_ID=@MAIL_ID_PARAM"; cmd.Parameters.AddWithValue("@MAIL_ID_PARAM", _mAIL_ID); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _mAIL_ID = reader.GetInt32(0); _aPP_TYPE = reader.GetInt32(1); _sOURCE = reader.GetString(2); _eMAIL_ADDR = reader.GetString(3); _mAINORCC = reader.GetInt32(4); _nOTETXT = reader.GetString(5); _lDATA = reader.GetDateTime(6); _lUSER = reader.GetString(7); } reader.Close(); } }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT version, sqltype, file_desc, fileUploadOldName, fileUploadNewName, datetime, version_no, imageData FROM userUploadLog WHERE "; System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _version = reader.GetInt32(0); _sqltype = reader.GetInt32(1); _file_desc = reader.GetString(2); _fileUploadOldName = reader.GetString(3); _fileUploadNewName = reader.GetString(4); _datetime = reader.GetDateTime(5); _version_no = reader.GetString(6); //_imageData = reader.GetBytes(7); _imageData = (byte[])reader[7]; } reader.Close(); } }
/// <summary> /// Constructs an instance of IStoreLocation using parts of a row from SqlDataReader. /// Used for creating the shard location instance. /// </summary> /// <param name="reader">SqlDataReader whose row has shard information.</param> /// <param name="offset">Reader offset for column that begins shard information.</param> internal SqlLocation(SqlDataReader reader, int offset) { this.Location = new ShardLocation( reader.GetString(offset + 1), reader.GetString(offset + 3), (SqlProtocol)reader.GetInt32(offset), reader.GetInt32(offset + 2)); }
public void PopulateCategory(SqlDataReader _dtr, Category obj) { int columnIndex = 0; columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ID); if (!_dtr.IsDBNull(columnIndex)) { obj.ID = _dtr.GetInt32((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_NAME); if (!_dtr.IsDBNull(columnIndex)) { obj.Name = _dtr.GetString((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_DESCRIPTION); if (!_dtr.IsDBNull(columnIndex)) { obj.Description = _dtr.GetString((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_TYPE); if (!_dtr.IsDBNull(columnIndex)) { obj.Type = (TG.ExpressCMS.DataLayer.Enums.RootEnums.CategoryType)_dtr.GetInt32((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ATTRIBUTES); if (!_dtr.IsDBNull(columnIndex)) { obj.Attributes = _dtr.GetString((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ISDELETED); if (!_dtr.IsDBNull(columnIndex)) { obj.IsDeleted = _dtr.GetBoolean((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_XSL_ID); if (!_dtr.IsDBNull(columnIndex)) { obj.XslID = _dtr.GetInt32((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_image); if (!_dtr.IsDBNull(columnIndex)) { obj.Image = _dtr.GetString((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_LANGUAGE_ID); if (!_dtr.IsDBNull(columnIndex)) { obj.LanguageID = _dtr.GetInt32((columnIndex)); } columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_HASH); if (!_dtr.IsDBNull(columnIndex)) { obj.Hash = _dtr.GetString((columnIndex)); } }
public EntityBase PopulateEntity(SqlDataReader reader) { Customer customer = new Customer(); if (!reader.IsDBNull(ord_CustomerID)) customer.CustomerID = reader.GetInt32(ord_CustomerID); if (!reader.IsDBNull(ord_FirstName)) customer.FirstName = reader.GetString(ord_FirstName); if (!reader.IsDBNull(ord_LastName)) customer.LastName = reader.GetString(ord_LastName); if (!reader.IsDBNull(ord_Age)) customer.Age = reader.GetInt32(ord_Age); if (!reader.IsDBNull(ord_EmailAddress)) customer.EmailAddress = reader.GetString(ord_EmailAddress); return customer; }
//protected void SearchButton_Click(object sender, EventArgs e) //{ // String term = SearchBox.Text; // StudentOpportunity.SelectParameters.Add("term", term); // StudentOpportunity.SelectCommand = "SELECT ApplicationRequest.ApplicationID, Student.StudentImage, CONCAT(Student.FirstName, ' ', Student.LastName) AS FullName, Student.StudentGradeLevel, Student.StudentGPA, Student.HoursOfWorkPlaceExp, JobListing.JobTitle, JobListing.JobDescription, JobListing.JobType, Organization.OrganizationName FROM ApplicationRequest INNER JOIN JobListing ON ApplicationRequest.JobListingID = JobListing.JobListingID INNER JOIN Organization ON JobListing.OrganizationID = Organization.OrganizationEntityID INNER JOIN Student ON ApplicationRequest.StudentEntityID = Student.StudentEntityID WHERE(ApplicationRequest.ApprovedFlag = 'P') and((Student.FirstName like '%" + @term + "%' or Student.LastName like '%" + @term + "%') or (JobListing.JobTitle like '%" + @term + "%') or (Organization.OrganizationName like '%" + @term + "%') or (Student.StudentGradeLevel like '%" + @term + "%') or (Student.StudentGPA like '%" + @term + "%') or (Student.HoursOfWorkPlaceExp like '%" + @term + "%') or (JobListing.JobDescription like '%" + @term + "%') or (JobListing.JobType like '%" + @term + "%'))"; // StudentOpportunity.DataBind(); // GridView1.DataBind(); // StudentOpportunity.SelectParameters.Clear(); //} protected void btnStudentView_Click(object sender, CommandEventArgs e) { String connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString; System.Data.SqlClient.SqlConnection sql = new System.Data.SqlClient.SqlConnection(connectionString); int rowIndex = Convert.ToInt32(((sender as LinkButton).NamingContainer as GridViewRow).RowIndex); int applicationID = Convert.ToInt32(e.CommandArgument); Session["applicationID"] = applicationID.ToString(); //find student ID from logID sql.Open(); System.Data.SqlClient.SqlCommand findStudentID = new System.Data.SqlClient.SqlCommand(); findStudentID.Connection = sql; findStudentID.CommandText = "SELECT StudentEntityID FROM ApplicationRequest WHERE applicationID = " + Session["applicationID"]; System.Data.SqlClient.SqlDataReader IDreader = findStudentID.ExecuteReader(); //declare studentID session variable Session["studentID"] = 0; while (IDreader.Read()) { Session["studentID"] = IDreader.GetInt32(0); } sql.Close(); //get student info for selected student sql.Open(); System.Data.SqlClient.SqlCommand getStudentInfo = new System.Data.SqlClient.SqlCommand(); getStudentInfo.Connection = sql; getStudentInfo.CommandText = "SELECT CONCAT(FirstName,' ',LastName), StudentGradeLevel, StudentGPA, StudentSATScore, HoursOfWorkPlaceExp, StudentEntityID, StudentImage FROM Student WHERE StudentEntityID = " + Session["studentID"]; System.Data.SqlClient.SqlDataReader studentReader = getStudentInfo.ExecuteReader(); while (studentReader.Read()) { //fill labels in modal lblStudentName.Text = studentReader.GetString(0); lblGradeLevel.Text = "Grade Level: " + studentReader.GetString(1); lblGPA.Text = "GPA: " + studentReader.GetDouble(2); lblSATScore.Text = "SAT Score: " + studentReader.GetInt32(3); lblHoursWorked.Text = "WBL Hours Earned: " + studentReader.GetInt32(4); imgStudent.ImageUrl = studentReader.GetString(6); } ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openviewStudentModal();", true); }
/// <summary> /// Creates a new instance of the ViewCargosPorLista class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewCargosPorListaInfo MakeViewCargosPorLista(SqlDataReader dataReader) { ViewCargosPorListaInfo viewCargosPorLista = new ViewCargosPorListaInfo(); if (dataReader.IsDBNull(AuditoriaListaVerificacionId) == false) viewCargosPorLista.AuditoriaListaVerificacionId = dataReader.GetInt32(AuditoriaListaVerificacionId); if (dataReader.IsDBNull(CargoId) == false) viewCargosPorLista.CargoId = dataReader.GetInt32(CargoId); if (dataReader.IsDBNull(Descripcion) == false) viewCargosPorLista.Descripcion = dataReader.GetString(Descripcion); return viewCargosPorLista; }
/// <summary> /// Creates a new instance of the DelegacionProvincia class and populates it with data from the specified SqlDataReader. /// </summary> private static DelegacionProvinciaInfo MakeDelegacionProvincia(SqlDataReader dataReader) { DelegacionProvinciaInfo delegacionProvincia = new DelegacionProvinciaInfo(); if (dataReader.IsDBNull(Cod_Delegacion) == false) delegacionProvincia.Cod_Delegacion = dataReader.GetInt32(Cod_Delegacion); if (dataReader.IsDBNull(Cod_Provincia) == false) delegacionProvincia.Cod_Provincia = dataReader.GetInt32(Cod_Provincia); if (dataReader.IsDBNull(Cod_APM) == false) delegacionProvincia.Cod_APM = dataReader.GetInt32(Cod_APM); return delegacionProvincia; }
/// <summary> /// Constructs an instance of IStoreLogEntry using parts of a row from SqlDataReader. /// Used for creating the store operation for Undo. /// </summary> /// <param name="reader">SqlDataReader whose row has operation information.</param> /// <param name="offset">Reader offset for column that begins operation information.</param> internal SqlLogEntry(SqlDataReader reader, int offset) { this.Id = reader.GetGuid(offset); this.OpCode = (StoreOperationCode)reader.GetInt32(offset + 1); this.Data = reader.GetSqlXml(offset + 2); this.UndoStartState = (StoreOperationState)reader.GetInt32(offset + 3); SqlGuid shardIdRemoves; shardIdRemoves = reader.GetSqlGuid(offset + 4); this.OriginalShardVersionRemoves = shardIdRemoves.IsNull ? default(Guid) : shardIdRemoves.Value; SqlGuid shardIdAdds; shardIdAdds = reader.GetSqlGuid(offset + 5); this.OriginalShardVersionAdds = shardIdAdds.IsNull ? default(Guid) : shardIdAdds.Value; }
/// <summary> /// Creates a new instance of the ART_SeguridadAcceso class and populates it with data from the specified SqlDataReader. /// </summary> private static ART_SeguridadAccesoInfo MakeART_SeguridadAcceso(SqlDataReader dataReader) { ART_SeguridadAccesoInfo aRT_SeguridadAcceso = new ART_SeguridadAccesoInfo(); if (dataReader.IsDBNull(SeguridadAccesoId) == false) aRT_SeguridadAcceso.SeguridadAccesoId = dataReader.GetInt32(SeguridadAccesoId); if (dataReader.IsDBNull(SeguridadModuloId) == false) aRT_SeguridadAcceso.SeguridadModuloId = dataReader.GetInt32(SeguridadModuloId); if (dataReader.IsDBNull(SeguridadRolId) == false) aRT_SeguridadAcceso.SeguridadRolId = dataReader.GetInt32(SeguridadRolId); return aRT_SeguridadAcceso; }
public HorarioAtencion crearObjetoHorarioAtencion(SqlDataReader resultado) { HorarioAtencion ha = new HorarioAtencion(); Medico me = new Medico(); me.Nombre = resultado.GetString(0); ha.Inicio = resultado.GetString(1); ha.Fin = resultado.GetString(2); ha.Consultorio = resultado.GetString(3); me.Id = resultado.GetInt32(4); ha.Id = resultado.GetInt32(5); ha.Medico = me; return ha; }
/// <summary> /// 数据转查询实体 /// </summary> public static UserQueryInfo DataToModel(SqlDataReader rdr) { UserQueryInfo query = new UserQueryInfo(); if (!rdr.IsDBNull(0)) query.UserQueryID = rdr.GetInt32(0); if (!rdr.IsDBNull(1)) query.UserQueryName = rdr.GetString(1); if (!rdr.IsDBNull(2)) query.UserQueryURL = rdr.GetString(2); if (!rdr.IsDBNull(3)) query.UserQueryValue = rdr.GetString(3); if (!rdr.IsDBNull(4)) query.UserQueryLive = rdr.GetByte(4); if (!rdr.IsDBNull(5)) query.UserID = rdr.GetInt32(5); if (!rdr.IsDBNull(6)) query.ModifyDate = rdr.GetDateTime(6); return query; }
/// <summary> /// Creates a new instance of the ViewAuditoresLideres class and populates it with data from the specified SqlDataReader. /// </summary> private static ViewAuditoresLideresInfo MakeViewAuditoresLideres(SqlDataReader dataReader) { ViewAuditoresLideresInfo viewAuditoresLideres = new ViewAuditoresLideresInfo(); if (dataReader.IsDBNull(AuditoriaId) == false) viewAuditoresLideres.AuditoriaId = dataReader.GetInt32(AuditoriaId); if (dataReader.IsDBNull(AuditorId) == false) viewAuditoresLideres.AuditorId = dataReader.GetInt32(AuditorId); if (dataReader.IsDBNull(NombreAuditor) == false) viewAuditoresLideres.NombreAuditor = dataReader.GetString(NombreAuditor); return viewAuditoresLideres; }
private UsuarioEntity CrearUsuario(SqlDataReader cursor) { UsuarioEntity usuario = new UsuarioEntity(); usuario.Id = cursor.GetInt32(cursor.GetOrdinal("UsuarioID")); usuario.Nombre = cursor.GetString(cursor.GetOrdinal("UsuarioNombre")); usuario.Perfil =char.Parse( cursor.GetValue(cursor.GetOrdinal("UsuarioPerfil")).ToString()); usuario.Email = cursor.GetString(cursor.GetOrdinal("UsuarioEmail")); usuario.Password = cursor.GetString(cursor.GetOrdinal("UsuarioPassword")); usuario.Provincia = cursor.GetString(cursor.GetOrdinal("UsuarioProvincia")); usuario.Ciudad = cursor.GetString(cursor.GetOrdinal("UsuarioCiudad")); if (!cursor.IsDBNull(cursor.GetOrdinal("UsuarioFoto"))) usuario.Foto = cursor.GetString(cursor.GetOrdinal("UsuarioFoto")); usuario.FechaRegistracion = cursor.GetDateTime(cursor.GetOrdinal("UsuarioFechaRegistracion")); if (!cursor.IsDBNull(cursor.GetOrdinal("UsuarioFechaActualizacion"))) usuario.FechaActualizacion = cursor.GetDateTime(cursor.GetOrdinal("UsuarioFechaActualizacion")); switch (usuario.Perfil) { case 'M': usuario.musico = new MusicoEntity(); usuario.musico.FechaNacimiento = cursor.GetDateTime(cursor.GetOrdinal("UsuarioFechaNacimiento")); usuario.musico.Genero = cursor.GetString(cursor.GetOrdinal("UsuarioGenero")); if (!cursor.IsDBNull(cursor.GetOrdinal("CuentaYoutube"))) usuario.musico.CuentaYoutube = cursor.GetString(cursor.GetOrdinal("CuentaYoutube")); if (!cursor.IsDBNull(cursor.GetOrdinal("CuentaFacebook"))) usuario.musico.CuentaFacebook = cursor.GetString(cursor.GetOrdinal("CuentaFacebook")); if (!cursor.IsDBNull(cursor.GetOrdinal("CuentaSoundCloud"))) usuario.musico.CuentaSoundCloud = cursor.GetString(cursor.GetOrdinal("CuentaSoundCloud")); if (!cursor.IsDBNull(cursor.GetOrdinal("CuentaTwitter"))) usuario.musico.CuentaTwitter = cursor.GetString(cursor.GetOrdinal("CuentaTwitter")); break; default: usuario.lugar = new LugarEntity(); usuario.lugar.DirCalle = cursor.GetString(cursor.GetOrdinal("DirCalle")); usuario.lugar.DirNumero = cursor.GetInt32(cursor.GetOrdinal("DirNro")); if (!cursor.IsDBNull(cursor.GetOrdinal("HorarioDesde"))) usuario.lugar.HorarioDesde = cursor.GetString(cursor.GetOrdinal("HorarioDesde")); if (!cursor.IsDBNull(cursor.GetOrdinal("HorarioHasta"))) usuario.lugar.HorarioHasta = cursor.GetString(cursor.GetOrdinal("HorarioHasta")); break; } return usuario; }
private Comment FillComment(SqlDataReader reader) { var comment = new Comment(); comment.Id = reader.GetInt32(0); comment.PostId = reader.GetInt32(1); comment.Name = reader.GetString(2); comment.Email = reader.GetValueOrDefault<string>(3); comment.Url = reader.GetValueOrDefault<string>(4); comment.Body = reader.GetString(5); comment.Status = (CommentStatus)reader.GetInt32(6); comment.DateCreated = reader.GetDateTime(7); return comment; }
/// <summary> /// 数据转专题实体 /// </summary> public static ZhuanTiInfo DataToModel(SqlDataReader rdr) { ZhuanTiInfo zhuanTi = new ZhuanTiInfo(); if (!rdr.IsDBNull(0)) zhuanTi.ZhuanTiID = rdr.GetInt32(0); if (!rdr.IsDBNull(1)) zhuanTi.ZhuanTiName = rdr.GetString(1); if (!rdr.IsDBNull(2)) zhuanTi.ZhuanTiImage = rdr.GetString(2); if (!rdr.IsDBNull(3)) zhuanTi.UserID = rdr.GetInt32(3); if (!rdr.IsDBNull(4)) zhuanTi.ZhuanTiLive = rdr.GetByte(4); if (!rdr.IsDBNull(5)) zhuanTi.Synchronize = rdr.GetByte(5); if (!rdr.IsDBNull(6)) zhuanTi.ModifyDate = rdr.GetDateTime(6); if (!rdr.IsDBNull(7)) zhuanTi.ZTID = rdr.GetInt32(7); return zhuanTi; }
/// <summary> /// 数据转第三方登录实体 /// </summary> public static OAuthInfo DataToModel(SqlDataReader rdr) { OAuthInfo oauth = new OAuthInfo(); if (!rdr.IsDBNull(0)) oauth.OAuthID = rdr.GetInt32(0); if (!rdr.IsDBNull(1)) oauth.OpenID = rdr.GetString(1); if (!rdr.IsDBNull(2)) oauth.AccessToken = rdr.GetString(2); if (!rdr.IsDBNull(3)) oauth.UserID = rdr.GetInt32(3); if (!rdr.IsDBNull(4)) oauth.OldUserID = rdr.GetInt32(4); if (!rdr.IsDBNull(5)) oauth.OAuthBound = rdr.GetByte(5); if (!rdr.IsDBNull(6)) oauth.OAuthFrom = rdr.GetString(6); if (!rdr.IsDBNull(7)) oauth.ModifyDate = rdr.GetDateTime(7); return oauth; }
private Post FillPost(SqlDataReader reader) { var post = new Post(); post.Id = reader.GetInt32(0); post.Author = new Author(); post.Author.Id = reader.GetInt32(1); post.Title = reader.GetValueOrDefault<string>(2); post.Body = reader.GetValueOrDefault<string>(3); post.IsPublished = reader.GetBoolean(4); post.DateCreated = reader.GetDateTime(5); return post; }
public void PrepareSingleModel(SqlDataReader dr, TopicCategoryInfo info) { while (dr.Read()) { info.ID = dr.GetInt32(0); info.FatherID = dr.GetInt32(1); info.CateName = dr[2].ToString(); info.CateCName = dr[3].ToString(); info.TopicCount = dr.GetInt32(4); info.Keywords = dr[5].ToString(); info.Description = dr[6].ToString(); info.OrderID = dr.GetInt32(7); } }
public static CategoryInfo CopyCategoryToBO(SqlDataReader rdr) { //CAT_ID, CAT_NAME, CAT_STATUS, CAT_MODERATION, CAT_SUBSCRIPTION, CAT_ORDER CategoryInfo category = new CategoryInfo { Id = rdr.GetInt32(0), Name = rdr.SafeGetString(1), Status = rdr.GetInt16(2), ModerationLevel = rdr.SafeGetInt32(3), SubscriptionLevel = rdr.SafeGetInt32(4), Order = rdr.GetInt32(5) }; return category; }
public static FaqInfo CopyFaqQuestionsToBO(SqlDataReader rdr) { FaqInfo faqquestion = new FaqInfo { Id = rdr.GetInt32(0), Link = rdr.SafeGetString(1), LinkTitle = rdr.SafeGetString(2), LinkBody = rdr.SafeGetString(3), CatId = rdr.GetInt32(4), Language = rdr.SafeGetString(5), Order = rdr.GetInt32(6) }; return faqquestion; }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT HAPPY_ID, CSTATUS, FILE_KIND, APPLY_TARGET, CKEY1, CKEY2, CKEY3, TITLE, URL, F_IDX, F_NAME, CORDER, LDATE, LUSER, SELECTALL, ISTESTER, ONLINE_TIME, OFFLINE_TIME FROM MIP_HAPPY WHERE HAPPY_ID=@HAPPY_ID_PARAM"; cmd.Parameters.AddWithValue("@HAPPY_ID_PARAM", _hAPPY_ID); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _hAPPY_ID = reader.GetInt32(0); _cSTATUS = reader.GetInt32(1); _fILE_KIND = reader.GetInt32(2); _aPPLY_TARGET = reader.GetInt32(3); _cKEY1 = reader.GetString(4); _cKEY2 = reader.GetString(5); _cKEY3 = reader.GetString(6); _tITLE = reader.GetString(7); _uRL = reader.GetString(8); _f_IDX = reader.GetInt32(9); _f_NAME = reader.GetString(10); _cORDER = reader.GetInt32(11); _lDATE = reader.GetDateTime(12); _lUSER = reader.GetString(13); _sELECTALL = reader.GetInt32(14); _iSTESTER = reader.GetInt32(15); _oNLINE_TIME = reader.GetDateTime(16); _oFFLINE_TIME = reader.GetDateTime(17); } reader.Close(); } }
public override UserOperationVO ReadRecord(System.Data.SqlClient.SqlDataReader reader) { UserOperationVO result = new UserOperationVO(); result.Id = reader.GetInt32(reader.GetOrdinal(idColumnName)); int userId = reader.GetInt32(reader.GetOrdinal(userOperationUserId)); int operationId = reader.GetInt32(reader.GetOrdinal(userOperationOperationId)); result.User = firstTableDAO.GetItem(userId); result.Operation = secondTableDAO.GetItem(operationId); firstTableDAO.CloseConnection(); secondTableDAO.CloseConnection(); return(result); }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT RecordID, ModuleDesc, FunctionDesc, ActionDesc, FieldDesc, FieldBefore, FieldAfter, Name, AccountID, cDatetime, Top5 FROM SecurityUserAccount_OperateRecord WHERE "; System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _recordID = reader.GetString(0); _moduleDesc = reader.GetString(1); _functionDesc = reader.GetString(2); _actionDesc = reader.GetString(3); _fieldDesc = reader.GetString(4); _fieldBefore = reader.GetString(5); _fieldAfter = reader.GetString(6); _name = reader.GetString(7); _accountID = reader.GetString(8); _cDatetime = reader.GetDateTime(9); _top5 = reader.GetInt32(10); } reader.Close(); } }
public string LoadMenu1(int CNMe, int level) { string result = string.Empty; string ConnectString = "server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan"; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); conn.ConnectionString = ConnectString; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "SELECT * FROM [Menu] WHERE [CNMe] = " + CNMe.ToString(); cmd.Connection = conn; conn.Open(); System.Data.SqlClient.SqlDataReader rd = cmd.ExecuteReader(); if (!rd.HasRows) { return(result); } else { result = "<ul>"; while (rd.Read()) { result += "<li>" + rd.GetString(rd.GetOrdinal("TenCN")) + "</li>"; result += LoadMenu1(Convert.ToInt32(rd.GetInt32(rd.GetOrdinal("Ma"))), level + 1); } result += "</ul>"; conn.Close(); } return(result); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Repair Items /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void HandleRepair(byte slot, int itemid) { try { //Here we use 2nd check for item durability to be sure the item repair is needed. //Check max durability on items < Need to check later for stats double checkdurability = Data.ItemBase[itemid].Defans.Durability; //Load our items MsSQL ms = new MsSQL("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "'"); using (System.Data.SqlClient.SqlDataReader reader = ms.Read()) { while (reader.Read()) { //Read durability from db int currentdurability = reader.GetInt32(7); //If durability is lower then item durability if (currentdurability < checkdurability) { //Send repair packet to client client.Send(Packet.RepairItems(slot, checkdurability)); //Update database information MsSQL.UpdateData("UPDATE char_items SET durability='" + checkdurability + "' WHERE id='" + itemid + "' AND owner='" + Character.Information.CharacterID + "' AND storagetype='0'"); } } } ms.Close(); } catch (Exception ex) { Console.WriteLine("Repair item error {0}", ex); Systems.Debugger.Write(ex); } }
public void LoadGuildMemberIds(int guildid, ref List <int> MemberIDs) { try { //Make sure we start with a clean list if (MemberIDs != null) { //If not null clear the list MemberIDs.Clear(); } //Create new query to get guild member information MsSQL ms = new MsSQL("SELECT * FROM guild_members WHERE guild_id='" + guildid + "'"); //Create sql data reader to read database content using (System.Data.SqlClient.SqlDataReader reader = ms.Read()) { //While the reader is reading while (reader.Read()) { //Add member id to the list MemberIDs.Add(reader.GetInt32(2)); } } } //Catch any bad exception error catch (Exception ex) { //Write information to debug log Systems.Debugger.Write(ex); } }
// Customer Functions public int NewCustomer(Customer custom) { string sqlString = "INSERT INTO Customer (Email,FirstName,LastName,Age,PhoneNumber) VALUES(@email,@fname,@lname,@age,@phnumber)"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlString, conn); cmd.Parameters.AddWithValue("@email", custom.Email); cmd.Parameters.AddWithValue("@fname", custom.FirstName); cmd.Parameters.AddWithValue("@lname", custom.LastName); cmd.Parameters.AddWithValue("@age", custom.Age); cmd.Parameters.AddWithValue("@phnumber", custom.PhoneNumber); cmd.ExecuteNonQuery(); System.Data.SqlClient.SqlDataReader reader = null; sqlString = "SELECT MAX(ID) FROM Customer"; cmd = new System.Data.SqlClient.SqlCommand(sqlString, conn); reader = cmd.ExecuteReader(); if (reader.Read()) { int id = reader.GetInt32(0); return(id); } else { return(-1); } }
//Device Functions public int NewDevice(Device custom) { string sqlString = "INSERT INTO Device (Type,Name,UUID,MAC) VALUES(@type,@name,@uuid,@mac)"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlString, conn); cmd.Parameters.AddWithValue("@type", custom.Type); cmd.Parameters.AddWithValue("@name", custom.Name); cmd.Parameters.AddWithValue("@uuid", custom.UUID); cmd.Parameters.AddWithValue("@mac", custom.MAC); cmd.ExecuteNonQuery(); System.Data.SqlClient.SqlDataReader reader = null; sqlString = "SELECT MAX(ID) FROM Device"; cmd = new System.Data.SqlClient.SqlCommand(sqlString, conn); reader = cmd.ExecuteReader(); if (reader.Read()) { int id = reader.GetInt32(0); return(id); } else { return(-1); } }
/// <summary> /// /// </summary> public void Load(System.Data.SqlClient.SqlConnection connection) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "SELECT logID, deviceid, phonetype, webservicenode, webservicemethod, webserviceparams, serverReturnData, sCreateDatetime, sRequestDatetime, webserviceparamsDecode, statuscode, ID, user_type, version FROM WebserviceLog WHERE "; System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); if (true == reader.Read()) { _logID = reader.GetString(0); _deviceid = reader.GetString(1); _phonetype = reader.GetString(2); _webservicenode = reader.GetString(3); _webservicemethod = reader.GetString(4); _webserviceparams = reader.GetString(5); _serverReturnData = reader.GetString(6); _sCreateDatetime = reader.GetDateTime(7); _sRequestDatetime = reader.GetDateTime(8); _webserviceparamsDecode = reader.GetString(9); _statuscode = reader.GetInt32(10); _iD = reader.GetString(11); _user_type = reader.GetString(12); _version = reader.GetString(13); } reader.Close(); } }
public List <Employee> GetEmployeeList() { List <Employee> employeeList = new List <Employee>(); Dao dao = new Dao(); string sqlStatement = "SELECT EmployeeID, EmployeeName, Gender, Position, StartDate, Address, PhoneNumber FROM Employee"; System.Data.SqlClient.SqlDataReader reader = dao.Get(sqlStatement); if (reader == null) { return(null); } while (reader.Read()) { int id = reader.GetInt32(0); string name = reader.GetString(1); bool gender = reader.GetBoolean(2); string position = reader.GetString(3); DateTime date = reader.GetDateTime(4); string address = reader.GetString(5); string phone = reader.GetString(6); employeeList.Add(new Employee(id, name, gender, position, date, address, phone)); } dao.Con.Close(); return(employeeList); }
///<summary></summary> protected override void ReadExecuted(System.Data.SqlClient.SqlDataReader dr) { if (dr != null && !dr.IsClosed) { #region Read Each Field if (!dr.IsDBNull(dr.GetOrdinal("ImageId"))) { m_Current.ImageId = dr.GetInt32(dr.GetOrdinal("ImageId")); } if (!dr.IsDBNull(dr.GetOrdinal("FileName"))) { m_Current.FileName = dr.GetString(dr.GetOrdinal("FileName")); } if (!dr.IsDBNull(dr.GetOrdinal("Extension"))) { m_Current.Extension = dr.GetString(dr.GetOrdinal("Extension")); } if (!dr.IsDBNull(dr.GetOrdinal("ProjectFileDirectory"))) { m_Current.ProjectFileDirectory = dr.GetString(dr.GetOrdinal("ProjectFileDirectory")); } if (!dr.IsDBNull(dr.GetOrdinal("Description"))) { m_Current.Description = dr.GetString(dr.GetOrdinal("Description")); } if (!dr.IsDBNull(dr.GetOrdinal("Enabled"))) { m_Current.Enabled = dr.GetBoolean(dr.GetOrdinal("Enabled")); } #endregion ExistsInDB = true; Mode = EditMode.None; SetOriginalValues(); } }
public List <Settings> GetAll() { System.Data.SqlClient.SqlCommand cmd = null; System.Data.SqlClient.SqlDataReader SDR = null; System.Collections.Generic.List <Settings> ListTmp = new System.Collections.Generic.List <Settings>(); Settings ObjTmp = null; DBCon Obj = new DBCon(); try { string Query = "SELECT * FROM Settings "; cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con); SDR = cmd.ExecuteReader(); while (SDR.Read()) { ObjTmp = new Settings { SettingId = SDR.GetInt32(0), KeyName = SDR.GetString(1), KeyValue = SDR.GetString(2), KeyDiscription = SDR.GetString(3), }; ListTmp.Add(ObjTmp); } } catch (System.Exception e) { e.ToString(); } finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; } return(ListTmp); }
protected void btnClockIn_Click(object sender, EventArgs e) { int personID; personID = -1; int departmentID = 1; try { System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); sc.ConnectionString = @"Server=LOCALHOST; Database=Wildlife;Trusted_Connection=Yes;"; sc.Open(); System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand(); insert.Connection = sc; insert.CommandText = "SELECT Person_ID, Person_Email, Person_UserType FROM Person WHERE Person_Email = '" + username.Text.ToString() + "'"; insert.ExecuteNonQuery(); System.Data.SqlClient.SqlDataReader reader = insert.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { personID = reader.GetInt32(0); } reader.Close(); insert.CommandText = "INSERT INTO LogHours(LogHours_PersonID, LogHours_BeginTime) VALUES(" + personID + ", getdate())"; insert.ExecuteNonQuery(); Response.Redirect("clockin.aspx"); } sc.Close(); } catch (System.Data.SqlClient.SqlException sqlException) { System.Diagnostics.Debug.WriteLine(sqlException); } }
///<summary></summary> protected override void ReadExecuted(System.Data.SqlClient.SqlDataReader dr) { if (dr != null && !dr.IsClosed) { #region Read Each Field if (!dr.IsDBNull(dr.GetOrdinal("Id"))) { m_Current.Id = dr.GetInt32(dr.GetOrdinal("Id")); } if (!dr.IsDBNull(dr.GetOrdinal("Name"))) { m_Current.Name = dr.GetString(dr.GetOrdinal("Name")); } if (!dr.IsDBNull(dr.GetOrdinal("UrlSlug"))) { m_Current.UrlSlug = dr.GetString(dr.GetOrdinal("UrlSlug")); } if (!dr.IsDBNull(dr.GetOrdinal("Description"))) { m_Current.Description = dr.GetString(dr.GetOrdinal("Description")); } #endregion ExistsInDB = true; Mode = EditMode.None; SetOriginalValues(); } }
protected void Button1_Click(object sender, EventArgs e) { Database db = new Database(); db.Open(); String username = (String)Session["username"]; String sql = "Select FileName,SizeInBytes From Files Where ID = " + int.Parse(TextBox1.Text); System.Data.SqlClient.SqlDataReader dr = db.ExecuteReader(sql); dr.Read(); String filename = dr.GetString(0); int size = dr.GetInt32(1); db.Close(); System.IO.StreamWriter sw = System.IO.File.CreateText("D://delete//" + TextBox1.Text + ".txt"); sw.WriteLine(username); sw.WriteLine(filename); sw.WriteLine(size); sw.Close(); db.Open(); sql = "Delete From Files Where ID = " + int.Parse(TextBox1.Text); db.Execute(sql); db.Close(); Session.Add("message", "File Deleted Successfully Successfully!!"); Response.Redirect("~//Message.aspx"); }
///<summary></summary> protected override void ReadExecuted(System.Data.SqlClient.SqlDataReader dr) { if (dr != null && !dr.IsClosed) { #region Read Each Field if (!dr.IsDBNull(dr.GetOrdinal("Id"))) { m_Current.Id = dr.GetInt32(dr.GetOrdinal("Id")); } if (!dr.IsDBNull(dr.GetOrdinal("Title"))) { m_Current.Title = dr.GetString(dr.GetOrdinal("Title")); } if (!dr.IsDBNull(dr.GetOrdinal("Body"))) { m_Current.Body = dr.GetString(dr.GetOrdinal("Body")); } if (!dr.IsDBNull(dr.GetOrdinal("ShortDesc"))) { m_Current.ShortDesc = dr.GetString(dr.GetOrdinal("ShortDesc")); } if (!dr.IsDBNull(dr.GetOrdinal("Description"))) { m_Current.Description = dr.GetString(dr.GetOrdinal("Description")); } if (!dr.IsDBNull(dr.GetOrdinal("Meta"))) { m_Current.Meta = dr.GetString(dr.GetOrdinal("Meta")); } if (!dr.IsDBNull(dr.GetOrdinal("UrlSlug"))) { m_Current.UrlSlug = dr.GetString(dr.GetOrdinal("UrlSlug")); } if (!dr.IsDBNull(dr.GetOrdinal("Published"))) { m_Current.Published = dr.GetBoolean(dr.GetOrdinal("Published")); } if (!dr.IsDBNull(dr.GetOrdinal("PostedOn"))) { m_Current.PostedOn = dr.GetDateTime(dr.GetOrdinal("PostedOn")); } if (!dr.IsDBNull(dr.GetOrdinal("Modified"))) { m_Current.Modified = dr.GetDateTime(dr.GetOrdinal("Modified")); } if (!dr.IsDBNull(dr.GetOrdinal("Category"))) { m_Current.Category = dr.GetString(dr.GetOrdinal("Category")); } if (!dr.IsDBNull(dr.GetOrdinal("Enabled"))) { m_Current.Enabled = dr.GetBoolean(dr.GetOrdinal("Enabled")); } #endregion ExistsInDB = true; Mode = EditMode.None; SetOriginalValues(); } }
//Does not load the fileData column public override FileVO ReadRecord(System.Data.SqlClient.SqlDataReader reader) { FileVO result = new FileVO(); result.Id = reader.GetInt32(reader.GetOrdinal(idColumnName)); result.Name = reader[fileName].ToString(); DocumentDAO ddao = new DocumentDAO(); result.Document = ddao.GetItem(reader.GetInt32(reader.GetOrdinal(fileDocumentId))); ddao.CloseConnection(); short valInt = reader.GetInt16(reader.GetOrdinal(fileType)); result.Type = (FileVO.FileType)valInt; result.AdditionDateTime = reader.GetDateTime(reader.GetOrdinal(fileAdditionDate)); return(result); }
public RoleDal RoleFromReader(System.Data.SqlClient.SqlDataReader reader) { RoleDal proposedReturnValue = new RoleDal(); proposedReturnValue.RoleID = reader.GetInt32(OffsetToRoleID); proposedReturnValue.Role = reader.GetString(OffsetToRole); return(proposedReturnValue); }
public List <ReceiptDetail> GetReceiptDetailByReceiptId(int receiptId) { List <ReceiptDetail> receiptDetailList = new List <ReceiptDetail>(); Dao dao = new Dao(); string sqlStatement = "SELECT ProductID, Quantity, Total FROM ReceiptDetails WHERE ReceiptID='" + receiptId + "'"; System.Data.SqlClient.SqlDataReader reader = dao.Get(sqlStatement); while (reader.Read()) { int productID = reader.GetInt32(0); int quantity = reader.GetInt32(1); decimal total = reader.GetDecimal(2); receiptDetailList.Add(new ReceiptDetail(productID, quantity, Decimal.ToDouble(total))); } dao.Con.Close(); return(receiptDetailList); }
private void CreateCapacities(int id, int userId, System.Data.SqlClient.SqlCommand command) { List <int> capacities = new List <int>(); // get capacities to create that not already exists string sql = "SELECT PORProductClassCapacity.ProductCapacityId as CapacityId " + "FROM PORProductClassCapacity WITH (NOLOCK) LEFT OUTER JOIN " + "PORCapacity WITH (NOLOCK) ON PORProductClassCapacity.PORId = PORCapacity.PORId AND PORProductClassCapacity.ProductCapacityId = PORCapacity.CapacityId " + "WHERE (PORCapacity.CapacityId IS NULL) AND (PORProductClassCapacity.PORId = " + id.ToString() + ")"; command.CommandText = sql; System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { capacities.Add(reader.GetInt32(0)); } reader.Close(); foreach (int capacity in capacities) { sql = "insert into PORCapacity (PORId, CapacityID) values (" + id + ", " + capacity + "); SELECT IDENT_CURRENT('[PORCapacity]') AS ID"; command.CommandText = sql; int PORCapacityId = Convert.ToInt32(command.ExecuteScalar()); sql = "insert into durados_ChangeHistory (ViewName, PK, ActionId, UpdateUserId) values ('v_PORCapacity', '" + PORCapacityId + "', 1, " + userId + ")"; command.CommandText = sql; command.ExecuteNonQuery(); sql = "insert into PMM (PORCapacityId) values (" + PORCapacityId + "); SELECT IDENT_CURRENT('[PMM]') AS ID"; command.CommandText = sql; int PMMId = Convert.ToInt32(command.ExecuteScalar()); sql = "insert into durados_ChangeHistory (ViewName, PK, ActionId, UpdateUserId) values ('v_SamplesRequest', '" + PMMId + "', 1, " + userId + ")"; command.CommandText = sql; command.ExecuteNonQuery(); sql = "insert into PLM (PORCapacityId,PLMBEStatusId) values (" + PORCapacityId + ",5); SELECT IDENT_CURRENT('[PLM]') AS ID"; command.CommandText = sql; int PLMId = Convert.ToInt32(command.ExecuteScalar()); sql = "insert into durados_ChangeHistory (ViewName, PK, ActionId, UpdateUserId) values ('v_PLM', '" + PLMId + "', 1, " + userId + ")"; command.CommandText = sql; command.ExecuteNonQuery(); CreatePLMParameterModes(PLMId, userId, command); sql = "insert into Test (PORCapacity) values (" + PORCapacityId + "); SELECT IDENT_CURRENT('[Test]') AS ID"; command.CommandText = sql; int TestId = Convert.ToInt32(command.ExecuteScalar()); sql = "insert into durados_ChangeHistory (ViewName, PK, ActionId, UpdateUserId) values ('v_TEST', '" + TestId + "', 1, " + userId + ")"; command.CommandText = sql; command.ExecuteNonQuery(); } }
public override LogEntryVO ReadRecord(System.Data.SqlClient.SqlDataReader reader) { LogEntryVO result = new LogEntryVO(); result.Id = reader.GetInt32(reader.GetOrdinal(idColumnName)); result.DateTime = reader.GetDateTime(reader.GetOrdinal(logEntryDateTime)); result.Description = reader[logEntryDescription].ToString(); int userId = reader.GetInt32(reader.GetOrdinal(logEntryUserId)); int operationId = reader.GetInt32(reader.GetOrdinal(logEntryOperationId)); result.User = firstTableDAO.GetItem(userId); result.Operation = secondTableDAO.GetItem(operationId); firstTableDAO.CloseConnection(); secondTableDAO.CloseConnection(); return(result); }
public Account GetAccountByUsername(string username) { Account account = null; Dao dao = new Dao(); string sqlStatement = "SELECT AccountID, Password, UserRole, EmployeeID FROM Account WHERE username='******'"; System.Data.SqlClient.SqlDataReader reader = dao.Get(sqlStatement); if (reader.Read()) { int id = reader.GetInt32(0); string password = reader.GetString(1); int role = reader.GetInt32(2); int employeeId = reader.GetInt32(3); account = new Account(id, username, password, role, employeeId); } dao.Con.Close(); return(account); }