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


C# MainDBDataContext.Translate方法代码示例

本文整理汇总了C#中LinqToSQLModel.MainDBDataContext.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# MainDBDataContext.Translate方法的具体用法?C# MainDBDataContext.Translate怎么用?C# MainDBDataContext.Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinqToSQLModel.MainDBDataContext的用法示例。


在下文中一共展示了MainDBDataContext.Translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetReportPPCData


//.........这里部分代码省略.........

            System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(
               strSql.Trim().ToString(), (System.Data.SqlClient.SqlConnection)db.Connection);

            using (System.Data.Common.DbDataReader reader = command.ExecuteReader())
            {
                collectList = new List<_TPEMCollect>();
                while (reader.Read())
                {
                    _TPEMCollect tmp = new _TPEMCollect()
                    {
                        //fSpeed = Convert.ToDecimal(reader[0].ToString()),
                        //fSpeed2 = Convert.ToDecimal(reader[1].ToString()),
                        //cMachineCode = reader[2].ToString()
                        dDate = Convert.ToDateTime(reader[0].ToString()),
                        cShift = reader[1].ToString(),
                        cMachineCode = reader[2].ToString(),
                        iTotalOperation = Convert.ToInt32(reader[3].ToString()),
                        iTotalMeal = Convert.ToInt32(reader[4].ToString()),
                        iTotalDown = Convert.ToInt32(reader[5].ToString()),
                        iTotlaCoversion = Convert.ToInt32(reader[6].ToString()),
                        iIdealSpeed1 = Convert.ToDecimal(reader[7].ToString()),
                        iIdealSpeed2 = Convert.ToDecimal(reader[8].ToString()),
                        lIsExist = Convert.ToBoolean(reader[9])
                    };
                    if (dicSpeed.ContainsKey(tmp.cMachineCode.ToString().Trim()))
                    {
                        tmp.iIdealSpeed1 = dicSpeed[tmp.cMachineCode.ToString().Trim()][0];
                        tmp.iIdealSpeed2 = dicSpeed[tmp.cMachineCode.ToString().Trim()][1];
                        tmp.lIsExist = true;
                    }
                    collectList.Add(tmp);
                }

                reader.NextResult();

                mainList = new List<_TPEMMain>();
                while (reader.Read())
                {
                    _TPEMMain tmp = new _TPEMMain()
                    {
                        iRowID = reader.IsDBNull(0) ? 0 : Convert.ToInt32(reader[0].ToString()),
                        cUnit = reader.IsDBNull(1) ? "" : reader[1].ToString(),
                        cGroup = reader.IsDBNull(2) ? "" : reader[2].ToString(),
                        dDate = reader.IsDBNull(3) ? DateTime.MinValue : Convert.ToDateTime(reader[3].ToString()),
                        cShift = reader.IsDBNull(4) ? "" : reader[4].ToString(),
                        iShift = reader.IsDBNull(5) ? "" : reader[5].ToString(),
                        cMachineCode = reader.IsDBNull(6) ? "" : reader[6].ToString(),
                        cProject = reader.IsDBNull(7) ? "" : reader[7].ToString(),
                        cProduct = reader.IsDBNull(8) ? "" : reader[8].ToString(),
                        cSONO = reader.IsDBNull(9) ? "" : reader[9].ToString(),
                        cProjection = reader.IsDBNull(10) ? "" : reader[10].ToString(),
                        dProjectStart = reader.IsDBNull(11) ? DateTime.MinValue : Convert.ToDateTime(reader[11].ToString()),
                        dProjectCover = reader.IsDBNull(12) ? DateTime.MinValue : Convert.ToDateTime(reader[12].ToString()),
                        dprojectEnd = reader.IsDBNull(13) ? DateTime.MinValue : Convert.ToDateTime(reader[13].ToString()),
                        iRealQty = reader.IsDBNull(14) ? 0 : Convert.ToInt32(reader[14].ToString()),
                        iDefectiveQty = reader.IsDBNull(15) ? 0 : Convert.ToInt32(reader[15].ToString()),
                        iWasteQty = reader.IsDBNull(16) ? 0 : Convert.ToInt32(reader[16].ToString()),
                        iOperationTime = reader.IsDBNull(17) ? 0 : Convert.ToInt32(reader[17].ToString()),
                        iMealTime = reader.IsDBNull(18) ? 0 : Convert.ToInt32(reader[18].ToString()),
                        iDownTime = reader.IsDBNull(19) ? 0 : Convert.ToInt32(reader[19].ToString()),
                        iCoversionTime = reader.IsDBNull(20) ? 0 : Convert.ToInt32(reader[20].ToString()),
                        iIdealSpeed = reader.IsDBNull(21) ? 0 : float.Parse(reader[21].ToString()),
                        iIdealSpeed1 = reader.IsDBNull(22) ? 0 : Convert.ToInt32(reader[22].ToString()),
                        iIdealSpeed2 = reader.IsDBNull(23) ? 0 : Convert.ToInt32(reader[23].ToString()),
                        iUnit = reader.IsDBNull(24) ? "" : reader[24].ToString(),
                        cUnitCD = reader.IsDBNull(25) ? "" : reader[25].ToString(),
                        cArea = reader.IsDBNull(26) ? "" : reader[26].ToString(),
                        dAddDate = reader.IsDBNull(27) ? DateTime.MinValue : Convert.ToDateTime(reader[27].ToString()),
                        cAdd = reader.IsDBNull(28) ? "" : reader[28].ToString(),
                        dLastDate = reader.IsDBNull(29) ? DateTime.MinValue : Convert.ToDateTime(reader[29].ToString()),
                        cLast = reader.IsDBNull(30) ? "" : reader[30].ToString(),
                        ID = reader.IsDBNull(31) ? "" : reader[31].ToString(),
                        dShiftBegin = reader.IsDBNull(32) ? DateTime.MinValue : Convert.ToDateTime(reader[32].ToString()),
                        dShiftEnd = reader.IsDBNull(33) ? DateTime.MinValue : Convert.ToDateTime(reader[33].ToString()),
                        iShiftOperation = reader.IsDBNull(34) ? 0 : Convert.ToInt32(reader[34].ToString()),
                        iShiftMeal = reader.IsDBNull(35) ? 0 : Convert.ToInt32(reader[35].ToString()),
                        iShiftDown = reader.IsDBNull(36) ? 0 : Convert.ToInt32(reader[36].ToString()),
                        iShiftCoversion = reader.IsDBNull(37) ? 0 : Convert.ToInt32(reader[37].ToString()),
                        lIsProject = Convert.ToBoolean(reader[38])
                    };
                    if (dicSpeed.ContainsKey(tmp.cMachineCode.ToString().Trim()))
                    {
                        tmp.iIdealSpeed1 = dicSpeed[tmp.cMachineCode.ToString().Trim()][0];
                        tmp.iIdealSpeed2 = dicSpeed[tmp.cMachineCode.ToString().Trim()][1];
                        tmp.lIsExist = true;
                    }
                    mainList.Add(tmp);
                }
                //mainList = b.ToList();

                reader.NextResult();

                reader.NextResult();

                var b = db.Translate<_TPEMDown>(reader);

                downList = b.ToList();
            }
        }
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:101,代码来源:TPEMTransitionDA.cs


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