Esempio n. 1
0
        private List <TimeInOutLog> GetUpdatedDataFromServer(DateTime UpdatedDate)
        {
            dcTimeInOutLog_SQL dc = new dcTimeInOutLog_SQL();

            dc.SelectParameters.Add("p_ClientId", ClientSettings.ClientWorkStationInfo.ClientId);
            dc.SelectParameters.Add("p_UpdatedDate", UpdatedDate);
            return(dc.GetDataSource());
        }
Esempio n. 2
0
        private List <TimeInOutLog> GetNewDataFromServer(DateTime CreatedDate)
        {
            dcTimeInOutLog_SQL dc = new dcTimeInOutLog_SQL();

            // SQLServer.Procedure p = new SQLServer.Procedure("dbo.SelectTimeInOutLogs");
            dc.SelectParameters.Add("p_ClientId", ClientSettings.ClientWorkStationInfo.ClientId);
            dc.SelectParameters.Add("p_UploadedDate", CreatedDate);
            return(dc.GetDataSource());
        }
Esempio n. 3
0
        private void UploadDataToServer()
        {
            try
            {
                List <TimeInOutLog>  list     = new List <TimeInOutLog>();
                dcTimeInOutLog_OleDb _dcOLEDb = new dcTimeInOutLog_OleDb();
                list = _dcOLEDb.GetDataSource("Select * from TimeInOutLog where UploadedDate is null");

                foreach (TimeInOutLog info in list)
                {
                    string LogInfo = string.Empty;
                    try
                    {
                        LogInfo = "ProfileId:" + info.ProfileId + ";ClientEmployeeId:" + info.ClientEmployeeId;
                        dcTimeInOutLog_SQL _dcSQL = new dcTimeInOutLog_SQL();
                        _dcSQL.UpdateParameters.Add("p_ServerLogInOutId", info.ServerLogInOutId, SqlDbType.Int, ParameterDirection.InputOutput);
                        _dcSQL.UpdateParameters.Add("p_ClientId", info.ClientId);
                        _dcSQL.UpdateParameters.Add("p_ClientEmployeeId", info.ClientEmployeeId);
                        _dcSQL.UpdateParameters.Add("p_DTRDate", info.DTRDate, SqlDbType.Date);
                        _dcSQL.UpdateParameters.Add("p_ShiftId", info.ShiftId);
                        _dcSQL.UpdateParameters.Add("p_TimeIn", info.TimeIn, SqlDbType.DateTime);
                        if (info.TimeOut != new DateTime(1, 1, 1))
                        {
                            _dcSQL.UpdateParameters.Add("p_TimeOut", info.TimeOut, SqlDbType.DateTime);
                        }
                        _dcSQL.UpdateParameters.Add("p_WorkStationId", info.WorkStationId);
                        _dcSQL.UpdateParameters.Add("p_TimeInWSId", info.TimeInWSId);
                        _dcSQL.UpdateParameters.Add("p_TimeOutWSId", info.TimeOutWSId);
                        _dcSQL.UpdateParameters.Add("p_LogInOutId", info.LogInOutId);
                        _dcSQL.Update();
                        //update local db
                        this.DBConn.Open();
                        string sql = "Update TimeInOutLog set UploadedDate=#" + DateTime.Now + "#,ServerLogInOutId=" + _dcSQL.UpdateParameters.GetItem("p_ServerLogInOutId").Value.ToString()
                                     + "  where UploadedDate is null"
                                     + "  and LogInOutId=" + info.LogInOutId
                                     + "  and ClientEmployeeId=" + info.ClientEmployeeId
                                     + "  and WorkStationId=" + info.WorkStationId;
                        OleDbCommand _cmd = new OleDbCommand(sql, this.DBConn);
                        _cmd.ExecuteNonQuery();
                        this.DBConn.Close();
                        _dcSQL = null;
                    }
                    catch (Exception ex)
                    {
                        string ErrorMsg = "(loginfo:" + LogInfo + ")" + ex.ToString();
                        ConsoleApp.WriteLine(Application.ProductName, "[Error]," + ErrorMsg);
                        zsi.PhotoFingCapture.Util.LogError(ErrorMsg);
                    }
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }