当前位置: 首页>>代码示例>>C#>>正文


C# Data.DataRowCollection类代码示例

本文整理汇总了C#中System.Data.DataRowCollection的典型用法代码示例。如果您正苦于以下问题:C# DataRowCollection类的具体用法?C# DataRowCollection怎么用?C# DataRowCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataRowCollection类属于System.Data命名空间,在下文中一共展示了DataRowCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetURLFromData

        public static string GetURLFromData(Size size, DataRowCollection rows, string name_row, string data_row)
        {
            if (rows == null || String.IsNullOrEmpty (name_row) || String.IsNullOrEmpty (data_row))
                return null;

            // http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

            StringBuilder labels = new StringBuilder ();
            labels.Append ("chl=");
            StringBuilder data = new StringBuilder ();
            data.Append ("chd=t:");
            int min = Int32.MaxValue;
            int max = Int32.MinValue;
            foreach (DataRow row in rows) {
                labels.AppendFormat ("{0}|", HttpUtility.UrlEncode (row [name_row].ToString ()));
                int val = Convert.ToInt32 (row [data_row]);
                data.AppendFormat ("{0},", val);
                if (val < min)
                    min = val;
                if (val > max)
                    max = val;
            }

            if (rows.Count > 0) {
                labels.Length--;
                data.Length--;
            }
            return String.Format ("http://chart.apis.google.com/chart?cht=p3&chs={2}x{3}&{0}&{1}&chds=0,{5}",
                            data.ToString (),
                            labels.ToString (),
                            size.Width, size.Height,
                            min, max);
        }
开发者ID:mono,项目名称:momareports,代码行数:33,代码来源:GChart.cs

示例2: AddSaleToDatabase

        private static void AddSaleToDatabase(
            int rowsCount,
            DataRowCollection rows,
            MSSQLContext context,
            Supermarket supermarket,
            DateTime saleDate)
        {
            const int startRow = 3;

            for (int i = startRow; i < rowsCount - 1; i++)
            {
                string productName = rows[i][1].ToString();
                int quantity = int.Parse(rows[i][2].ToString());
                decimal price = decimal.Parse(rows[i][3].ToString());

                Product product = context.Products.FirstOrDefault(p => p.Name == productName);

                var sale = new Sale()
                {
                    Supermarket = supermarket,
                    Product = product,
                    SaleDate = saleDate,
                    SalePrice = price,
                    Quantity = quantity
                };

                context.Sales.Add(sale);
                context.SaveChanges();
            }
        }
开发者ID:Martin-Andreev,项目名称:Team-Billy_Buttons-SupermarketsChain,代码行数:30,代码来源:ImportFromExcel.cs

示例3: CheckDownloaded

 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:04/07/2008
 /// @Description: retrieve many ScheduleDetail with workstation id and schedule date
 /// </summary>
 /// <param name="pintScheduleDetailID">int</param>
 //public DataSet CreateSchedule(ScheduleDetail pScheduleDetail)
 //{
 //    PrScheduleDetail ScheduleDetail = new PrScheduleDetail(Connection);
 //    try
 //    {
 //        Open();
 //        ScheduleDetail.CreateSchedule(pScheduleDetail);
 //        Commit();
 //        return ScheduleDetail.Search(pScheduleDetail.WorkstationId, pScheduleDetail.ScheduleDate);
 //    }
 //    catch (Exception exp)
 //    {
 //        Rollback();
 //        throw exp;
 //    }
 //    finally
 //    {
 //        Close();
 //    }
 //}
 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:04/07/2008
 /// @Description: wrilte download log
 /// </summary>
 /// <param name="pintScheduleDetailID">int</param>
 public void CheckDownloaded(DataRowCollection pDataRowsColl, int pintWorkstationID, DateTime pdteDateTime)
 {
     PrScheduleDetail ScheduleDetail = new PrScheduleDetail(Connection);
     ScheduleDetail pScheduleDetail = new ScheduleDetail();
     pScheduleDetail.WorkstationId = pintWorkstationID;
     pScheduleDetail.ScheduleDate = pdteDateTime;
     try
     {
         Open();
         foreach (DataRow row in pDataRowsColl)
         {
             pScheduleDetail.ScheduleId = (int) row["SCHEDULE_ID"];
             pScheduleDetail.Downloaded = (byte) row["DOWNLOADED"];
             if (pScheduleDetail.Downloaded == 1)
                 ScheduleDetail.CheckDownloaded(pScheduleDetail);
         }
         Commit();
     }
     catch (Exception exp)
     {
         Rollback();
         throw exp;
     }
     finally
     {
         Close();
     }
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:60,代码来源:BScheduleDetail.cs

示例4: add_edges

        private void add_edges(DataRowCollection edge_rows, IVertexCollection oVertices, IEdgeCollection oEdges)
        {
            String from;
            String to;

            foreach (DataRow row in edge_rows)
            {
                //Notice: "EdgeFromid" and "EdgeToid" should be edited
                from = row["FromID"].ToString();
                to = row["ToID"].ToString();

                // Add an edge
                IVertex oFrom = null;
                IVertex oTo = null;

                foreach (IVertex oVertex in oVertices)
                {
                    if (oVertex.Tag.ToString() == from)
                    {
                        oFrom = oVertex;
                    }

                    if (oVertex.Tag.ToString() == to)
                    {
                        oTo = oVertex;
                    }
                }
                IEdge oEdge1 = oEdges.Add(oFrom, oTo, true);
            }
        }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:30,代码来源:DB_Converter.cs

示例5: calc

 /***
  * 统计计算
  * */
 public static DataTable[] calc(DataRowCollection rows)
 {
     //1、设置查询条件
     List<CheckCellCondition> condtionList = getConditionList();
     //2、获取验证通过的记录列表
     List<DataRow> rightRows = DataRowManager.findAllRightRows(rows, condtionList);
     //3、封装对象
     List<Student> studentList = StudentManager.rows2StudentList(rightRows);
     //4、根据分数由高到低排序
     studentList.Sort();
     //5、计算所有人的一个平均分,高分段和低分段,高分段人数,低分段人数
     float highScore = CoreService.calcSegScore(studentList,0.2f);
     float lowScore = CoreService.calcSegScore(studentList,0.8f);
     StatRecord mainRecord = CoreService.coreCalc(studentList, highScore, lowScore, "全年级");
     //6、获取不同班级人员列表
     List<List<Student>> groupList = groupByClazz(studentList);
     List<StatRecord> statRecordList = coreCalcGroup(groupList,highScore,lowScore);
     //7、获取高、低分明细table
     DataTable[] tablearr = renderScoreTable(statRecordList);
     DataTable highDataTable = tablearr[0];
     DataTable lowDataTable = tablearr[1];
     //8、获取渲染最终统计结果的table
     statRecordList.Add(mainRecord);
     DataTable mainStatTable = renderMainResultTable(statRecordList);
     return new DataTable[] { mainStatTable, highDataTable, lowDataTable };
 }
开发者ID:juqiukai,项目名称:cangqian,代码行数:29,代码来源:Form1Service.cs

示例6: DataTable

		public DataTable()
		{
			Columns = new DataColumnCollection(this);
			Rows = new DataRowCollection(this);
			Locale = CultureInfo.CurrentCulture;
			DefaultView = new DataView(this);
		}
开发者ID:hungdluit,项目名称:aforge,代码行数:7,代码来源:DataTable.cs

示例7: ExportMediaFile

        /// <summary>
        /// @author : TrungMT
        /// @CreateDate:04/09/2008
        /// @Description: export to playlist
        /// </summary>
        public void ExportMediaFile(DataRowCollection pScheduleRows, String pstrClipColName, String pstrFileColName, String pstrFreqColName, String pstrMarkedUsingColName)
        {
            // check if no clip
            if (pScheduleRows.Count <= 0)
                return;

            // Init random
            DateTime date = DateTime.Now;
            Random random = new Random(date.Second * 10000000 + date.Minute * 100000 + date.Day * 1000 + date.DayOfYear);
            //int intRandomScope = pScheduleRows.Count - 1;

            // Caculate the total number of freq and restore MarkedUsingColName
            int intTolFreq = 0;
            foreach (DataRow row in pScheduleRows)
            {
                //intTolFreq += (byte)row[pstrFreqColName];
                intTolFreq += (byte)row[pstrFreqColName];
                row[pstrMarkedUsingColName] = (int)0;
            }

            // Exceute random
            bool blnStop = false;
            while (!blnStop)
            {
                // Generate 1 random value
                int randomValue = random.Next(0, pScheduleRows.Count);
                // if the freq display of the clip is not enough
                if (ExportClip(pScheduleRows[randomValue],
                                pstrClipColName,
                                pstrFileColName,
                                pstrFreqColName,
                                pstrMarkedUsingColName))
                    // next loop to another clip
                    continue;
                // but if enough, try the next clip in the list
                else
                {
                    int i = randomValue;
                    do
                    {
                        // try next by next clip,
                        i++;
                        if (i >= pScheduleRows.Count)
                            i = 0;
                        // if the freq display of the next clip is not enough
                        if (ExportClip(pScheduleRows[i],
                                        pstrClipColName,
                                        pstrFileColName,
                                        pstrFreqColName,
                                        pstrMarkedUsingColName))
                            // exit loop to another random clip
                            break;
                    } while (i != randomValue);
                    // if all clip is enought, stop hear
                    if (i == randomValue)
                        break;
                }
            }
        }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:64,代码来源:ExportM3U.cs

示例8: PlayClip

 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:05/05/2008
 /// @Description: show form and play many clip
 /// </summary>
 public PlayClip(DataRowCollection pClipRows, TimeSpan ptServerLocalDelay)
 {
     mClipRows = pClipRows;
     InitializeComponent();
     //LoadArrayList();
     mtServerLocalDelay = ptServerLocalDelay;
     Show();
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:13,代码来源:PlayClip.cs

示例9: getCollationSelect

 public static string getCollationSelect(string n, DataRowCollection collations)
 {
     sb = new StringBuilder();
     sb.Append("<select name=\"" + n + "\"><option />");
     for (int i = 0, l = collations.Count; i < l; i++) sb.Append("<option value=\"" + collations[i][0] + "\">" + collations[i][0] + "</option>");
     sb.Append("</select>");
     return sb.ToString();
 }
开发者ID:sonnym,项目名称:csmsadmin,代码行数:8,代码来源:DisplayLayer.cs

示例10: DataObjectEx

 public DataObjectEx(DataRowCollection selectedItems, String baseFolder)
 {
     this.m_SelectedItems = new DataRow[selectedItems.Count];
       for (Int32 counter = 0; counter < selectedItems.Count; counter++) {
     this.m_SelectedItems[counter] = selectedItems[counter];
       }
       this.m_BaseFolder = baseFolder;
 }
开发者ID:MTGUli,项目名称:TREExplorer,代码行数:8,代码来源:ClassDataObjectEx.cs

示例11: ValidateConferenceStandardCost

        /// <summary>
        /// Validates the MConference Standard Cost Setup screen data.
        /// </summary>
        /// <param name="AContext">Context that describes where the data validation failed.</param>
        /// <param name="ARow">The <see cref="DataRow" /> which holds the the data against which the validation is run.</param>
        /// <param name="AVerificationResultCollection">Will be filled with any <see cref="TVerificationResult" /> items if
        /// data validation errors occur.</param>
        /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that
        /// display data that is about to be validated.</param>
        /// <param name="AGridData">A <see cref="TValidationControlsDict" />Contains all rows that are included in the grid</param>
        public static void ValidateConferenceStandardCost(object AContext, PcConferenceCostRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict,
            DataRowCollection AGridData)
        {
            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // Check the row being validated is consistent with the rest of the data in the table
            PcConferenceCostRow ARowCompare = null;
            Boolean StandardCostInconsistency = false;
            string[] InconsistentRows = new string[2];  // used for the error message
            int i = 0;

            while (i < AGridData.Count)
            {
                ARowCompare = (PcConferenceCostRow)AGridData[i];

                if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays > ARow.OptionDays) && (ARowCompare.Charge < ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARow.OptionDays.ToString();
                    InconsistentRows[1] = ARowCompare.OptionDays.ToString();
                    break;
                }
                else if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays < ARow.OptionDays)
                         && (ARowCompare.Charge > ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARowCompare.OptionDays.ToString();
                    InconsistentRows[1] = ARow.OptionDays.ToString();
                    break;
                }

                i++;
            }

            // if an inconsistency is found
            if (StandardCostInconsistency == true)
            {
                TValidationControlsData ValidationControlsData;
                TScreenVerificationResult VerificationResult = null;
                DataColumn ValidationColumn = ARow.Table.Columns[PcConferenceCostTable.ColumnChargeId];

                // displays a warning message (non-critical error)
                VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext, ErrorCodes.GetErrorInfo(
                            PetraErrorCodes.ERR_STANDARD_COST_INCONSISTENCY, InconsistentRows)),
                    ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:65,代码来源:Conference.Validation.cs

示例12: FrmClipView

 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:05/05/2008
 /// @Description: show form and play many clip
 /// </summary>
 public FrmClipView(DataRowCollection pClipRows, TimeSpan ptServerLocalDelay,QTC.Adv.DataModule.Single.Workstation workstation)
 {
     InitializeComponent();
     this.workstation = workstation;
     mClipRows = pClipRows;
     Stopped = true;
     InitTimmerList();
     mTimer.Enabled = true;
     mtServerLocalDelay = ptServerLocalDelay;
     mFullScreen = new FullScreen(this);
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:16,代码来源:FrmClipView.cs

示例13: CreateFileInfoControls

    private void CreateFileInfoControls(DataRowCollection fileInfoRows)
    {
        foreach (DataRow fileInfo in fileInfoRows)
        {
            ASP.commandarea_controls_edituploadedfileinfo_ascx oEditUploadedFileInfo =
                (ASP.commandarea_controls_edituploadedfileinfo_ascx)
                    LoadControl(typeof(ASP.commandarea_controls_edituploadedfileinfo_ascx), null);

            oEditUploadedFileInfo.BindToRow(fileInfo);
            oFileInfoPlaceHolder.Controls.Add(oEditUploadedFileInfo);
        }
    }
开发者ID:swesus,项目名称:woodland,代码行数:12,代码来源:UploadedFiles.aspx.cs

示例14: findAllRightRows

 public static List<DataRow> findAllRightRows(DataRowCollection rows, List<CheckCellCondition> list)
 {
     if (null == rows || rows.Count == 0) return null;
     List<DataRow> dataRowList = new List<DataRow>();
     foreach (DataRow row in rows)
     {
         if (checkRow(row, list))
         {
             dataRowList.Add(row);
         }
     }
     return dataRowList;
 }
开发者ID:juqiukai,项目名称:cangqian,代码行数:13,代码来源:DataRowManager.cs

示例15: ImportInDB

        private void ImportInDB(DataRowCollection firstTableRows, DateTime dateTimeOfReports)
        {
            using (NitrogenNewEntities dbConnection = new NitrogenNewEntities())
            {
                var nameOfPlace = firstTableRows[0].ItemArray[0].ToString();
                var idOfThePlace = dbConnection.Places.Where(p => p.Name == nameOfPlace).Select(p => p.PlaceId).FirstOrDefault();
                var idsOfProducts = dbConnection.Products.Select(x => x.ProductId).ToList();

                Place newPlace = new Place();
                if (idOfThePlace == 0)
                {
                    newPlace = dbConnection.Places.Add(new Place()
                    {
                        Name = nameOfPlace,
                        Address = "Undefined",
                    });
                }

                Sale theNewSale = new Sale();
                for (int i = 2; i < firstTableRows.Count; i++)
                {
                    theNewSale = new Sale();
                    var row = firstTableRows[i];
                    int reportProductId = int.Parse(row.ItemArray[0].ToString());

                    if (!idsOfProducts.Contains(reportProductId))
                    {
                        Console.WriteLine(
                            string.Format("The id: {0} is not contains in Products! Report cannot be processed.", reportProductId));
                        continue;
                    }

                    theNewSale.ProductId = reportProductId;
                    theNewSale.Quantity = int.Parse(row.ItemArray[1].ToString());
                    theNewSale.PricePerUnit = decimal.Parse(row.ItemArray[2].ToString());
                    theNewSale.Sum = decimal.Parse(row.ItemArray[3].ToString());
                    theNewSale.PlaceId = idOfThePlace != 0 ? idOfThePlace : newPlace.PlaceId;
                    theNewSale.Date = dateTimeOfReports;
                    dbConnection.Sales.Add(theNewSale);
                }

                try
                {
                    dbConnection.SaveChanges();
                }
                catch (Exception ex)
                {
                    this.ShowMessageException(ex);
                }
            }
        }
开发者ID:dtopalov,项目名称:DB_Teamwork_Team_Nitrogen,代码行数:51,代码来源:ReportImporter.cs


注:本文中的System.Data.DataRowCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。