public static void transfer2Server() { int total = 0; int success = 0; TransactionDao dao = new TransactionDao(); int StationID = Convert.ToInt16(ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID")); String cri = " Where t.LoungePlace=" + StationID; List <ModelTransaction> lists = dao.SelectOffine(cri + " order by t.update_date desc", StationID); if (lists != null) { total = lists.Count; logger.Debug("# Start Transfer data to server."); logger.Debug("Local transaction have " + lists.Count + " records."); if (lists.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (ModelTransaction model in lists) { bool result = dao.Insert(model, StationID); if (result) { logger.Debug("Local transaction have " + lists.Count + " records."); //Delete local data when transfer to ser success. if (dao.DeleteOffline(model, StationID)) { success++; } } } } logger.Debug("# Summary=> Total transfer total: " + total + " success: " + success + " fail: " + (total - success)); logger.Debug("# End Transfer data to server."); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { Cursor = Cursors.WaitCursor; int id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); String cri = " where t.id=" + id; List <ModelTransaction> lists = (onlineStatus) ? dao.Select(cri, StationID) : dao.SelectOffine(cri, StationID); if (lists.Count > 0) { tran = lists[0]; FrmDetail frmManualGen = new FrmDetail(this, tran); frmManualGen.ShowDialog(); } Cursor = Cursors.Default; } }