Ejemplo n.º 1
0
        public void Processor_TwoColorValues_ShouldPass(TypeOfProcess typeCode, IColor colorOne, IColor colorTwo)
        {
            var processor = new ColorsProcessor();
            processor.Process(colorOne, colorTwo);

            Assert.Equal(typeCode, processor.LastProcess);
        }
Ejemplo n.º 2
0
        public void update(TypeOfProcess typeOfProcess)
        {
            var typeP = context.TypeOfProcesses.Attach(typeOfProcess);

            typeP.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        public void Processor_TwoColorValues_ShouldPass(TypeOfProcess typeCode, IColor colorOne, IColor colorTwo)
        {
            var processor = new ColorsProcessor();

            processor.Process(colorOne, colorTwo);

            Assert.Equal(typeCode, processor.LastProcess);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        public void delete(int id)
        {
            TypeOfProcess typeP = context.TypeOfProcesses.Find(id);

            if (typeP != null)
            {
                context.TypeOfProcesses.Remove(typeP);
                context.SaveChanges();
            }
        }
Ejemplo n.º 8
0
        public int CreateTypeOfProcess(string name)
        {
            var typeP = new TypeOfProcess()
            {
                name = name
            };

            this.processRepository.add(typeP);

            return(typeP.id);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        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"));
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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();
        }
Ejemplo n.º 14
0
 public void Process(Blue color)
 {
     LastProcess = TypeOfProcess.Blue;
 }
Ejemplo n.º 15
0
        //刷新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);
            }
        }
Ejemplo n.º 16
0
 public void Process(Red color)
 {
     LastProcess = TypeOfProcess.Red;
 }
Ejemplo n.º 17
0
 public static void Process(Red colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndGreen;
 }
Ejemplo n.º 18
0
 public static void Process(Green colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndRed;
 }
Ejemplo n.º 19
0
 public void Process(Blue colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndGreen;
 }
Ejemplo n.º 20
0
 public static void Process(Red colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndRed;
 }
Ejemplo n.º 21
0
 public void Process(Green colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndBlue;
 }
Ejemplo n.º 22
0
 public void add(TypeOfProcess typeOfProcess)
 {
     context.TypeOfProcesses.Add(typeOfProcess);
     context.SaveChanges();
 }
Ejemplo n.º 23
0
 public void Process(Green colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndRed;
 }
Ejemplo n.º 24
0
 public void Process(Blue colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndBlue;
 }
Ejemplo n.º 25
0
 public void Process(Red colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndBlue;
 }
Ejemplo n.º 26
0
 public void Process(Green color)
 {
     LastProcess = TypeOfProcess.Green;
 }
Ejemplo n.º 27
0
 public void Process(Red color)
 {
     LastProcess = TypeOfProcess.Red;
 }
Ejemplo n.º 28
0
 public void Process(Blue color)
 {
     LastProcess = TypeOfProcess.Blue;
 }
Ejemplo n.º 29
0
 public void Process(Green color)
 {
     LastProcess = TypeOfProcess.Green;
 }
Ejemplo n.º 30
0
 public void Process(Red colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndRed;
 }
Ejemplo n.º 31
0
 public void Process(Red colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndBlue;
 }
Ejemplo n.º 32
0
 public void Process(Blue colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndRed;
 }
Ejemplo n.º 33
0
 public void Process(Blue colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndRed;
 }
Ejemplo n.º 34
0
 public void Process(Green colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndGreen;
 }
Ejemplo n.º 35
0
 public void Process(Blue colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndBlue;
 }
Ejemplo n.º 36
0
 public void Process(Red colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndGreen;
 }
Ejemplo n.º 37
0
 public void Process(Green colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndGreen;
 }
Ejemplo n.º 38
0
 public void Process(Blue colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndGreen;
 }
Ejemplo n.º 39
0
 public void Process(Green colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndBlue;
 }