public void Processor_TwoColorValues_ShouldPass(TypeOfProcess typeCode, IColor colorOne, IColor colorTwo) { var processor = new ColorsProcessor(); processor.Process(colorOne, colorTwo); Assert.Equal(typeCode, processor.LastProcess); }
public void update(TypeOfProcess typeOfProcess) { var typeP = context.TypeOfProcesses.Attach(typeOfProcess); typeP.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); }
private void dataGridViewTypeOfProcess_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DataGridViewCell cell = purFrm.DataGridViewItem.Rows[rowIndex].Cells[columnIndex]; if (null != cell) { TypeOfProcess typeOfProcess = new TypeOfProcess(int.Parse(dataGridViewTypeOfProcess.Rows[e.RowIndex].Cells["id"].Value.ToString()), dataGridViewTypeOfProcess.Rows[e.RowIndex].Cells["name"].Value.ToString(), dataGridViewTypeOfProcess.Rows[e.RowIndex].Cells["unit"].Value.ToString()); if (null != cell.Tag && !((TypeOfProcess)cell.Tag).Name.Equals(typeOfProcess.Name)) { string columnName = purFrm.DataGridViewItem.Columns[columnIndex].Name; int index = int.Parse(columnName.Substring(columnName.Length - 1, 1)); string number = "ColumnNumber" + index; purFrm.insertIntoStats((TypeOfProcess)cell.Tag, purFrm.DataGridViewItem.Rows[rowIndex].Cells["ColumnThickness"].Value.ToString(), -decimal.Parse(purFrm.DataGridViewItem.Rows[rowIndex].Cells[number].Value.ToString())); } // 对tag的修改一定要放在对value修改的前面,因为对value的修改,将会触发CellValueChanged事件 cell.Tag = typeOfProcess; cell.Value = dataGridViewTypeOfProcess.Rows[e.RowIndex].Cells["name"].Value.ToString(); this.Close(); } }
public void Processor_OneColorValue_ShouldPass(TypeOfProcess typeCode, IColor color) { var processor = new Processor(); var processHelper = new ProcessHelper<IProcessor>(processor); processHelper.Process(color); Assert.Equal(typeCode, processor.LastProcess); }
public void Processor_OneColorValue_ShouldPass(TypeOfProcess typeCode, IColor color) { var processor = new Processor(); var processHelper = new ProcessHelper <IProcessor>(processor); processHelper.Process(color); Assert.Equal(typeCode, processor.LastProcess); }
public void delete(int id) { TypeOfProcess typeP = context.TypeOfProcesses.Find(id); if (typeP != null) { context.TypeOfProcesses.Remove(typeP); context.SaveChanges(); } }
public int CreateTypeOfProcess(string name) { var typeP = new TypeOfProcess() { name = name }; this.processRepository.add(typeP); return(typeP.id); }
private decimal computeWorkingNumberX(XialiaoOrderItem xialiaoOrderItem, TypeOfProcess workingNameX, ProcessingImage workingDiagramX) { decimal value = 0; OrderItem orderItem = xialiaoOrderItem.OrderItem; if (null == workingNameX || null == workingDiagramX) { return(0); } else { TypeOfProcess typePro = workingNameX; if (Parameter.PACKAGE.Equals(typePro.Unit)) { value = orderItem.Package; } else if (Parameter.METER.Equals(typePro.Unit)) { ProcessingImage proImage = workingDiagramX; int length = 0, width = 0, package = 0; length = Util.getValueOfLWT2(orderItem.Length); width = Util.getValueOfLWT2(orderItem.Width); package = xialiaoOrderItem.UsePackage; decimal sum = 0; if (proImage.Up) { sum += ((decimal)length) / 1000 * package; } if (proImage.Down) { sum += ((decimal)length) / 1000 * package; } if (proImage.Left) { sum += ((decimal)width) / 1000 * package; } if (proImage.Right) { sum += ((decimal)width) / 1000 * package; } value = decimal.Round(sum, Parameter.NUMBER_MANTISSA); } else { MessageBox.Show("不认识的加工类型", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(value); }
public void insertIntoStats(TypeOfProcess typeOfProcess, string thickness, decimal number) { Console.WriteLine("insertIntoStats number:[" + number + "]"); bool found = false; foreach (DataGridViewRow row in dataGridViewItemStats.Rows) { if (typeOfProcess.Equals(row.Cells["ColumnProcessingName"].Tag) && thickness.Equals(row.Cells["ColumnThicknessStats"].Value.ToString())) { decimal numberStats = 0; if (Util.isDecimal(row.Cells["ColumnNumberStats"].FormattedValue.ToString())) { numberStats = decimal.Parse(row.Cells["ColumnNumberStats"].FormattedValue.ToString()); } row.Cells["ColumnNumberStats"].Value = numberStats + number; Console.WriteLine("278 of purFrm row.Cells[ColumnNumberStats].Value: [" + row.Cells["ColumnNumberStats"].Value.ToString() + "]"); if (0 == Util.getDecimalValue(row.Cells["ColumnNumberStats"].Value.ToString())) { Console.WriteLine("delete row:[" + typeOfProcess.Name + "]"); dataGridViewItemStats.Rows.Remove(row); return; } found = true; break; } } if (!found) { // row.CreateCells(dataGridViewItemStats); int index = dataGridViewItemStats.Rows.Add(); DataGridViewRow row = dataGridViewItemStats.Rows[index]; row.Cells["ColumnStatsID"].Value = 0; row.Cells["ColumnProcessingName"].Tag = typeOfProcess; row.Cells["ColumnProcessingName"].Value = typeOfProcess.Name.ToString(); row.Cells["ColumnThicknessStats"].Value = thickness; row.Cells["ColumnProcessingDiagram"].Value = null; row.Cells["ColumnUnitStats"].Value = typeOfProcess.Unit.ToString(); row.Cells["ColumnNumberStats"].Value = number.ToString(); row.Cells["ColumnUnitPriceStats"].Value = 0; row.Cells["ColumnCostStats"].Value = 0; // dataGridViewItemStats.Rows.Add(row); } }
public MessageLocal saveOrUpdateTypeOfProcess(TypeOfProcess typeOfProcess) { SqlParameter[] prams = { database.MakeInParam("@id", SqlDbType.Int, 0, typeOfProcess.Id), database.MakeInParam("@name", SqlDbType.NVarChar, 20, typeOfProcess.Name), database.MakeInParam("@unit", SqlDbType.NVarChar, 10, typeOfProcess.Unit), new SqlParameter("@message", SqlDbType.NVarChar, 20), new SqlParameter("rval", SqlDbType.Int, 4) }; prams[prams.Length - 2].Direction = ParameterDirection.Output; prams[prams.Length - 1].Direction = ParameterDirection.ReturnValue; return(baseDao.runProcedure("saveOrUpdate_tb_typeOfProcess", prams, "tb_typeOfProcess")); }
public string EditTypeOfProcess(int id, string processName) { TypeOfProcess tipP = processRepository.get(id); if (tipP.name == processName) { return(""); } if (tipP != null) { tipP.name = processName; this.processRepository.update(tipP); } return(processName); }
private void buttonSure_Click(object sender, EventArgs e) { labelErrStatus.Text = ""; if ("".Equals(textBoxName.Text) || (null == comboBoxUnit.SelectedItem && "".Equals(comboBoxUnit.Text))) { if ("".Equals(textBoxName.Text)) { labelErrStatus.Text += "【加工名称】 "; } if (null == comboBoxUnit.SelectedItem && "".Equals(comboBoxUnit.Text)) { labelErrStatus.Text += "【单位】 "; } labelErrStatus.Text += ",不能为空!"; return; } TypeOfProcess typeOfProcess = new TypeOfProcess(); typeOfProcess.Id = typeOfProcessId; typeOfProcess.Name = textBoxName.Text; if (null != comboBoxUnit.SelectedItem) { typeOfProcess.Unit = comboBoxUnit.SelectedItem.ToString(); } else { if (!"".Equals(comboBoxUnit.Text)) { typeOfProcess.Unit = comboBoxUnit.Text; } } MessageLocal msg = typeOfProcessDao.saveOrUpdateTypeOfProcess(typeOfProcess); if (!msg.IsSucess) { labelErrStatus.Text = msg.Message; return; } this.Close(); }
public void Process(Blue color) { LastProcess = TypeOfProcess.Blue; }
//刷新ColumnNumber[1-3] private void refreshColumnNumberX(object sender, DataGridViewCellEventArgs e, string columnName) { int index = int.Parse(columnName.Substring(columnName.Length - 1, 1)); string name = "ColumnName" + index; string diagram = "ColumnDiagram" + index; string number = "ColumnNumber" + index; decimal value = 0; if (-1 == columnName.IndexOf("ColumnName")) { if (Util.isDecimal(getFormattedValue(e, number))) { value = -decimal.Parse(getFormattedValue(e, number)); } } if (null == dataGridViewItem.Rows[e.RowIndex].Cells[name].Tag || null == dataGridViewItem.Rows[e.RowIndex].Cells[diagram].Tag) { dataGridViewItem.Rows[e.RowIndex].Cells[number].Value = 0; } else { TypeOfProcess typePro = (TypeOfProcess)dataGridViewItem.Rows[e.RowIndex].Cells[name].Tag; if (Parameter.PACKAGE.Equals(typePro.Unit)) { dataGridViewItem.Rows[e.RowIndex].Cells[number].Value = getFormattedValue(e, "ColumnPackage"); } else if (Parameter.METER.Equals(typePro.Unit)) { ProcessingImage proImage = (ProcessingImage)dataGridViewItem.Rows[e.RowIndex].Cells[diagram].Tag; int length = 0, width = 0, package = 0; if (Util.isLengthOrWidth(getFormattedValue(e, "ColumnLength"))) { length = Util.getValueOfLWT2(getFormattedValue(e, "ColumnLength")); } if (Util.isLengthOrWidth(getFormattedValue(e, "ColumnWidth"))) { width = Util.getValueOfLWT2(getFormattedValue(e, "ColumnWidth")); } if (Util.isDigital(getFormattedValue(e, "ColumnPackage"))) { package = int.Parse(getFormattedValue(e, "ColumnPackage")); } decimal sum = 0; if (proImage.Up) { sum += ((decimal)length) / 1000 * package; } if (proImage.Down) { sum += ((decimal)length) / 1000 * package; } if (proImage.Left) { sum += ((decimal)width) / 1000 * package; } if (proImage.Right) { sum += ((decimal)width) / 1000 * package; } dataGridViewItem.Rows[e.RowIndex].Cells[number].Value = decimal.Round(sum, Parameter.NUMBER_MANTISSA); } else { MessageBox.Show("不认识的加工类型", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } value = Util.getDecimalValue(dataGridViewItem.Rows[e.RowIndex].Cells[number].FormattedValue.ToString()) + value; insertIntoStats((TypeOfProcess)dataGridViewItem.Rows[e.RowIndex].Cells[name].Tag, dataGridViewItem.Rows[e.RowIndex].Cells["ColumnThickness"].Value.ToString(), value); } }
public void Process(Red color) { LastProcess = TypeOfProcess.Red; }
public static void Process(Red colorOne, Green colorTwo) { LastProcess = TypeOfProcess.RedAndGreen; }
public static void Process(Green colorOne, Red colorTwo) { LastProcess = TypeOfProcess.GreenAndRed; }
public void Process(Blue colorOne, Green colorTwo) { LastProcess = TypeOfProcess.BlueAndGreen; }
public static void Process(Red colorOne, Red colorTwo) { LastProcess = TypeOfProcess.RedAndRed; }
public void Process(Green colorOne, Blue colorTwo) { LastProcess = TypeOfProcess.GreenAndBlue; }
public void add(TypeOfProcess typeOfProcess) { context.TypeOfProcesses.Add(typeOfProcess); context.SaveChanges(); }
public void Process(Green colorOne, Red colorTwo) { LastProcess = TypeOfProcess.GreenAndRed; }
public void Process(Blue colorOne, Blue colorTwo) { LastProcess = TypeOfProcess.BlueAndBlue; }
public void Process(Red colorOne, Blue colorTwo) { LastProcess = TypeOfProcess.RedAndBlue; }
public void Process(Green color) { LastProcess = TypeOfProcess.Green; }
public void Process(Red colorOne, Red colorTwo) { LastProcess = TypeOfProcess.RedAndRed; }
public void Process(Blue colorOne, Red colorTwo) { LastProcess = TypeOfProcess.BlueAndRed; }
public void Process(Green colorOne, Green colorTwo) { LastProcess = TypeOfProcess.GreenAndGreen; }
public void Process(Red colorOne, Green colorTwo) { LastProcess = TypeOfProcess.RedAndGreen; }