public RegisterDevice() { InitializeComponent(); txtDeviceID.Text = AccountInfo.GetDeviceID(); m_Options = new Options(); m_Options.LoadOptionsFromDB(); txtEmployee.Text = m_Options.EmpName; txtCompany.Text = m_Options.CompanyName; }
public static string GetRegisterNewAccountString(string EmployeeName, string CompanyName) { Newtonsoft.Json.Linq.JObject jo = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JObject jp = new Newtonsoft.Json.Linq.JObject(); jo.Add("interface", "ADSFPRestAPI"); jo.Add("method", "registerAccountNew"); jp.Add("prmAccountID", AccountInfo.GetDeviceID()); jp.Add("prmCompanyName", CompanyName); jp.Add("prmEmployeeName", EmployeeName); jp.Add("parameters", jp); jo.Add("parameters", jp); return(jo.ToString()); }
public static string GetAccountInformationString() { /* * JsonObject jo = new JsonObject(); * JsonObject jp = new JsonObject(); * * jo.Add("interface", "ADSFPRestAPI"); * jo.Add("method", "getAccountInformation"); * jp.Add("prmAccountID", AccountInfo.GetDeviceID()); * jo.Add("parameters", jp); * * * return jo.ToString();*/ Newtonsoft.Json.Linq.JObject jo = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JObject jp = new Newtonsoft.Json.Linq.JObject(); jo.Add("interface", "ADSFPRestAPI"); jo.Add("method", "getAccountInformation"); jp.Add("prmAccountID", AccountInfo.GetDeviceID()); jo.Add("parameters", jp); return(jo.ToString()); }
public void Sync_Clicked(object sender, EventArgs e) { bool bBadgeReceived = false; bool bProfileReceived = false; //send data //get badge.def //get profile.def //List<RawDataRecord> RawList = DataAccess.GetRecordTable(false); List <RawDataRecord> RawList = DataAccess.GetPendingData(); string RawData = DataTrack.GetRawFileHeader(m_Options.ProbeName); for (int Count = 0; Count < RawList.Count; Count++) { RawData += string.Format("{0}0 HH {1,-12}{2}\r\n", DataTrack.GetTimeStamp(RawList[Count].TimeStamp), RawList[Count].ScanValue, RawList[Count].Flags); } RawData += string.Format("T 000\r\n"); RawData += string.Format("S {0}\r\n", AccountInfo.GetDeviceID()); NameValueCollection RawValues = WebInteraction.GetRawFileSendValues(m_Options.CompanyID, m_Options.WebFolder, m_Options.ProbeName); RawValues.Add("filedata", RawData); RawValues.Add("FileLen", RawData.Length.ToString()); string result = WebInteraction.SendHttpPostValues(WebInteraction.m_FileSyncURL, RawValues); if (result.IndexOf("<adsdelimiter>") >= 0) { result += "<adsdelimiter>"; string Temp = result.Substring(0, result.IndexOf("<adsdelimiter>")); result = result.Substring(result.IndexOf("<adsdelimiter>") + 14); if (Temp == RawValues["fname"]) { Temp = result.Substring(0, result.IndexOf("<adsdelimiter>")); if (Temp == RawValues["FileLen"]) { //DataAccess.UpdateRecordTable(); //DataAccess.UpdateProfileRecordStatus(); } } } NameValueCollection UseMe = WebInteraction.GenerateDefFileRequest(m_Options.CompanyID, m_Options.WebFolder, "BADGE.DEF"); result = WebInteraction.SendHttpPostValues(WebInteraction.m_FileSyncURL, UseMe); if (result != "") { //process badge.def FileInteraction.WriteCompleteFile("DEF", "BADGE.DEF", result); bBadgeReceived = true; } UseMe = WebInteraction.GenerateDefFileRequest(m_Options.CompanyID, m_Options.WebFolder, "PROFILE.DEF"); result = WebInteraction.SendHttpPostValues(WebInteraction.m_FileSyncURL, UseMe); if (result != "") { //process badge.def FileInteraction.WriteCompleteFile("DEF", "PROFILE.DEF", result); bProfileReceived = true; } if (bBadgeReceived) { DataTrack.LoadBadgesFromFile(); } if (bProfileReceived) { DataTrack.LoadProfileLevelsFromFile(); } }