/// <remarks/> public void UploadWorkZoneAsync(WorkZone workZoneInfo, WorkZoneDetail[] listWorkZoneDetail, object userState) { if ((this.UploadWorkZoneOperationCompleted == null)) { this.UploadWorkZoneOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadWorkZoneOperationCompleted); } this.InvokeAsync("UploadWorkZone", new object[] { workZoneInfo, listWorkZoneDetail}, this.UploadWorkZoneOperationCompleted, userState); }
public void UploadWorkZone(WorkZone workZoneInfo, WorkZoneDetail[] listWorkZoneDetail) { this.Invoke("UploadWorkZone", new object[] { workZoneInfo, listWorkZoneDetail}); }
/// <remarks/> public void UploadWorkZoneAsync(WorkZone workZoneInfo, WorkZoneDetail[] listWorkZoneDetail) { this.UploadWorkZoneAsync(workZoneInfo, listWorkZoneDetail, null); }
private List<WorkZoneDetail> GetListWorkZoneDetail(string directoryWorkZone) { logger.Debug("BEGIN GetListWorkZoneDetail from directoryWorkZone = " + directoryWorkZone); string pathWorkZoneDetail = Path.Combine(directoryWorkZone, "zoneinfo.csv"); if (!File.Exists(pathWorkZoneDetail)) throw new Exception(Common.GetResourceString("MSG_ZONE_INFO_CSV_NOT_FOUND")); //Read CSV file List<WorkZoneDetail> listWorkZoneDetail = new List<WorkZoneDetail>(); StreamReader sr = new StreamReader(pathWorkZoneDetail, Encoding.GetEncoding(932)); string inputLine = ""; String[] inputLineValues = null; Regex r = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))"); while ((inputLine = sr.ReadLine()) != null) { inputLineValues = inputLine.Split('\n'); if (inputLineValues[0] != null && inputLineValues[0].Trim() != "") { string[] values = r.Split(inputLineValues[0]); if (values.Length >= 2) { #region Get WorkZone Detail if (string.IsNullOrWhiteSpace(values[0]) || values[0] == "") { continue; } WorkZoneDetail objWorkZoneDetail = new WorkZoneDetail(); objWorkZoneDetail.No = values[0];//A objWorkZoneDetail.PathType = CorrectString(values[1]);//B objWorkZoneDetail.Comment = CorrectString(values[2]);//C if (!string.IsNullOrEmpty(values[34]) && values[34] != "-")//AI objWorkZoneDetail.ToolLenth = double.Parse(values[34].Replace('-', '0')); if (!string.IsNullOrEmpty(values[8]) && values[8] != "-")//I objWorkZoneDetail.Tno = double.Parse(values[8]); if (!string.IsNullOrEmpty(values[10]) && values[10] != "-")//K objWorkZoneDetail.Tolerance = double.Parse(values[10]); if (!string.IsNullOrEmpty(values[11]) && values[11] != "-")//L objWorkZoneDetail.StockAllowance = double.Parse(values[11]); //NC Data objWorkZoneDetail.NCFileName = CorrectString(values[28]);//-> AC objWorkZoneDetail.MachineTime = values[61];//BJ if (!string.IsNullOrWhiteSpace(values[55]) && values[55] != "" && values[55] != "-")//BD objWorkZoneDetail.MachineDistance = double.Parse(values[55]); //Tool Infomation objWorkZoneDetail.ToolShape = CorrectString(values[6]); //G if (!string.IsNullOrEmpty(values[3]) && values[3] != "-")//D objWorkZoneDetail.ToolDia = double.Parse(values[3].ToUpper().Replace("D", "")); if (!string.IsNullOrEmpty(values[4]) && values[4] != "-")//E objWorkZoneDetail.ToolConerR = double.Parse(values[4].ToUpper().Replace("R", "")); objWorkZoneDetail.HolderName = CorrectString(values[25]); //Z //Cut Condition if (!string.IsNullOrEmpty(values[18]) && values[18] != "-")//S objWorkZoneDetail.Spindle = double.Parse(values[18]); if (!string.IsNullOrEmpty(values[20]) && values[20] != "-")//U objWorkZoneDetail.CuttingFeedRate = double.Parse(values[20]); if (!string.IsNullOrWhiteSpace(values[19]) && values[19] != "" && values[19] != "-")//T objWorkZoneDetail.ApproachFeedRate = double.Parse(values[19]); objWorkZoneDetail.Status = 0; string pathFileImage = Path.Combine(directoryWorkZone, string.Format(Constant.WORKNC_WZ_DETAIL_IMAGE_NAME, objWorkZoneDetail.No)); objWorkZoneDetail.Base64Data = null; if (File.Exists(pathFileImage)) { objWorkZoneDetail.ImageFile = Path.GetFileName(pathFileImage); // Load file meta data with FileInfo FileInfo fileInfo = new FileInfo(pathFileImage); // The byte[] to save the data in byte[] data = new byte[fileInfo.Length]; using (FileStream fs = fileInfo.OpenRead()) { fs.Read(data, 0, data.Length); } objWorkZoneDetail.Base64Data = Convert.ToBase64String(data); } listWorkZoneDetail.Add(objWorkZoneDetail); #endregion } else { return null; } } } sr.Close(); return listWorkZoneDetail; }