Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_Statistic GetModel(int StatisticID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Statistic_GetModel");

            db.AddInParameter(dbCommand, "StatisticID", DbType.Int32, StatisticID);

            MesWeb.Model.T_Statistic model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Esempio n. 2
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_Statistic model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Statistic_ADD");

            db.AddOutParameter(dbCommand, "StatisticID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "TaskID", DbType.Int32, model.TaskID);
            db.AddInParameter(dbCommand, "MachineType", DbType.Int32, model.MachineType);
            db.AddInParameter(dbCommand, "SpecificationID", DbType.Int32, model.SpecificationID);
            db.AddInParameter(dbCommand, "JobSheetID", DbType.Int32, model.JobSheetID);
            db.AddInParameter(dbCommand, "MachineID", DbType.Int32, model.MachineID);
            db.AddInParameter(dbCommand, "EmployeeID", DbType.Int32, model.EmployeeID);
            db.AddInParameter(dbCommand, "RunTime", DbType.Int32, model.RunTime);
            db.AddInParameter(dbCommand, "DownTime", DbType.Int32, model.DownTime);
            db.AddInParameter(dbCommand, "Velocity", DbType.Int32, model.Velocity);
            db.AddInParameter(dbCommand, "PPM", DbType.Double, model.PPM);
            db.AddInParameter(dbCommand, "PR", DbType.Double, model.PR);
            db.AddInParameter(dbCommand, "ORV", DbType.Double, model.ORV);
            db.AddInParameter(dbCommand, "QR", DbType.Double, model.QR);
            db.AddInParameter(dbCommand, "OEE", DbType.Double, model.OEE);
            db.AddInParameter(dbCommand, "ODEX", DbType.Double, model.ODEX);
            db.AddInParameter(dbCommand, "ODDX", DbType.Double, model.ODDX);
            db.AddInParameter(dbCommand, "ODkurts", DbType.Double, model.ODkurts);
            db.AddInParameter(dbCommand, "ODMax", DbType.Double, model.ODMax);
            db.AddInParameter(dbCommand, "ODMin", DbType.Double, model.ODMin);
            db.AddInParameter(dbCommand, "StressEX", DbType.Double, model.StressEX);
            db.AddInParameter(dbCommand, "StressDX", DbType.Double, model.StressDX);
            db.AddInParameter(dbCommand, "Stresskurts", DbType.Double, model.Stresskurts);
            db.AddInParameter(dbCommand, "StressMax", DbType.Double, model.StressMax);
            db.AddInParameter(dbCommand, "StressMin", DbType.Double, model.StressMin);
            db.AddInParameter(dbCommand, "SpeedEX", DbType.Double, model.SpeedEX);
            db.AddInParameter(dbCommand, "SpeeDX", DbType.Double, model.SpeeDX);
            db.AddInParameter(dbCommand, "Speekurts", DbType.Double, model.Speekurts);
            db.AddInParameter(dbCommand, "SpeeMax", DbType.Double, model.SpeeMax);
            db.AddInParameter(dbCommand, "SpeeMin", DbType.Double, model.SpeeMin);
            db.AddInParameter(dbCommand, "UnitPower", DbType.Double, model.UnitPower);
            db.AddInParameter(dbCommand, "UnitProduct", DbType.Double, model.UnitProduct);
            db.AddInParameter(dbCommand, "Axis_No", DbType.String, model.Axis_No);
            db.AddInParameter(dbCommand, "Datetime", DbType.DateTime, model.Datetime);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "StatisticID"));
        }
Esempio n. 3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_Statistic ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_Statistic model = new MesWeb.Model.T_Statistic();
            object ojb;

            ojb = dataReader["StatisticID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StatisticID = (int)ojb;
            }
            ojb = dataReader["TaskID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TaskID = (int)ojb;
            }
            ojb = dataReader["MachineType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MachineType = (int)ojb;
            }
            ojb = dataReader["SpecificationID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpecificationID = (int)ojb;
            }
            ojb = dataReader["JobSheetID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.JobSheetID = (int)ojb;
            }
            ojb = dataReader["MachineID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MachineID = (int)ojb;
            }
            ojb = dataReader["EmployeeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmployeeID = (int)ojb;
            }
            ojb = dataReader["RunTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RunTime = (int)ojb;
            }
            ojb = dataReader["DownTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DownTime = (int)ojb;
            }
            ojb = dataReader["Velocity"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Velocity = (int)ojb;
            }
            ojb = dataReader["PPM"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PPM = (decimal)ojb;
            }
            ojb = dataReader["PR"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PR = (decimal)ojb;
            }
            ojb = dataReader["ORV"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ORV = (decimal)ojb;
            }
            ojb = dataReader["QR"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.QR = (decimal)ojb;
            }
            ojb = dataReader["OEE"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OEE = (decimal)ojb;
            }
            ojb = dataReader["ODEX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ODEX = (decimal)ojb;
            }
            ojb = dataReader["ODDX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ODDX = (decimal)ojb;
            }
            ojb = dataReader["ODkurts"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ODkurts = (decimal)ojb;
            }
            ojb = dataReader["ODMax"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ODMax = (decimal)ojb;
            }
            ojb = dataReader["ODMin"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ODMin = (decimal)ojb;
            }
            ojb = dataReader["StressEX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StressEX = (decimal)ojb;
            }
            ojb = dataReader["StressDX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StressDX = (decimal)ojb;
            }
            ojb = dataReader["Stresskurts"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Stresskurts = (decimal)ojb;
            }
            ojb = dataReader["StressMax"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StressMax = (decimal)ojb;
            }
            ojb = dataReader["StressMin"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StressMin = (decimal)ojb;
            }
            ojb = dataReader["SpeedEX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpeedEX = (decimal)ojb;
            }
            ojb = dataReader["SpeeDX"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpeeDX = (decimal)ojb;
            }
            ojb = dataReader["Speekurts"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Speekurts = (decimal)ojb;
            }
            ojb = dataReader["SpeeMax"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpeeMax = (decimal)ojb;
            }
            ojb = dataReader["SpeeMin"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpeeMin = (decimal)ojb;
            }
            ojb = dataReader["UnitPower"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UnitPower = (decimal)ojb;
            }
            ojb = dataReader["UnitProduct"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UnitProduct = (decimal)ojb;
            }
            model.Axis_No = dataReader["Axis_No"].ToString();
            ojb           = dataReader["Datetime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Datetime = (DateTime)ojb;
            }
            return(model);
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_Statistic DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_Statistic model = new MesWeb.Model.T_Statistic();
     if (row != null)
     {
         if (row["StatisticID"] != null && row["StatisticID"].ToString() != "")
         {
             model.StatisticID = int.Parse(row["StatisticID"].ToString());
         }
         if (row["TaskID"] != null && row["TaskID"].ToString() != "")
         {
             model.TaskID = int.Parse(row["TaskID"].ToString());
         }
         if (row["MachineType"] != null && row["MachineType"].ToString() != "")
         {
             model.MachineType = int.Parse(row["MachineType"].ToString());
         }
         if (row["SpecificationID"] != null && row["SpecificationID"].ToString() != "")
         {
             model.SpecificationID = int.Parse(row["SpecificationID"].ToString());
         }
         if (row["JobSheetID"] != null && row["JobSheetID"].ToString() != "")
         {
             model.JobSheetID = int.Parse(row["JobSheetID"].ToString());
         }
         if (row["MachineID"] != null && row["MachineID"].ToString() != "")
         {
             model.MachineID = int.Parse(row["MachineID"].ToString());
         }
         if (row["EmployeeID"] != null && row["EmployeeID"].ToString() != "")
         {
             model.EmployeeID = int.Parse(row["EmployeeID"].ToString());
         }
         if (row["RunTime"] != null && row["RunTime"].ToString() != "")
         {
             model.RunTime = int.Parse(row["RunTime"].ToString());
         }
         if (row["DownTime"] != null && row["DownTime"].ToString() != "")
         {
             model.DownTime = int.Parse(row["DownTime"].ToString());
         }
         if (row["Velocity"] != null && row["Velocity"].ToString() != "")
         {
             model.Velocity = int.Parse(row["Velocity"].ToString());
         }
         if (row["PPM"] != null && row["PPM"].ToString() != "")
         {
             model.PPM = decimal.Parse(row["PPM"].ToString());
         }
         if (row["PR"] != null && row["PR"].ToString() != "")
         {
             model.PR = decimal.Parse(row["PR"].ToString());
         }
         if (row["ORV"] != null && row["ORV"].ToString() != "")
         {
             model.ORV = decimal.Parse(row["ORV"].ToString());
         }
         if (row["QR"] != null && row["QR"].ToString() != "")
         {
             model.QR = decimal.Parse(row["QR"].ToString());
         }
         if (row["OEE"] != null && row["OEE"].ToString() != "")
         {
             model.OEE = decimal.Parse(row["OEE"].ToString());
         }
         if (row["ODEX"] != null && row["ODEX"].ToString() != "")
         {
             model.ODEX = decimal.Parse(row["ODEX"].ToString());
         }
         if (row["ODDX"] != null && row["ODDX"].ToString() != "")
         {
             model.ODDX = decimal.Parse(row["ODDX"].ToString());
         }
         if (row["ODkurts"] != null && row["ODkurts"].ToString() != "")
         {
             model.ODkurts = decimal.Parse(row["ODkurts"].ToString());
         }
         if (row["ODMax"] != null && row["ODMax"].ToString() != "")
         {
             model.ODMax = decimal.Parse(row["ODMax"].ToString());
         }
         if (row["ODMin"] != null && row["ODMin"].ToString() != "")
         {
             model.ODMin = decimal.Parse(row["ODMin"].ToString());
         }
         if (row["StressEX"] != null && row["StressEX"].ToString() != "")
         {
             model.StressEX = decimal.Parse(row["StressEX"].ToString());
         }
         if (row["StressDX"] != null && row["StressDX"].ToString() != "")
         {
             model.StressDX = decimal.Parse(row["StressDX"].ToString());
         }
         if (row["Stresskurts"] != null && row["Stresskurts"].ToString() != "")
         {
             model.Stresskurts = decimal.Parse(row["Stresskurts"].ToString());
         }
         if (row["StressMax"] != null && row["StressMax"].ToString() != "")
         {
             model.StressMax = decimal.Parse(row["StressMax"].ToString());
         }
         if (row["StressMin"] != null && row["StressMin"].ToString() != "")
         {
             model.StressMin = decimal.Parse(row["StressMin"].ToString());
         }
         if (row["SpeedEX"] != null && row["SpeedEX"].ToString() != "")
         {
             model.SpeedEX = decimal.Parse(row["SpeedEX"].ToString());
         }
         if (row["SpeeDX"] != null && row["SpeeDX"].ToString() != "")
         {
             model.SpeeDX = decimal.Parse(row["SpeeDX"].ToString());
         }
         if (row["Speekurts"] != null && row["Speekurts"].ToString() != "")
         {
             model.Speekurts = decimal.Parse(row["Speekurts"].ToString());
         }
         if (row["SpeeMax"] != null && row["SpeeMax"].ToString() != "")
         {
             model.SpeeMax = decimal.Parse(row["SpeeMax"].ToString());
         }
         if (row["SpeeMin"] != null && row["SpeeMin"].ToString() != "")
         {
             model.SpeeMin = decimal.Parse(row["SpeeMin"].ToString());
         }
         if (row["UnitPower"] != null && row["UnitPower"].ToString() != "")
         {
             model.UnitPower = decimal.Parse(row["UnitPower"].ToString());
         }
         if (row["UnitProduct"] != null && row["UnitProduct"].ToString() != "")
         {
             model.UnitProduct = decimal.Parse(row["UnitProduct"].ToString());
         }
         if (row["Axis_No"] != null)
         {
             model.Axis_No = row["Axis_No"].ToString();
         }
         if (row["Datetime"] != null && row["Datetime"].ToString() != "")
         {
             model.Datetime = DateTime.Parse(row["Datetime"].ToString());
         }
     }
     return(model);
 }