예제 #1
0
        private void onSaveToDatabase(object sender, EventArgs e)
        {
            try
            {
                FormSetItemName form = new FormSetItemName()
                {
                    ItemName = BoxName
                };
                if (DialogResult.OK == form.ShowDialog())
                {
                    PLMPackServiceClient client = WCFClientSingleton.Instance.Client;

                    // colors
                    int[] colors = new int[6];
                    for (int i = 0; i < 6; ++i)
                    {
                        colors[i] = _faceColors[i].ToArgb();
                    }

                    client.CreateNewCase(new DCSBCase()
                    {
                        Name            = form.ItemName,
                        Description     = Description,
                        UnitSystem      = (int)UnitsManager.CurrentUnitSystem,
                        IsCase          = (_mode == Mode.MODE_CASE),
                        DimensionsOuter = new DCSBDim3D()
                        {
                            M0 = uCtrlDimensionsOuter.ValueX, M1 = uCtrlDimensionsOuter.ValueY, M2 = uCtrlDimensionsOuter.ValueZ
                        },
                        HasInnerDims    = HasInsideDimensions,
                        DimensionsInner = new DCSBDim3D()
                        {
                            M0 = uCtrlDimensionsInner.X, M1 = uCtrlDimensionsInner.Y, M2 = uCtrlDimensionsInner.Z
                        },
                        ShowTape   = TapeWidth.Activated,
                        TapeWidth  = TapeWidth.Value,
                        TapeColor  = TapeColor.ToArgb(),
                        Weight     = Weight,
                        NetWeight  = this.NetWeight.Activated ? this.NetWeight.Value : new Nullable <double>(),
                        Colors     = colors,
                        AutoInsert = false
                    }
                                         );
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }