Пример #1
0
        /// <summary>
        /// 新增工程實時生產數據
        /// </summary>
        /// <param name="model">model</param>
        /// <param name="tran">SqlTransaction</param>
        /// <returns></returns>
        public bool AddProjectRealTimeProductionData(ProjectRealTimeProductionData model, SqlTransaction tran)
        {
            try
            {
                MappingHelper.HandleNullProperty(model);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into ProjectRealTimeProductionData_prtd(");
                strSql.Append("prtd_ShiftProjectID,prtd_dRealTimeDataTime,prtd_iProductionQty)");
                strSql.Append(" values (");
                strSql.Append("@prtd_ShiftProjectID,@prtd_dRealTimeDataTime,@prtd_iProductionQty)");
                SqlParameter[] parameters = {
                    DbHelperSQL.MakeInParam("@prtd_ShiftProjectID", SqlDbType.UniqueIdentifier,16,model.ShiftProjectID),
                    DbHelperSQL.MakeInParam("@prtd_dRealTimeDataTime", SqlDbType.SmallDateTime,0,model.RealTimeDataTime),
                    DbHelperSQL.MakeInParam("@prtd_iProductionQty", SqlDbType.Int,4,model.ProductionQty)};

                DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, strSql.ToString(), parameters);

                return true;
            }
            catch (Exception ex) { throw ex; }
        }
Пример #2
0
        /// <summary>
        /// 对象实体绑定数据(ProjectRealTimeProductionData)
        /// </summary>
        private ProjectRealTimeProductionData ReaderBind_PRTD(IDataReader dataReader)
        {
            ProjectRealTimeProductionData model = new ProjectRealTimeProductionData();

            object ojb;
            ojb = dataReader["prtd_ShiftProjectID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ShiftProjectID = new Guid(ojb.ToString());
            }
            ojb = dataReader["prtd_dRealTimeDataTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RealTimeDataTime = (DateTime)ojb;
            }
            ojb = dataReader["prtd_iProductionQty"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProductionQty = (int)ojb;
            }

            return model;
        }
 /// <summary>
 /// 新增一條工程實時生產數據對象
 /// </summary>
 public override void AddProjectRealTimeProductionData(ProjectRealTimeProductionData RealTimeData)
 {
     if (RealTimeData == null)
     {
         return;
     }
     if (this.m_queueRealTimeProduction == null)
     {
         this.m_queueRealTimeProduction = new Queue<ProjectRealTimeProductionData>();
     }
     try
     {
         this.m_queueRealTimeProduction.Enqueue(RealTimeData);
     }
     catch (Exception ex)
     {
         base.OnException(mc_strControllerName, "AddProjectRealTimeProductionData", ex.Message);
     }
 }
Пример #4
0
        /// <summary>
        /// 工程的生產原始數據反序列化後的數據對象上傳到服務器數據庫中
        /// </summary>
        /// <param name="projectRealTimeProductionData">生產原始數據</param>
        /// <returns></returns>
        public bool SynFirstProjectRealTimeProductionDataToDB(ProjectRealTimeProductionData projectRealTimeProductionData)
        {
            try
            {
                bool l_lIsSuess = false;

                using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
                {
                    SqlTransaction transaction = null;

                    conn.Open(); //開啟連接
                    transaction = conn.BeginTransaction(); //開啟事務

                    try
                    {
                        //★
                        this.m_objProductionDataSynDAL.AddProjectRealTimeProductionData(projectRealTimeProductionData, transaction);

                        l_lIsSuess = true;
                    }
                    catch (Exception exTran)
                    {
                        l_lIsSuess = false;
                        throw exTran;
                    }
                    finally
                    {
                        if (l_lIsSuess)
                            transaction.Commit();
                        else
                            transaction.Rollback();
                    }

                    return true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// 新增一條工程實時生產數據對象
 /// </summary>
 /// <param name="RealTimeData"></param>
 public abstract void AddProjectRealTimeProductionData(ProjectRealTimeProductionData RealTimeData);