public static bool UploadCellInfo(Clamp clamp) { Floor floor = null; for (int i = 0; i < Current.ovens.Count; i++) { for (int j = 0; j < Current.ovens[i].Floors.Count; j++) { floor = Current.ovens[i].Floors[j]; } } string cz_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string timeSpan = (floor.RunMinutesSet / 60).ToString(); string startTimeS = clamp.BakingStartTime < DateTime.Parse("2010-01-01") ? "" : clamp.BakingStartTime.ToString("yyyy-MM-dd HH:mm:ss"); string stopTimeS = clamp.BakingStopTime < DateTime.Parse("2010-01-01") ? "" : clamp.BakingStopTime.ToString("yyyy-MM-dd HH:mm:ss"); string outTimeS = clamp.OutTime < DateTime.Parse("2010-01-01") ? "" : clamp.OutTime.ToString("yyyy-MM-dd HH:mm:ss"); string vacuumS = clamp.Vacuum.ToString(); string techNo = clamp.TechNo; try { DataAbstr obj = DataAbstr.GetInstance(); foreach (Battery battery in clamp.Batteries) { string sfc = battery.Code; string[] data = new string[11] { clamp.Code, Current.option.TemperatureSet, timeSpan, clamp.Temperature.ToString(), vacuumS, "", startTimeS, stopTimeS, "", outTimeS, techNo }; string cz_user = string.IsNullOrEmpty(TengDa.WF.Current.user.Number) ? "" : TengDa.WF.Current.user.Name; if (obj.UploadData_F(sfc, floor.Number, cz_date, cz_user, clamp.clampError.Id == 1 ? "OK" : "NG", clamp.clampError.Id == 1 ? "" : clamp.clampError.ErrorCode, data, "") != -1) { return(false); } } return(true); } catch (Exception ex) { Error.Alert(ex); } return(false); }
public static bool Update(Clamp newClamp, out string msg) { return(Database.NonQuery(string.Format("UPDATE [dbo].[{0}] SET [EnterTime] = '{1}', [OutTime] = '{2}', [BakingStartTime] = '{3}', [BakingStopTime] = '{4}', [Vacuum] = {5}, [Temperature] = {6}, [IsUploaded] = '{7}', [IsFinished] = '{8}' WHERE [Id] = {9}", TableName, newClamp.EnterTime, newClamp.OutTime, newClamp.BakingStartTime, newClamp.BakingStopTime, newClamp.Vacuum, newClamp.Temperature, newClamp.IsUploaded, newClamp.IsFinished, newClamp.Id), out msg)); }
public static bool Delete(Clamp delClamp, out string msg) { return(Database.NonQuery(string.Format("DELETE FROM [dbo].[{0}] WHERE [Code] = '{1}'", TableName, delClamp.Code), out msg)); }
public static int Add(Clamp addClamp, out string msg) { return(Database.Insert(string.Format("INSERT INTO [dbo].[{0}] ([Code], [UserId], [EnterTime], [OutTime], [FloorId], [Location], [BakingStartTime], [BakingStopTime], [Vacuum], [Temperature], [IsUploaded], [IsFinished], [ErrorId], [TechNo]) VALUES ('{1}', {2}, '{3}', '{4}', {5}, '{6}', '{7}', '{8}', {9}, {10}, '{11}', '{12}', 1, '{13}')", TableName, addClamp.Code, TengDa.WF.Current.user.Id, addClamp.EnterTime, addClamp.OutTime, addClamp.FloorId, addClamp.Location, addClamp.BakingStartTime, addClamp.BakingStopTime, addClamp.Vacuum, addClamp.Temperature, addClamp.IsUploaded, addClamp.IsFinished, addClamp.TechNo), out msg)); }