1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using OTSModelSharp.DTLBase;
- using System;
- using System.Collections.Generic;
- using System.Data.Common;
- using System.Data.SQLite;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OTSModelSharp
- {
- public class CFieldDB : CSQLiteDB
- {
- public CFieldDB(IDBStoreBase _conStr, CSQLiteTable _table) : base(_conStr, _table)
- {
- }
- public void SaveAField(int fieldId,System.Drawing.Point fldPos,System.Drawing.Point OTSPos)
- {
- var tableInfoPtr = GetTableInfo();
- if (tableInfoPtr == null)
- {
- return ;
- }
- var datastorePtr = GetDatastore();
- string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
- string sSQLCommand;
- sSQLCommand = string.Format(sInsertFormat, fieldId, fldPos.X, fldPos.Y,OTSPos.X,OTSPos.Y);
- if (!datastorePtr.RunCommand(sSQLCommand))
- {
- return ;
- }
- return ;
- }
- public string GetSavingAFieldcmd(int fieldId, System.Drawing.Point OTSPos,System.Drawing.Point SemPos)
- {
-
- var tableInfoPtr = GetTableInfo();
- if (tableInfoPtr == null)
- {
- return "";
- }
- var datastorePtr = GetDatastore();
- string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
- string sSQLCommand;
-
- sSQLCommand = string.Format(sInsertFormat, fieldId, OTSPos.X, OTSPos.Y,SemPos.X,SemPos.Y);
-
-
- return sSQLCommand;
- }
- public KeyValuePair<string, SQLiteParameter[]> GetSavingAFieldcmdObj(int fieldId, System.Drawing.PointF OTSPos, System.Drawing.PointF SemPos)
- {
- var tableInfoPtr = GetTableInfo();
- var datastorePtr = GetDatastore();
- var sInsertCmd = tableInfoPtr.GetInsertCommand(true);
-
- var paras = sInsertCmd.Value;
-
- paras[0].Value= fieldId;
- paras[1].Value= OTSPos.X;
- paras[2].Value= OTSPos.Y;
- paras[3].Value= SemPos.X;
- paras[4].Value= SemPos.Y;
- return new KeyValuePair<string,SQLiteParameter[]>(sInsertCmd.Key, paras.ToArray());
- }
- }
- }
|