/// <summary> /// Amin: Update Submit time of a tape from log /// </summary> /// <param name="Schedule_ID"></param> /// <returns></returns> public bool UpdateTapeSubmittoDB() { int AffectedRows = -1; string CommandString; long IDToBEUpdated = GetScheudleTapeID(); if (TapeID > 0 && ScheduleID > 0 && IDToBEUpdated > 0) { CommandString = "Update scheduled_tapes Set SUBMITED_AT='" + AdminDB.ChangeDateTimeFormat(this.TapeSubmitTimeDB) + "'" + " Where SCHEDULED_TAPE_ID = " + IDToBEUpdated; (new AdminDB()).CheckDB(CommandString, out AffectedRows); } return(AffectedRows > 0 ? true : false); }
/// <summary> /// Nafise: adding runtape to Database /// </summary> /// <returns></returns> public bool AddRuntapetoDB() { string CommandString = ""; int AffectedRows = -1; if (ScheduleID > 0) { CommandString = "Insert into schedule_runtapes (SCHEDULE_ID, VOLSER, RECEIVED_AT) select " + ScheduleID + ", '" + this.volser + "', '" + AdminDB.ChangeDateTimeFormat(this.RunTapeTimeDB) + "'" + " Where not exists (select * from schedule_runtapes where SCHEDULE_ID = " + ScheduleID + " and VOLSER = '" + this.volser + "'and RECEIVED_AT ='" + AdminDB.ChangeDateTimeFormat(this.RunTapeTimeDB) + "')"; (new AdminDB()).CheckDB(CommandString, out AffectedRows); } return(AffectedRows > 0 ? true : false); }
/// <summary> /// Amin: add a tape from log /// </summary> /// <param name="Schedule_ID"></param> /// <returns></returns> public bool AddTapetoDB() { string CommandString = ""; int AffectedRows = -1; if (TapeID > 0 && ScheduleID > 0 && GetScheudleTapeID() < 0) { if (TapeMountTimeDB == DateTime.MinValue && this.RunTapeTimeDB == DateTime.MinValue) { CommandString = "Insert into scheduled_tapes (TAPE_ID, SCHEDULE_ID, VOLSER) values ('" + this.TapeID + "', " + ScheduleID + ", '" + this.volser + "')"; } else if (TapeMountTimeDB != DateTime.MinValue && this.RunTapeTimeDB == DateTime.MinValue) { CommandString = "Insert into scheduled_tapes (TAPE_ID, SCHEDULE_ID, VOLSER, MOUNTED_AT) values ('" + this.TapeID + "', " + ScheduleID + ", '" + this.volser + "', '" + AdminDB.ChangeDateTimeFormat(this.TapeMountTimeDB) + "')"; } //Adding Runtape else if (TapeMountTimeDB == DateTime.MinValue && this.RunTapeTimeDB != DateTime.MinValue) { CommandString = "Insert into scheduled_tapes (TAPE_ID, SCHEDULE_ID, VOLSER, RECEIVED_AT) values ('" + this.TapeID + "', " + ScheduleID + ", '" + this.volser + "', '" + AdminDB.ChangeDateTimeFormat(this.RunTapeTimeDB) + "')"; } else if (TapeMountTimeDB != DateTime.MinValue && this.RunTapeTimeDB != DateTime.MinValue) { CommandString = "Insert into scheduled_tapes (TAPE_ID, SCHEDULE_ID, VOLSER, MOUNTED_AT, RECEIVED_AT) values ('" + this.TapeID + "', " + ScheduleID + ", '" + this.volser + "', '" + AdminDB.ChangeDateTimeFormat(this.TapeMountTimeDB) + "', '" + AdminDB.ChangeDateTimeFormat(this.RunTapeTimeDB) + "')"; } (new AdminDB()).CheckDB(CommandString, out AffectedRows); } return(AffectedRows > 0? true:false); }