CFieldDB.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using OTSModelSharp.DTLBase;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace OTSModelSharp
  8. {
  9. public class CFieldDB : CSQLiteDB
  10. {
  11. public CFieldDB(IDBStoreBase _conStr, CSQLiteTable _table) : base(_conStr, _table)
  12. {
  13. }
  14. public void SaveAField(int fieldId,System.Drawing.Point fldPos,System.Drawing.Point OTSPos)
  15. {
  16. var tableInfoPtr = GetTableInfo();
  17. if (tableInfoPtr == null)
  18. {
  19. return ;
  20. }
  21. var datastorePtr = GetDatastore();
  22. string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
  23. string sSQLCommand;
  24. sSQLCommand = string.Format(sInsertFormat, fieldId, fldPos.X, fldPos.Y,OTSPos.X,OTSPos.Y);
  25. if (!datastorePtr.RunCommand(sSQLCommand))
  26. {
  27. return ;
  28. }
  29. return ;
  30. }
  31. public string GetSavingAFieldcmd(int fieldId, System.Drawing.Point OTSPos,System.Drawing.Point SemPos)
  32. {
  33. var tableInfoPtr = GetTableInfo();
  34. if (tableInfoPtr == null)
  35. {
  36. return "";
  37. }
  38. var datastorePtr = GetDatastore();
  39. string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
  40. string sSQLCommand;
  41. sSQLCommand = string.Format(sInsertFormat, fieldId, OTSPos.X, OTSPos.Y,SemPos.X,SemPos.Y);
  42. return sSQLCommand;
  43. }
  44. }
  45. }