/// <summary>
        /// 新增機台維修請求記錄
        /// </summary>
        /// <param name="machineRepairRequestData">機台維修記錄</param>
        /// <returns>true/false</returns>
        /// <remarks>Create By JinHui Ren</remarks>
        public override bool AddRepairRequestRecords(MachineRepairRequest machineRepairRequestData)
        {
            try
            {
                if (this.RepairRequestRecords != null)
                {
                    this.RepairRequestRecords.Add(machineRepairRequestData);
                    this.ResponseProductionDataChangedEvent(machineRepairRequestData, 1);
                }

                return true;
            }
            catch (Exception ex) { this.OnException(mc_strClassName, "AddRepairRequestRecords", ex.Message); throw; }
        }
 /// <summary>
 /// 刪除機台維修請求記錄
 /// </summary>
 /// <param name="machineRepairRequestData">機台維修記錄</param>
 /// <returns>true/false</returns>
 /// <remarks>Create By JinHui Ren</remarks>
 public override bool DelRepairRequestRecords(MachineRepairRequest machineRepairRequestData)
 {
     try
     {
         if (this.RepairRequestRecords != null)
         {
             for (int i = this.RepairRequestRecords.Count() - 1; i >= 0; i--)
             {
                 if (machineRepairRequestData.RecordID == this.RepairRequestRecords[i].RecordID)
                 {
                     this.RepairRequestRecords.Remove(this.RepairRequestRecords[i]);
                 }
             }
             this.ResponseProductionDataChangedEvent(machineRepairRequestData, 4);
         }
         return true;
     }
     catch (Exception ex) { this.OnException(mc_strClassName, "DelRepairRequestRecords", ex.Message); throw; }
 }
Esempio n. 3
0
        /// <summary>
        /// 更新機台維修請求
        /// </summary>
        /// <param name="model">model</param>
        /// <param name="tran">SqlTransaction</param>
        /// <returns></returns>
        public bool UpdateMachineRepairRequest(MachineRepairRequest model, SqlTransaction tran)
        {
            try
            {
                MappingHelper.HandleNullProperty(model);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("update RepairRequestReg_rrr set ");
                strSql.Append("rrr_cMachineID=@rrr_cMachineID,");
                strSql.Append("rrr_SIFOID=@rrr_SIFOID,");
                strSql.Append("rrr_dRequestTime=@rrr_dRequestTime,");
                strSql.Append("rrr_cStruct=@rrr_cStruct,");
                strSql.Append("rrr_cSubStruct=@rrr_cSubStruct,");
                strSql.Append("rrr_cSubSubStruct=@rrr_cSubSubStruct,");
                strSql.Append("rrr_cRepairItem=@rrr_cRepairItem,");
                strSql.Append("rrr_cRepairLevel=@rrr_cRepairLevel,");
                strSql.Append("rrr_cFollowStatus=@rrr_cFollowStatus,");
                strSql.Append("rrr_cProblemDesc=@rrr_cProblemDesc,");
                strSql.Append("rrr_dBeginTime=@rrr_dBeginTime,");
                strSql.Append("rrr_dEndTime=@rrr_dEndTime,");
                strSql.Append("rrr_lSync=@rrr_lSync,");
                strSql.Append("rrr_dAddDate=@rrr_dAddDate,");
                strSql.Append("rrr_dLastDate=@rrr_dLastDate");
                strSql.Append(" where rrr_RecordID=@rrr_RecordID ");
                SqlParameter[] parameters = {
                    DbHelperSQL.MakeInParam("@rrr_cMachineID", SqlDbType.NVarChar,20, model.rrr_cMachineID),
                    DbHelperSQL.MakeInParam("@rrr_SIFOID", SqlDbType.UniqueIdentifier,16, model.rrr_SIFOID),
                    DbHelperSQL.MakeInParam("@rrr_dRequestTime", SqlDbType.DateTime, 0, model.rrr_dRequestTime),
                    DbHelperSQL.MakeInParam("@rrr_cStruct", SqlDbType.NVarChar,36, model.rrr_cStruct),
                    DbHelperSQL.MakeInParam("@rrr_cSubStruct", SqlDbType.NVarChar,36, model.rrr_cSubStruct),
                    DbHelperSQL.MakeInParam("@rrr_cSubSubStruct", SqlDbType.NVarChar,36, model.rrr_cSubSubStruct),
                    DbHelperSQL.MakeInParam("@rrr_cRepairItem", SqlDbType.NVarChar,50, model.rrr_cRepairItem),
                    DbHelperSQL.MakeInParam("@rrr_cRepairLevel", SqlDbType.NVarChar,50, model.rrr_cRepairLevel),
                    DbHelperSQL.MakeInParam("@rrr_cFollowStatus", SqlDbType.VarChar,50, model.rrr_cFollowStatus),
                    DbHelperSQL.MakeInParam("@rrr_cProblemDesc", SqlDbType.NVarChar,500, model.rrr_cProblemDesc),
                    DbHelperSQL.MakeInParam("@rrr_dBeginTime", SqlDbType.DateTime, 0, model.rrr_dBeginTime),
                    DbHelperSQL.MakeInParam("@rrr_dEndTime", SqlDbType.DateTime, 0, model.rrr_dEndTime),
                    DbHelperSQL.MakeInParam("@rrr_lSync", SqlDbType.Bit,1, 0),//model.rrr_lSync;
                    DbHelperSQL.MakeInParam("@rrr_dAddDate", SqlDbType.DateTime, 0, model.AddDate),
                    DbHelperSQL.MakeInParam("@rrr_dLastDate", SqlDbType.DateTime, 0, model.LastDate),
                    DbHelperSQL.MakeInParam("@rrr_RecordID", SqlDbType.UniqueIdentifier,16, model.RecordID)
                                            };

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

                return true;
            }
            catch (Exception ex) { throw ex; }
        }
 /// <summary>
 /// 響應事件,通知中心數據發生變化
 /// </summary>
 /// <param name="data">發生變化的對象</param>
 /// <param name="iRecordEditStatus">記錄編輯狀態(Insert = 1,Update = 2,Delete = 4)</param>
 void ResponseProductionDataChangedEvent(MachineRepairRequest data, int iRecordEditStatus)
 {
     data.RecordEditStatus = iRecordEditStatus;
     this.OnProductionChanged(data);
 }
Esempio n. 5
0
        /// <summary>
        /// “機台維修請求”記錄信息數據上傳到服務器數據庫中
        /// </summary>
        /// <param name="machineRepairRequest">機台維修請求</param>
        /// <returns></returns>
        public bool SynFirstRepairRequestRecordToDB(MachineRepairRequest machineRepairRequest)
        {
            try
            {
                bool l_lIsSuess = false;

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

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

                    try
                    {
                        //★通過判斷記錄的“記錄編輯狀態”(RecordEditStatus :Insert = 1,Update = 2,Delete = 4)來對記錄進行同步
                        if (machineRepairRequest != null)
                        {
                            if (machineRepairRequest.RecordEditStatus == 1)
                            {
                                this.m_objProductionDataSynDAL.AddMachineRepairRequest(machineRepairRequest, transaction);
                            }
                            else if (machineRepairRequest.RecordEditStatus == 2)
                            {
                                this.m_objProductionDataSynDAL.UpdateMachineRepairRequest(machineRepairRequest, transaction);
                            }
                            else if (machineRepairRequest.RecordEditStatus == 4)
                            {
                                this.m_objProductionDataSynDAL.DeleteMachineRepairRequest_ByID(machineRepairRequest.RecordID,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>
 public override void AddRepairRequestRecord(MachineRepairRequest RepairRequest)
 {
     try
     {
         if (RepairRequest == null)
         {
             return;
         }
         if (this.m_queueMachineRepairRequest == null)
         {
             this.m_queueMachineRepairRequest = new Queue<MachineRepairRequest>();
         }
         this.m_queueMachineRepairRequest.Enqueue(RepairRequest);
     }
     catch (Exception ex)
     {
         base.OnException(mc_strControllerName, "AddRepairRequestRecord", ex.Message);
     }
 }
 /// <summary>
 /// 新增一條機台維修請求記錄數據對象
 /// </summary>
 /// <param name="RealTimeData"></param>
 public abstract void AddRepairRequestRecord(MachineRepairRequest RepairRequest);