public void GenerateArvatoBatchFileForAllBatches() { string connectionString = "server=sth3gisql;database=H3GI;uid=b4nuser;pwd=telex12;app=3TaskRunner"; // string connectionString = "server=uat3sql;database=H3GI;uid=b4nuser;pwd=telex12;app=3TaskRunner"; var batchIds = new List<int>(); using (var connection = new SqlConnection(connectionString)) { using (SqlCommand command = connection.CreateCommand()) { command.CommandType = CommandType.Text; command.CommandText = "SELECT BatchID FROM h3giBatch"; connection.Open(); using (var reader = new SafeDataReader(command.ExecuteReader())) { while (reader.Read()) { batchIds.Add(reader.GetInt32("BatchID")); } } } } var bus = ObjectFactory.GetInstance<IOnewayBus>(); foreach (int batchId in batchIds) { bus.Send(new ArvatoBatchCreatedEvent(batchId)); } }
/// <summary> /// Fetch LineItem. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public LineItem Fetch(LineItemCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(null); } LineItem item; using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_LineItem_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { item = Map(reader); } else { throw new Exception(String.Format("The record was not found in 'dbo.LineItem' using the following criteria: {0}.", criteria)); } } } } MarkOld(item); OnFetched(); return(item); }
private void Child_Insert(SqlConnection connection) { bool cancel = false; OnChildInserting(connection, ref cancel); if (cancel) { return; } if (connection.State != ConnectionState.Open) { connection.Open(); } const string commandText = "INSERT INTO [dbo].[Profiles] ([Username], [ApplicationName], [IsAnonymous], [LastActivityDate], [LastUpdatedDate]) VALUES (@p_Username, @p_ApplicationName, @p_IsAnonymous, @p_LastActivityDate, @p_LastUpdatedDate); SELECT [UniqueID] FROM [dbo].[Profiles] WHERE UniqueID = SCOPE_IDENTITY()"; using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddWithValue("@p_Username", this.Username); command.Parameters.AddWithValue("@p_ApplicationName", this.ApplicationName); command.Parameters.AddWithValue("@p_IsAnonymous", ADOHelper.NullCheck(this.IsAnonymous)); command.Parameters.AddWithValue("@p_LastActivityDate", ADOHelper.NullCheck(this.LastActivityDate)); command.Parameters.AddWithValue("@p_LastUpdatedDate", ADOHelper.NullCheck(this.LastUpdatedDate)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { // Update identity primary key value. LoadProperty(_uniqueIDProperty, reader.GetInt32("UniqueID")); } } } FieldManager.UpdateChildren(this, connection); OnChildInserted(); }
/// <summary> /// Fetch ProfileList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public ProfileList Fetch(ProfileCriteria criteria) { ProfileList item = (ProfileList)Activator.CreateInstance(typeof(ProfileList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. string commandText = String.Format("SELECT [UniqueID], [Username], [ApplicationName], [IsAnonymous], [LastActivityDate], [LastUpdatedDate] FROM [dbo].[Profiles] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new ProfileFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); OnFetched(); return(item); }
/// <summary> /// Fetch LineItemList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public LineItemList Fetch(LineItemCriteria criteria) { LineItemList item = (LineItemList)Activator.CreateInstance(typeof(LineItemList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. string commandText = String.Format("SELECT [OrderId], [LineNum], [ItemId], [Quantity], [UnitPrice] FROM [dbo].[LineItem] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new LineItemFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); OnFetched(); return(item); }
public IList <ComponentDto> Fetch() { using (var ctx = ConnectionManager <SqlConnection> .GetManager(_dbName)) { using (var cm = ctx.Connection.CreateCommand()) { cm.CommandType = CommandType.Text; cm.CommandText = "SELECT * FROM Reco3Component"; using (var dr = new SafeDataReader(cm.ExecuteReader())) { //if (dr.HasRows) { var result = new List <ComponentDto>(); while (dr.Read()) { var component = new ComponentDto { ComponentId = dr.GetInt32(0), PDNumber = dr.GetString(1), DownloadedTimestamp = dr.GetDateTime(2), Description = dr.GetString(3), PDStatus = dr.GetInt32(4), ComponentType = dr.GetInt32(5), Xml = dr.GetString(6), PDSource = dr.GetInt32(7), SourceComponentId = dr.GetInt32(8) }; result.Add(component); } ; return(result); //} //else { // return null; //} } } } }
/// <summary> /// Fetch Cart. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public Cart Fetch(CartCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(null); } Cart item; string commandText = String.Format("SELECT [CartId], [UniqueID], [ItemId], [Name], [Type], [Price], [CategoryId], [ProductId], [IsShoppingCart], [Quantity] FROM [dbo].[Cart] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { item = Map(reader); } else { throw new Exception(String.Format("The record was not found in 'dbo.Cart' using the following criteria: {0}.", criteria)); } } } } MarkOld(item); MarkAsChild(item); OnFetched(); return(item); }
private void DataPortal_Fetch(QueryBuilder queryBuilder) { RaiseListChangedEvents = false; using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { StringBuilder SQL = new StringBuilder(); SQL.Append("SELECT sh.orderdate,sh.SORTINGTASKNO,sdh.CIGCODE,sdh.CIGNAME,SUM(sdh.QTY) qty "); SQL.Append(" FROM t_sorting_line_task_history sh "); SQL.Append(" JOIN t_sorting_line_detail_task_history sdh "); SQL.Append(" ON sh.ID = sdh.TASKID where"); SQL.Append("(1 = 1 and ((@SORTINGTASKNO is null) or (sh.SORTINGTASKNO = @SORTINGTASKNO))) AND " + "(1 = 1 and ((@SORT_DATE is null) or (sh.ORDERDATE = @SORT_DATE))) AND " + "(1 = 1 and ((@CigCode is null) or (sdh.CigCode = @CigCode))) AND " + "(1 = 1 and ((@CigName is null) or (sdh.CigName like '%" + queryBuilder.cigname + "%')))"); SQL.Append(" GROUP BY sh.orderdate,sh.SORTINGTASKNO,sdh.CIGCODE,sdh.CIGNAME"); cm.CommandText = SQL.ToString(); cm.Parameters.AddWithValue("@SORTINGTASKNO", queryBuilder.taskno); cm.Parameters.AddWithValue("@SORT_DATE", queryBuilder.orderdate); cm.Parameters.AddWithValue("@CigCode", queryBuilder.cigcode); cm.Parameters.AddWithValue("@CigName", queryBuilder.cigname); using (var dr = new SafeDataReader(cm.ExecuteReader())) { IsReadOnly = false; while (dr.Read()) { var info = new SortingCigInfo(dr); // apply filter if necessary this.Add(info); } IsReadOnly = true; } } } RaiseListChangedEvents = true; }
/// <summary> /// Fetch LineItemList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public LineItemList Fetch(LineItemCriteria criteria) { LineItemList item = (LineItemList)Activator.CreateInstance(typeof(LineItemList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_LineItem_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new LineItemFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); OnFetched(); return(item); }
/// <summary> /// Fetch Account. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public Account Fetch(AccountCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(null); } Account item; string commandText = String.Format("SELECT [AccountId], [UniqueID], [Email], [FirstName], [LastName], [Address1], [Address2], [City], [State], [Zip], [Country], [Phone] FROM [dbo].[Account] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { item = Map(reader); } else { throw new Exception(String.Format("The record was not found in 'dbo.Account' using the following criteria: {0}.", criteria)); } } } } MarkOld(item); MarkAsChild(item); OnFetched(); return(item); }
private void DataPortal_Fetch(OrderStatusCriteria criteria) { bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return; } RaiseListChangedEvents = false; // Fetch Child objects. using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_OrderStatus_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { this.Add(PetShop.Tests.StoredProcedures.OrderStatus.GetOrderStatus(reader)); } while(reader.Read()); } } } } RaiseListChangedEvents = true; OnFetched(); }
private void Child_Fetch(CategoryCriteria criteria) { bool cancel = false; OnChildFetching(criteria, ref cancel); if (cancel) { return; } using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_Category_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); command.Parameters.AddWithValue("@p_NameHasValue", criteria.NameHasValue); command.Parameters.AddWithValue("@p_DescnHasValue", criteria.DescriptionHasValue); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { Map(reader); } else { throw new Exception(String.Format("The record was not found in 'dbo.Category' using the following criteria: {0}.", criteria)); } } } } OnChildFetched(); MarkAsChild(); }
protected override User ReaderToModel(SafeDataReader dr) { User user = new User(); user.Address = dr.GetString(nameof(User.Address)); user.Avatar = dr.GetString(nameof(User.Avatar)); user.Birthday = dr.GetDateTime(nameof(User.Birthday)); user.CreationDTime = dr.GetDateTime(nameof(User.CreationDTime)); //user.CustomId = dr.GetString(nameof(User.CustomId)); user.Email = dr.GetString(nameof(User.Email)); user.Gender = dr.GetInt16(nameof(User.Gender)) == 0 ? EGender.Male : EGender.Female; user.Hobby = dr.GetString(nameof(User.Hobby)); user.Id = dr.GetInt64(nameof(User.Id)); user.Name = dr.GetString(nameof(User.Name)); user.NickName = dr.GetString(nameof(User.NickName)); user.Password = dr.GetString(nameof(User.Password)); user.QQ = dr.GetString(nameof(User.QQ)); user.RealName = dr.GetString(nameof(User.RealName)); user.Remark = dr.GetString(nameof(User.Remark)); user.Signature = dr.GetString(nameof(User.Signature)); user.Telphone = dr.GetString(nameof(User.Telphone)); user.WeChat = dr.GetString(nameof(User.WeChat)); string gradeName = dr.GetString("GradeName"); if (string.IsNullOrEmpty(gradeName)) { gradeName = "贱民"; } Grade grade = new Grade() { Name = gradeName, Score = dr.GetInt64(nameof(Grade.Score)) }; user.UserGrade = grade; return(user); }
/// <summary> /// Fetch ProductList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public ProductList Fetch(ProductCriteria criteria) { ProductList item = (ProductList)Activator.CreateInstance(typeof(ProductList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. string commandText = String.Format("SELECT [ProductId], [CategoryId], [Name], [Descn], [Image] FROM [dbo].[Product] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new ProductFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); OnFetched(); return(item); }
private void DataPortal_Fetch(PKCriteria criteria) { Database.LogInfo("OrderDetail.DataPortal_Fetch", GetHashCode()); try { using (SqlConnection cn = Database.Northwind_SqlConnection) { ApplicationContext.LocalContext["cn"] = cn; using (SqlCommand cm = cn.CreateCommand()) { cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "getOrderDetail"; cm.Parameters.AddWithValue("@OrderID", criteria.OrderID); cm.Parameters.AddWithValue("@ProductID", criteria.ProductID); using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) { if (!dr.Read()) { _ErrorMessage = "No Record Found"; return; } ReadData(dr); } } // removing of item only needed for local data portal if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client) { ApplicationContext.LocalContext.Remove("cn"); } } } catch (Exception ex) { Database.LogException("OrderDetail.DataPortal_Fetch", ex); _ErrorMessage = ex.Message; throw new DbCslaException("OrderDetail.DataPortal_Fetch", ex); } }
private void Map(SafeDataReader reader) { bool cancel = false; OnMapping(reader, ref cancel); if (cancel) { return; } using (BypassPropertyChecks) { LoadProperty(_orderIdProperty, reader["OrderId"]); LoadProperty(_originalOrderIdProperty, reader["OrderId"]); LoadProperty(_lineNumProperty, reader["LineNum"]); LoadProperty(_originalLineNumProperty, reader["LineNum"]); LoadProperty(_itemIdProperty, reader["ItemId"]); LoadProperty(_quantityProperty, reader["Quantity"]); LoadProperty(_unitPriceProperty, reader["UnitPrice"]); } OnMapped(); }
private void DataPortal_Fetch(Criteria criteria) { RaiseListChangedEvents = false; using (SqlConnection cn = new SqlConnection(Database.ConnectionString)) { cn.Open(); using (SqlCommand cm = cn.CreateCommand()) { cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "[app_ministry].[ministry_member_get]"; cm.Parameters.AddWithValue("@code", criteria.Code); cm.Parameters.AddWithValue("@role", criteria.Role); cm.Parameters.AddWithValue("@from", criteria.From.DBValue); cm.Parameters.AddWithValue("@to", criteria.To.DBValue); using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) while (dr.Read()) { this.Add(MinistryMember.Get(dr)); } } } RaiseListChangedEvents = true; }
private InvoiceViewDto Fetch(IDataReader data) { var invoiceView = new InvoiceViewDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { invoiceView.InvoiceId = dr.GetGuid("InvoiceId"); invoiceView.InvoiceNumber = dr.GetString("InvoiceNumber"); invoiceView.CustomerId = dr.GetString("CustomerId"); invoiceView.InvoiceDate = dr.GetSmartDate("InvoiceDate", true); invoiceView.IsActive = dr.GetBoolean("IsActive"); invoiceView.CreateDate = dr.GetSmartDate("CreateDate", true); invoiceView.CreateUser = dr.GetInt32("CreateUser"); invoiceView.ChangeDate = dr.GetSmartDate("ChangeDate", true); invoiceView.ChangeUser = dr.GetInt32("ChangeUser"); invoiceView.RowVersion = dr.GetValue("RowVersion") as byte[]; } FetchChildren(dr); } return(invoiceView); }
private void Child_Fetch(string taskid) { RaiseListChangedEvents = false; using (var cn = new MySqlConnection(AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "SELECT * FROM t_sorting_line_detail_task_abnormal where taskid = '" + taskid + "' order by cigcode"; cm.Parameters.AddWithValue("@taskid", taskid); using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { Add(AbnSortingLineTaskDetail.GetAbnSortingLineTaskDetail(dr)); } } } } RaiseListChangedEvents = true; }
public static string GetServerSortingLineTaskDate() { string sortingdate = ""; string taskno = ""; using (var cn = new DB2Connection(AppUtility.AppUtil._FjInfoConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "select * from t_sorting_line_task s JOIN t_sortingline sl ON s.PICKLINECODE = sl.lineCode WHERE sl.linetype= '2' order by orderdate desc fetch first 1 row only"; using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { taskno = dr.GetString("TASKNO"); sortingdate = dr.GetString("ORDERDATE") + ":" + taskno; } } } } return(sortingdate); }
/// <summary> /// Loads a <see cref="OutgoingRegister"/> object from the given SafeDataReader. /// </summary> /// <param name="dr">The SafeDataReader to use.</param> private void Fetch(SafeDataReader dr) { // Value properties LoadProperty(RegisterIdProperty, dr.GetInt32("RegisterId")); LoadProperty(RegisterDateProperty, dr.GetSmartDate("RegisterDate", true)); LoadProperty(DocumentTypeProperty, dr.GetString("DocumentType")); LoadProperty(DocumentReferenceProperty, dr.GetString("DocumentReference")); LoadProperty(DocumentEntityProperty, dr.GetString("DocumentEntity")); LoadProperty(DocumentDeptProperty, dr.GetString("DocumentDept")); LoadProperty(DocumentClassProperty, dr.GetString("DocumentClass")); LoadProperty(DocumentDateProperty, dr.GetSmartDate("DocumentDate", true)); LoadProperty(SubjectProperty, dr.GetString("Subject")); LoadProperty(SendDateProperty, dr.GetSmartDate("SendDate", true)); LoadProperty(RecipientNameProperty, dr.GetString("RecipientName")); LoadProperty(RecipientTownProperty, dr.GetString("RecipientTown")); LoadProperty(NotesProperty, dr.GetString("Notes")); LoadProperty(ArchiveLocationProperty, dr.GetString("ArchiveLocation")); LoadProperty(CreateDateProperty, dr.GetSmartDate("CreateDate", true)); LoadProperty(ChangeDateProperty, dr.GetSmartDate("ChangeDate", true)); var args = new DataPortalHookArgs(dr); OnFetchRead(args); }
public QcmaininfologModelList GetModelList(QcmaininfologModel model) { QcmaininfologTable table = new QcmaininfologTable(); SelectSqlSection sql = DataAccess.DefaultDB.Select(table, table.AllColumns()) ; using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader())) { QcmaininfologModelList result = new QcmaininfologModelList(); while (sdr.Read()) { QcmaininfologModel m = new QcmaininfologModel(); m.QualityCode = sdr.GetString(table.QualityCode); m.Status = sdr.GetString(table.Status); m.EditReason = sdr.GetString(table.EditReason); m.EditorContent = sdr.GetString(table.EditorContent); m.Editor = sdr.GetString(table.Editor); m.EditorTime = sdr.GetDateTime(table.EditorTime); result.Add(m); } return(result); } }
private void Child_Fetch(string taskid) { RaiseListChangedEvents = false; using (var cn = new MySqlConnection(AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "SELECT * FROM T_SORTING_LINE_DETAIL_TASK where taskid = '" + taskid + "' order by LINEBOXNAME"; cm.Parameters.AddWithValue("@taskid", taskid); using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { Add(SortingLineTaskDetail.GetSortingLineTaskDetail(dr)); } } } } RaiseListChangedEvents = true; }
protected void Fetch(SafeDataReader sdr) { int i = 0; LoadProperty(ProductCategoryIDProperty, sdr.GetInt32(i++)); LoadProperty(CategoryNameProperty, sdr.GetString(i++)); object tmpIsActiveInd = sdr.GetValue(i++); if (tmpIsActiveInd == System.DBNull.Value) { LoadProperty(IsActiveIndProperty, null); } else { LoadProperty(IsActiveIndProperty, (bool?)tmpIsActiveInd); } LoadProperty(DeletedDateProperty, sdr.GetValue(i++)); LoadProperty(DeletedByProperty, sdr.GetInt32(i++)); LoadProperty(CreatedDateProperty, sdr.GetSmartDate(i++)); LoadProperty(CreatedByProperty, sdr.GetInt32(i++)); LoadProperty(ModifiedDateProperty, sdr.GetSmartDate(i++)); LoadProperty(ModifiedByProperty, sdr.GetInt32(i++)); }
/// <summary> /// 通过PLC中到达信号的地址号获取其中的任务信息 /// </summary> /// <param name="slocationcode"></param> private void DataPortal_Fetch(string slocationcode) { //读取下达任务的任务信息 using (var cn = new MySqlConnection(AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "SELECT * FROM T_SORTINGTASKISSUED where id='" + slocationcode + "'"; //cm.Parameters.AddWithValue("@id", criteria.Value); using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { LoadProperty(IdProperty, dr.GetString("ID")); PLCFLAG = Convert.ToInt32(dr.GetString("PLCFLAG")); LoadProperty(PLCTASKNOProperty, dr.GetString("PLCTASKNO")); } } } } }
public static string GetSortingLineTaskDate() { string sortingdate = ""; string taskno = ""; using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "select * from T_SORTING_LINE_TASK_ABNORMAL limit 1"; using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { taskno = dr.GetString("SORTINGTASKNO"); sortingdate = dr.GetString("ORDERDATE") + ":" + taskno; } } } } return(sortingdate); }
private void DataPortal_Fetch(SafeDataReader dr) { LoadProperty(idticketProperty, dr.GetInt64(0)); LoadProperty(TicketNoProperty, dr.GetString(1)); LoadProperty(TicketSubjectProperty, dr.GetString(2)); LoadProperty(RequesterProperty, dr.GetString(3)); LoadProperty(CallerPosistionProperty, dr.GetString(4)); LoadProperty(PriorityProperty, dr.GetString(5)); LoadProperty(TicketOwnerProperty, dr.GetString(6)); LoadProperty(TicketTypeProperty, dr.GetString(7)); LoadProperty(TicketStatusProperty, dr.GetString(8)); LoadProperty(TicketDescriptionProperty, dr.GetString(9)); LoadProperty(SolutionProperty, dr.GetString(10)); LoadProperty(EscalationProperty, dr.GetString(11)); LoadProperty(CreatedByProperty, dr.GetString(12)); LoadProperty(CreatedDateProperty, dr.GetDateTime(13)); LoadProperty(UpdatedByProperty, dr.GetString(14)); LoadProperty(UpdatedDateProperty, dr.GetDateTime(15)); if (dr.FieldCount > 16) { LoadProperty(NamaCustomerProperty, dr.GetString(16)); } }
private void DataPortal_Fetch(Criteria criteria) { using (SqlConnection cn = new SqlConnection(Database.ConnectionString)) { cn.Open(); using (SqlCommand cm = cn.CreateCommand()) { cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "[app_donate].[recode_get]"; cm.Parameters.AddWithValue("@donateid", criteria.donateid); using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) { IsReadOnly = false; while (dr.Read()) { this.Add(new DonateInfo(dr)); } IsReadOnly = true; } } } }
protected void Fetch(SafeDataReader sdr) { using (BypassPropertyChecks) { int i = 0; LoadProperty(SettingIDProperty, sdr.GetInt32(i++)); LoadProperty(METTSupportEmailProperty, sdr.GetString(i++)); LoadProperty(NotesProperty, sdr.GetString(i++)); LoadProperty(CreatedDateProperty, sdr.GetSmartDate(i++)); LoadProperty(ActiveIndProperty, sdr.GetBoolean(i++)); LoadProperty(UnderMaintenanceIndProperty, sdr.GetBoolean(i++)); LoadProperty(EmailSignatureTextProperty, sdr.GetString(i++)); LoadProperty(UserManualBtnTextProperty, sdr.GetString(i++)); LoadProperty(UserManualURLProperty, sdr.GetString(i++)); LoadProperty(FAQDocumentBtnTextProperty, sdr.GetString(i++)); LoadProperty(FAQDocumentURLProperty, sdr.GetString(i++)); LoadProperty(DeletedIndProperty, sdr.GetBoolean(i++)); } MarkAsChild(); MarkOld(); BusinessRules.CheckRules(); }
private void Child_Fetch(int index) { RaiseListChangedEvents = false; using (var cn = new MySqlConnection(AppUtil._LocalConnectionString)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "SELECT * FROM t_sorting_line_task s JOIN t_sorting_line_detail_task sd on s.ID = sd.TASKID WHERE s.INDEXNO = @index order by sd.lineboxname"; cm.Parameters.AddWithValue("@index", index); using (var dr = new SafeDataReader(cm.ExecuteReader())) { while (dr.Read()) { Add(SortingLineTaskDetail.GetSortingLineTaskDetail(dr)); } } } } RaiseListChangedEvents = true; }
private void DataPortal_Fetch(int id) { using (var ctx = ConnectionManager <SqlConnection> .GetManager(ConfigHelper.GetDatabase(), false)) { using (var cmd = ctx.Connection.CreateCommand()) { cmd.CommandText = @"SELECT vehicletype,type,name,fee FROM vehicletype WHERE vehicletype = @id"; cmd.Parameters.AddWithValue("@id", id); using (var dr = new SafeDataReader(cmd.ExecuteReader())) { if (dr.Read()) { LoadProperty(_Id, dr.GetInt32("vehicletype")); LoadProperty(_Type, dr.GetInt32("type")); LoadProperty(_Name, dr.GetString("name")); LoadProperty(_Fee, dr.GetDecimal("fee")); } } } } }