public Line(Coords _A, Coords _B, LINETYPE _type) { A = _A; B = _B; type = _type; v = new Coords(B.x - A.x, B.y - A.y, B.z - A.z); }
public Line(Coords _A, Coords _V) { A = _A; v = _V; B = _A + v; type = LINETYPE.SEGMENT; }
public Line(RecreateCoordinates A, RecreateCoordinates B, LINETYPE type) { this.A = A; this.B = B; this.type = type; v = new RecreateCoordinates(B.x - A.x, B.y - A.y, B.z - A.z); }
public void Switch(LINETYPE tp) { if (Type != tp) { Type = tp; } }
void registerFunctionClass(LINETYPE _lineType, InternalFunction _function) { if (this.registeredFunctions.ContainsKey(_lineType)) { throw new Exception("LINETYPE " + _lineType + " IS ALREADY REGISTERED"); } var me = this; _function.SetScriptMaster(ref me); this.registeredFunctions.Add(_lineType, _function); }
public void AddTextField(String preText, String postText, int width, String name) { StackPanel sp = KernelLib.GenLinePane(); addLabel2StackPane(ref sp, preText); addTextField2StackPane(ref sp, width); addLabel2StackPane(ref sp, postText); appendLinePan2Canvas(ref mMW.amCanvas, ref sp); LINETYPE type = LINETYPE.TXTFIELD; mLinetypes.Add(type); mVarNames.Add(name); }
public void AddRadioButtonLine(String preText, String postText, Dictionary <int, String> contents, String name) { StackPanel sp = KernelLib.GenLinePane(); addLabel2StackPane(ref sp, preText); addRadioButtonGroup2StackPane(ref sp, contents); addLabel2StackPane(ref sp, postText); appendLinePan2Canvas(ref mMW.amCanvas, ref sp); LINETYPE type = LINETYPE.RADIO; mLinetypes.Add(type); mVarNames.Add(name); }
public static LINETYPE Str2LineType(String typeStr) { LINETYPE retval = LINETYPE.UNKNOW; if (typeStr.Equals("RADIO")) { retval = LINETYPE.RADIO; } else if (typeStr.Equals("COMBO")) { retval = LINETYPE.COMBO; } else if (typeStr.Equals("TXTFIELD")) { retval = LINETYPE.TXTFIELD; } return(retval); }
public void AddComboLine(String preText, String postText, Dictionary <int, String> selections, String name) { StackPanel sp = KernelLib.GenLinePane(); addLabel2StackPane(ref sp, preText); addCombobox2StackPane(ref sp, selections); addLabel2StackPane(ref sp, postText); int elementCount = mMW.amCanvas.Children.Count; appendLinePan2Canvas(ref mMW.amCanvas, ref sp); LINETYPE type = LINETYPE.COMBO; mLinetypes.Add(type); mVarNames.Add(name); }
private void readAndSaveSchedule(List <DateTime> dts) { foreach (FileMappingSetting setting in settings) { Dictionary <LINETYPE, string> sheetLineTypeMappings = setting.sheetLineTypeMappings; string filePath = setting.filePath; int floorId = setting.floorId; //For testing table.row["N"] is a number or not int i = 0; //PMC remark field index(always in excel row 3, index -1) int remarkIndex = 2; DataSet ds = this.readFile(filePath); if (ds == null) { return; } foreach (KeyValuePair <LINETYPE, string> mapping in sheetLineTypeMappings) { LINETYPE lineType = mapping.Key; string sheetName = mapping.Value; //Get sheet var table = ds.Tables[sheetName]; List <PrepareSchedule> dataInExcel = new List <PrepareSchedule>(); foreach (DateTime dt in dts) { Console.WriteLine("Process {0} {1} Data", lineType.ToString(), dt.ToString("yyyy/MM/dd")); //Get date field match current date int dateIndex = 0; for (var col = 1; col < table.Columns.Count; col++) { var check_data = table.Rows[5][col]; if (dt.Equals(check_data)) { dateIndex = col; break; } } string remark = table.Rows[remarkIndex][dateIndex].ToString(); //Save pmc remark at specific field if (lineType != LINETYPE.PREASSY) { saveRemark(remark, (int)lineType, dt); } //把 DataSet 顯示出來 for (int row = 0; row < table.Rows.Count; row++) { if (row < 6) { continue; } string totalQtyField = table.Rows[row][4].ToString(); string scheduleQtyField = table.Rows[row][dateIndex].ToString(); var modelField = table.Rows[row][2]; if (int.TryParse(totalQtyField, out i) == true && Int32.Parse(totalQtyField) > 0 && int.TryParse(scheduleQtyField, out i) == true && Int32.Parse(scheduleQtyField) > 0 && !System.DBNull.Value.Equals(modelField)) { var scheduleProcessField = table.Rows[row][1].ToString(); if (!System.DBNull.Value.Equals(modelField)) { Console.WriteLine("Type: {0} and ModelName: {1}", modelField.GetType(), modelField); string po = table.Rows[row][3].ToString().Trim(); string modelName = table.Rows[row][2].ToString().Trim(); int totalQty = Int32.Parse(totalQtyField); int scheduleQty = Int32.Parse(scheduleQtyField); string poRemark = table.Rows[row][14].ToString().Trim(); decimal timeCost; int lineTypeId; if ((lineType == LINETYPE.PREASSY && scheduleProcessField.Contains("BASSY")) || (lineType == LINETYPE.ASSY && scheduleProcessField.Contains("AASSY"))) { continue; } if (lineType == LINETYPE.PREASSY || lineType == LINETYPE.ASSY) { lineTypeId = scheduleProcessField.Contains("BASSY") ? (int)LINETYPE.ASSY : (int)LINETYPE.PREASSY; } else { lineTypeId = (int)lineType; } if (lineType == LINETYPE.PACKING) { var fitData = worktimes.FirstOrDefault(w => modelName.Equals(w.modelName)); if (fitData == null) { Console.WriteLine("{0}, packingLeadTime is zero", modelName); continue; } timeCost = (fitData.packingLeadTime ?? 0) * scheduleQty; } else { timeCost = Decimal.Parse(table.Rows[row][dateIndex + 1].ToString()); } dataInExcel.Add(new PrepareSchedule() { po = po, modelName = modelName, lineType_id = lineTypeId, totalQty = totalQty, scheduleQty = scheduleQty, timeCost = timeCost, floor_id = floorId, onboardDate = dt, priority = 0, undoneQty = 0, po_memo = "".Equals(poRemark) ? null : poRemark, createDate = DateTime.Today }); } } } } List <PrepareSchedule> dataInDb = db.PrepareSchedule.Where( p => dts.Contains(p.onboardDate) && (p.lineType_id == (int)lineType) && p.floor_id == floorId) .ToList(); //Compare data and add/remove var newData = dataInExcel.Except(dataInDb); var deletedData = dataInDb.Except(dataInExcel); db.PrepareSchedule.AddRange(newData); db.PrepareSchedule.RemoveRange(deletedData); db.SaveChanges(); Console.WriteLine("FloorId {0} {1}, Data in sql: {2}, data in excel: {3}", floorId, lineType.ToString(), dataInDb.Count(), dataInExcel.Count() ); Console.WriteLine("FloorId {0} {1}, Data total add cnt: {2}, remove cnt: {3}", floorId, lineType.ToString(), newData.Count(), deletedData.Count() ); } } }
public ExportDataEntry(string text, LINETYPE type = LINETYPE.NONE, object data = null) { m_szText = text; m_nType = type; m_pData = data; }