コード例 #1
0
ファイル: WorkerStore.cs プロジェクト: liamning/PF
    public bool IsExisted(WorkerStoreInfo info)
    {
        db.Open();
        String query = "select count(*)  from WorkerStore "
                       + " where WorkerID = @WorkerID ";
        var obj = (List <int>)db.Query <int>(query, info);

        db.Close();
        return(obj[0] > 0);
    }
コード例 #2
0
ファイル: WorkerStore.cs プロジェクト: liamning/PF
 public void Save(WorkerStoreInfo info)
 {
     if (this.IsExisted(info))
     {
         this.Update(info);
     }
     else
     {
         this.Insert(info);
     }
 }
コード例 #3
0
ファイル: WorkerStore.cs プロジェクト: liamning/PF
    public void Update(WorkerStoreInfo info)
    {
        db.Open();

        string query = " UPDATE [dbo].[WorkerStore] SET  "
                       + " [ClientCode] = @ClientCode "
                       + ", [ClientWorkerID] = @ClientWorkerID "
                       + ", [StoreCode] = @StoreCode "
                       + ", [StartDate] = @StartDate "
                       + ", [ToDate] = @ToDate "
                       + " where WorkerID = @WorkerID ";


        db.Execute(query, info);
        db.Close();
    }
コード例 #4
0
ファイル: WorkerStore.cs プロジェクト: liamning/PF
    public void Insert(WorkerStoreInfo info)
    {
        db.Open();

        string query = "INSERT INTO [dbo].[WorkerStore] ( [WorkerID] "
                       + ",[ClientCode] "
                       + ",[ClientWorkerID] "
                       + ",[StoreCode] "
                       + ",[StartDate] "
                       + ",[ToDate] "
                       + ") "
                       + "VALUES ( @WorkerID "
                       + ",@ClientCode "
                       + ",@ClientWorkerID "
                       + ",@StoreCode "
                       + ",@StartDate "
                       + ",@ToDate "
                       + ") ";


        db.Execute(query, info);
        db.Close();
    }