private void SavePollingStepDataBuffers(PollingStepDB pollingStep) { RunOnUiThread (delegate { for (int i = 1; i <= 4; i++) { string dataFile = string.Empty; byte[] buffer = null; switch (i) { case 1: if (!string.IsNullOrEmpty (pollingStep.PollingData1File)) { dataFile = System.IO.Path.Combine (ContentPath, pollingStep.PollingData1File); buffer = pollingStep.PollingData1; } break; case 2: if (!string.IsNullOrEmpty (pollingStep.PollingData2File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData2File); buffer = pollingStep.PollingData2; } break; case 3: if (!string.IsNullOrEmpty (pollingStep.PollingData3File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData3File); buffer = pollingStep.PollingData3; } break; case 4: if (!string.IsNullOrEmpty (pollingStep.PollingData4File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData4File); buffer = pollingStep.PollingData4; } break; }//end switch if (null != buffer && buffer.Length > 0) { try { File.WriteAllBytes (dataFile, buffer); } catch (IOException e) { #if DEBUG System.Diagnostics.Debug.WriteLine ("Unable to save polling step"); #endif } } } }); }
private void SavePhotoPollBuffers(PollingStepDB pollStepToSave) { if (null != pollStepToSave.PollingData1 && pollStepToSave.PollingData1.Length > 0) pollStepToSave.PollingData1File = StringUtils.ConstructPollingStepDataFile (1, pollStepToSave.MessageGuid, pollStepToSave.StepNumber); if (null != pollStepToSave.PollingData2 && pollStepToSave.PollingData2.Length > 0) pollStepToSave.PollingData2File = StringUtils.ConstructPollingStepDataFile (2, pollStepToSave.MessageGuid, pollStepToSave.StepNumber); if (null != pollStepToSave.PollingData3 && pollStepToSave.PollingData3.Length > 0) pollStepToSave.PollingData3File = StringUtils.ConstructPollingStepDataFile (3, pollStepToSave.MessageGuid, pollStepToSave.StepNumber); if (null != pollStepToSave.PollingData4 && pollStepToSave.PollingData4.Length > 0) pollStepToSave.PollingData4File = StringUtils.ConstructPollingStepDataFile (4, pollStepToSave.MessageGuid, pollStepToSave.StepNumber); SavePollingStepDataBuffers (pollStepToSave); }
public static PollingStep ConvertFromPollingStepDB(PollingStepDB item) { PollingStep toReturn = new PollingStep (); toReturn.Errors = item.Errors.ToList (); toReturn.MessageID = item.MessageID; toReturn.PollingAnswer1 = item.PollingAnswer1; toReturn.PollingAnswer2 = item.PollingAnswer2; toReturn.PollingAnswer3 = item.PollingAnswer3; toReturn.PollingAnswer4 = item.PollingAnswer4; toReturn.PollingData1 = item.PollingData1; toReturn.PollingData2 = item.PollingData2; toReturn.PollingData3 = item.PollingData3; toReturn.PollingData4 = item.PollingData4; toReturn.PollingQuestion = item.PollingQuestion; toReturn.StepNumber = item.StepNumber; toReturn.HasResponded = item.HasResponded; return toReturn; }
private bool checkPhotoPollStepFileExists(PollingStepDB pollStep) { string contentpath = wowZapp.LaffOutOut.Singleton.ContentDirectory; if (pollStep != null) { bool exist = true; if (!string.IsNullOrEmpty (pollStep.PollingData1File)) exist &= File.Exists (System.IO.Path.Combine (contentpath, pollStep.PollingData1File)); if (!string.IsNullOrEmpty (pollStep.PollingData2File)) exist &= File.Exists (System.IO.Path.Combine (contentpath, pollStep.PollingData2File)); if (!string.IsNullOrEmpty (pollStep.PollingData3File)) exist &= File.Exists (System.IO.Path.Combine (contentpath, pollStep.PollingData3File)); if (!string.IsNullOrEmpty (pollStep.PollingData4File)) exist &= File.Exists (System.IO.Path.Combine (contentpath, pollStep.PollingData4File)); return exist; } else return false; }
public void SavePollingStepDataBuffers(PollingStepDB pollingStep) { for (int i = 1; i <= 4; i++) { string dataFile = string.Empty; byte[] buffer = null; switch (i) { case 1: if (!string.IsNullOrEmpty (pollingStep.PollingData1File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData1File); buffer = pollingStep.PollingData1; }//end if break; case 2: if (!string.IsNullOrEmpty (pollingStep.PollingData2File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData2File); buffer = pollingStep.PollingData2; }//end if break; case 3: if (!string.IsNullOrEmpty (pollingStep.PollingData3File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData3File); buffer = pollingStep.PollingData3; }//end if break; case 4: if (!string.IsNullOrEmpty (pollingStep.PollingData4File)) { dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData4File); buffer = pollingStep.PollingData4; }//end if break; }//end switch }//end for }