/// <summary> /// Esimated Finishing Time (by Download Time) /// </summary> private TimeSpan GetEftByDownloadTime(TimeSpan frameTime) { if (DownloadTime.IsUnknown()) { return(TimeSpan.Zero); } if (FinishedTime.IsKnown()) { return(FinishedTime.Subtract(DownloadTime)); } // Issue 156 - ETA must be a positive TimeSpan // Issue 134 - Since fixing Issue 156 it appears that once most // bigadv units finish their last frame they would be assigned a // Zero EFT since their ETA values would have been zero and they // had not yet written the FinishedTime to the queue.dat file. // In light of this I've added the AllFramesAreCompleted property. // Now, if ETA is Zero and AllFramesAreCompleted == false, the EFT // will be Zero. Otherwise, it will be given a value of the // (UnitRetrievalTime plus ETA) minus the DownloadTime. TimeSpan eta = GetEta(frameTime); if (eta.IsZero() && AllFramesCompleted == false) { return(TimeSpan.Zero); } return(_unitInfo.UnitRetrievalTime.Add(eta).Subtract(DownloadTime)); }
public override int GetHashCode() { unchecked { int result = (m_ObjPropertyCollection != null ? m_ObjPropertyCollection.GetHashCode() : 0); result = (result * 397) ^ (CharacterSet != null ? CharacterSet.GetHashCode() : 0); result = (result * 397) ^ (ContentEncoding != null ? ContentEncoding.GetHashCode() : 0); result = (result * 397) ^ (ContentType != null ? ContentType.GetHashCode() : 0); result = (result * 397) ^ (Headers != null ? Headers.GetHashCode() : 0); result = (result * 397) ^ IsFromCache.GetHashCode(); result = (result * 397) ^ IsMutuallyAuthenticated.GetHashCode(); result = (result * 397) ^ LastModified.GetHashCode(); result = (result * 397) ^ (Method != null ? Method.GetHashCode() : 0); result = (result * 397) ^ (OriginalReferrerUrl != null ? OriginalReferrerUrl.GetHashCode() : 0); result = (result * 397) ^ (OriginalUrl != null ? OriginalUrl.GetHashCode() : 0); result = (result * 397) ^ (ProtocolVersion != null ? ProtocolVersion.GetHashCode() : 0); result = (result * 397) ^ (Referrer != null ? Referrer.GetHashCode() : 0); result = (result * 397) ^ (ResponseUri != null ? ResponseUri.GetHashCode() : 0); result = (result * 397) ^ (Server != null ? Server.GetHashCode() : 0); result = (result * 397) ^ StatusCode.GetHashCode(); result = (result * 397) ^ (StatusDescription != null ? StatusDescription.GetHashCode() : 0); result = (result * 397) ^ (Step != null ? Step.GetHashCode() : 0); result = (result * 397) ^ (Text != null ? Text.GetHashCode() : 0); result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0); result = (result * 397) ^ DownloadTime.GetHashCode(); return(result); } }
public ActionResult Edit(DownloadTime obj) { if (ModelState.IsValid) { DownloadTimeService.PostEdit(obj); return(Json("OK", JsonRequestBehavior.AllowGet)); } return(PartialView("Edit", obj)); }
private DateTime AdjustDeadlineForDaylightSavings(double days) { DateTime deadline = DownloadTime.AddDays(days); // download time is DST if (DownloadTime.IsDaylightSavingTime()) { if (!deadline.IsDaylightSavingTime()) { return(deadline.Subtract(TimeSpan.FromHours(1))); } } else // not DST { if (deadline.IsDaylightSavingTime()) { return(deadline.AddHours(1)); } } return(deadline); }
private TimeSpan GetUnitTimeByDownloadTime(TimeSpan frameTime) { if (DownloadTime.IsUnknown()) { return(TimeSpan.Zero); } if (FinishedTime.IsKnown()) { return(FinishedTime.Subtract(DownloadTime)); } // If ETA is Zero and AllFramesAreCompleted == false, the Unit Time // will be Zero. Otherwise, it will be given a value of the // (UnitRetrievalTime plus ETA) minus the DownloadTime. TimeSpan eta = GetEta(frameTime); if (eta == TimeSpan.Zero && AllFramesCompleted == false) { return(TimeSpan.Zero); } return(_unitInfo.UnitRetrievalTime.Add(eta).Subtract(DownloadTime)); }
private int GetRawTimePerUnitDownload() { //if (_unitInfo.FramesObserved <= 0) return 0; // was making the check on FramesObserved above - I believe this was in an // attempt to validate that an object would be assigned to CurrentFrame. // if this is truly what we're trying to validate, it would make more sense // to simply check CurrentFrame for null - 2/7/11 if (_unitInfo.CurrentFrame == null) { return(0); } // Make sure FrameID is greater than 0 to avoid DivideByZeroException - Issue 34 if (DownloadTime.IsUnknown() || _unitInfo.CurrentFrame.ID <= 0) { return(0); } // Issue 92 TimeSpan timeSinceUnitDownload = _unitInfo.UnitRetrievalTime.Subtract(DownloadTime); return(Convert.ToInt32(timeSinceUnitDownload.TotalSeconds) / _unitInfo.CurrentFrame.ID); }
public ActionResult Delete(DownloadTime obj) { DownloadTimeService.PostDelete(obj); return(Json("OK", JsonRequestBehavior.AllowGet)); }
public override bool Save() { try { using (SqlConnection connection = DbControl.GetOpenConnection()) { SqlCommand command = connection.CreateCommand(); command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value = CEID.ToString(); command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value = CSTID.ToString(); command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString(); command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID; command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value = CSTSize == null ? "" : CSTSize.ToString(); command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value = EngCode == null ? "" : EngCode; command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString(); command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value = HostMsg == null ? "" : HostMsg; command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + ""; command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value = InNo.ToString(); command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString(); command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value = KeyID == null ? "" : KeyID; command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand; command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value = LotJudge == null ? "" : LotJudge; command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString(); command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode; command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value = PartNum == null ? "" : PartNum; command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString(); command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID; command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value = PrcID == null ? "" : PrcID; command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value = ProdType == null ? "" : ProdType; command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value = RCP == null ? "" : RCP; command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString(); command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); command.CommandText = "update lot_data set " + "ceid=@ceid, cst_id=@cst_id, cst_size=@cst_size, eng_code=@eng_code, gls_thick=@gls_thick, host_msg=@host_msg, inline_code=@inline_code, inno=@inno, " + "outno=@outno, keyid=@keyid, lot_command=@lot_command, lot_id=@lot_id, lot_judge=@lot_judge, lot_start_time=@lot_start_time, lot_state=@lot_state, mode_code=@mode_code, part_num=part_num, permit=@permit, " + "port_id=@port_id, prc_id=@prc_id, prod_type=@prod_type, rcp=@rcp, slot_count=@slot_count, download_time=@download_time " + "where lot_code=@lot_code"; command.Connection = connection; command.ExecuteNonQuery(); } return(true); } catch (SqlException ex) { CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex)); } return(false); }
public override bool Add() { SqlDataReader reader = null; try { using (SqlConnection connection = DbControl.GetOpenConnection()) { SqlCommand readCommand = connection.CreateCommand(); readCommand.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString(); readCommand.CommandText = "select * from lot_data where lot_code=@lot_code"; readCommand.Connection = connection; reader = readCommand.ExecuteReader(); if (reader.Read()) { reader.Close(); } else { reader.Close(); SqlCommand command = connection.CreateCommand(); //신규 command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value = CEID.ToString(); command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value = CSTID.ToString() + ""; command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString(); command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID; command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value = CSTSize == null ? "" : CSTSize.ToString(); command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value = EngCode == null ? "" : EngCode; command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString(); command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value = HostMsg == null ? "" : HostMsg; command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + ""; command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value = InNo.ToString(); command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString(); command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value = KeyID == null ? "" : KeyID; command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand; command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value = LotJudge == null ? "" : LotJudge; command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString(); command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode; command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value = PartNum == null ? "" : PartNum; command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString(); command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID; command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value = PrcID == null ? "" : PrcID; command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value = ProdType == null ? "" : ProdType; command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value = RCP == null ? "" : RCP; command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString(); command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); command.Connection = connection; command.CommandText = "insert into lot_data " + "(lot_code, ceid, cst_id, cst_size, eng_code, gls_thick, host_msg, inline_code, inno, outno, keyid, lot_command, lot_id, lot_judge, lot_state, mode_code, part_num, permit, port_id, prc_id, prod_type, rcp, slot_count, download_time) " + "values (@lot_code, @ceid, @cst_id, @cst_size, @eng_code, @gls_thick, @host_msg, @inline_code, @inno, @outno, @keyid, @lot_command, @lot_id, @lot_judge, @lot_state, @mode_code, @part_num, @permit, @port_id, @prc_id, @prod_type, @rcp, @slot_count, @download_time)"; command.ExecuteNonQuery(); return(true); } } } catch (SqlException ex) { CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex)); } finally { if (reader != null) { reader.Close(); } } return(false); }