示例#1
0
        public bool Set_2(Mapping arg1)
        {
            var result = new Result_1();

            Call(PortMapperConstants.Set_2, PortMapperConstants.PortMapperVersion, arg1, result);
            return(result.Value);
        }
示例#2
0
        private bool TestUpdateItem(int _TestStepNo, BDatabaseAttributeCondition _ConditionExpression = null, bool bUpdateOnlyTwoAttributes = false)
        {
            JObject NewItem = null;

            if (bUpdateOnlyTwoAttributes)
            {
                NewItem = new JObject(
                    new JProperty(Key, "test_1"),
                    new JProperty("Test_Attr_Key_2", 11115.0f),
                    new JProperty("Test_Attr_Key_4",
                                  new JArray(
                                      new JValue(123123123.0f)
                                      )));
            }
            else
            {
                NewItem = new JObject(
                    new JProperty(Key, "test_1"),
                    new JProperty("Test_Attr_Key_1", "Test_Attr_Val_New_1"),
                    new JProperty("Test_Attr_Key_2", 22),
                    new JProperty("Test_Attr_Key_3", 33.0f),
                    new JProperty("Test_Attr_Key_4",
                                  new JArray(
                                      new JValue("Array_Elem_New_1"),
                                      new JValue(22),
                                      new JValue(33.0f)
                                      )));
            }

            //Test update item
            PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestUpdateItem->Log-> Testing UpdateItem...");
            bool bLocalFailure = !SelectedDBService.UpdateItem(
                TableName,
                Key, new BPrimitiveType("test_1"),
                NewItem,
                out JObject Result_1,
                EBReturnItemBehaviour.ReturnAllOld,
                _ConditionExpression,
                (string Message) =>
            {
                Console.WriteLine("Step " + _TestStepNo + "->" + "TestUpdateItem->Error-> " + Message);
                bLocalFailure = true;
            });

            if (bLocalFailure)
            {
                PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestUpdateItem->Error-> UpdateItem failed.");
                return(false);
            }
            PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestUpdateItem->Log-> UpdateItem succeed. Returned: " + Result_1?.ToString());
            return(true);
        }
示例#3
0
        private bool TestPutItem(int _TestStepNo, BDatabaseAttributeCondition _ConditionExpression = null)
        {
            //Test put item
            PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestPutItem->Log-> Testing PutItem...");
            bool bLocalFailure = !SelectedDBService.PutItem(
                TableName,
                Key, new BPrimitiveType("test_1"),
                new JObject(
                    new JProperty(Key, "test_1"),
                    new JProperty("Test_Attr_Key_1", "Test_Attr_Val_1"),
                    new JProperty("Test_Attr_Key_2", 2),
                    new JProperty("Test_Attr_Key_3", 3.0f),
                    new JProperty("Test_Attr_Key_4",
                                  new JArray(
                                      new JValue("Array_Elem_1"),
                                      new JValue(2),
                                      new JValue(3.0f)
                                      ))),
                out JObject Result_1,
                EBReturnItemBehaviour.ReturnAllOld,
                _ConditionExpression,
                (string Message) =>
            {
                Console.WriteLine("Step " + _TestStepNo + "->" + "TestPutItem->Error-> " + Message);
                bLocalFailure = true;
            });

            if (bLocalFailure)
            {
                PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestPutItem->Error-> PutItem failed.");
                return(false);
            }
            PrintAction?.Invoke("Step " + _TestStepNo + "->" + "TestPutItem->Log-> PutItem succeed. Returned: " + Result_1?.ToString());
            return(true);
        }
示例#4
0
        // showResultProfile() !!!!!
        bool showResultProfile() // при щелчке эскиза с профилем ЛЕВОЙ кнопкой мыши
        {
            switch (profile)     // profile определен НЕ в comDef !
            {
                #region  case Profile.Circle

            case Profile.Circle:
                //*****  1
                // TBox_1.Val - свойство, если ноль, то свойство выводит сообщение об ошибке (в окно Result_1)
                if (TBox_1.Val == 0.0)
                {
                    return(false);
                }
                // если ОК
                d_ex               = TBox_1.val;       // миллиметры
                area               = Trig.AreaCircle(d_ex);
                axial_w            = Trig.AxialWCircle(d_ex);
                polar_w            = Trig.PolarWCircle(d_ex);
                Result_1.BackColor = System.Drawing.Color.SpringGreen;
                Result_1.setText("Площадь сечения S = ", area,     // сантиметры^2
                                 "\nМомент сопротивления осевой\nWx = ", axial_w,
                                 "\nМомент сопротивления полярный\nWp = ", polar_w);
                break;      // end of - case Profile.Circle

                #endregion  case Profile.Circle

                #region  case Profile.CircleRing

            case Profile.CircleRing:
                //*****  1
                if (TBox_1.Val == 0.0)
                {
                    return(false);
                }
                //*****  2
                if (TBox_2.Val == 0.0)
                {
                    return(false);
                }
                // если ОК
                d_ex      = TBox_1.val;     // миллиметры
                thickness = TBox_2.val;     // миллиметры
                d_in      = d_ex - 2.0 * thickness;
                if (d_in < 0.0)
                {                                                             // ref TBox_2 - куда ставить курсор
                    warnShow(ref TBox_2, "Толщина стенки больше допустимой"); // "Error !\nH < 2 * S"
                    return(false);
                }                                                             // if (d_in < 0.0)
                // если и тут ОК
                area               = Trig.AreaCircleRing(d_ex, d_in);
                axial_w            = Trig.AxialWCircleRing(d_ex, d_in);
                polar_w            = Trig.PolarWCircleRing(d_ex, d_in);
                Result_1.BackColor = System.Drawing.Color.SpringGreen;
                Result_1.setText("Внутренний диаметр d = ", d_in.Mm, d_in.wtDim,     // т.е. показать d вн. в мм
                                 "\nПлощадь сечения S = ", area,
                                 "\nМомент сопротивления осевой\nWx = ", axial_w,
                                 "\nМомент сопротивления полярный\nWp = ", polar_w);
                break;      // end of - case Profile.CircleRing

                #endregion  case Profile.CircleRing

                #region  case Profile.Rectangle

            case Profile.Rectangle:
                //*****  1
                if (TBox_1.Val == 0.0)
                {
                    return(false);
                }
                //*****  2
                if (TBox_2.Val == 0.0)
                {
                    return(false);
                }
                // если ОК
                b_ex               = TBox_1.val; // Наружная ширина в мм
                h_ex               = TBox_2.val; // Наружная высота в мм
                area               = Trig.AreaRectangle(b_ex, h_ex);
                axial_w            = Trig.AxialWRectangle(b_ex, h_ex);
                polar_w            = Trig.PolarWRectangle(b_ex, h_ex);
                Result_1.BackColor = System.Drawing.Color.SpringGreen;
                Result_1.setText("Площадь сечения S = ", area,
                                 "\nМомент сопротивления осевой\nWx = ", axial_w,
                                 "\nМомент сопротивления полярный\nWp = ", polar_w);
                break;      //end of - case Profile.Rectangle

                #endregion  case Profile.Rectangle

                #region  case Profile.RectangleRing

            case Profile.RectangleRing:
                //*****  1
                if (TBox_1.Val == 0.0)
                {
                    return(false);
                }
                //*****  2
                if (TBox_2.Val == 0.0)
                {
                    return(false);
                }
                //*****  3
                if (TBox_3.Val == 0.0)
                {
                    return(false);
                }
                // если ОК
                b_ex      = TBox_1.val;     // Наружная ширина в мм
                h_ex      = TBox_2.val;     // Наружная высота в мм
                thickness = TBox_3.val;     // Толщина стенки в мм
                b_in      = b_ex - 2.0 * thickness;
                h_in      = h_ex - 2.0 * thickness;
                if ((b_in <= 0.0) || (h_in <= 0.0))
                {
                    warnShow(ref TBox_3, "Толщина стенки больше допустимой"); // "Error !\nH < 2 * S"
                    return(false);
                }                                                             // if ((b_in < 0.0)||(h_in < 0.0))
                //  если и тут ОК
                area    = Trig.AreaRectangleRing(b_ex, h_ex, b_in, h_in);
                axial_w = Trig.AxialWRectangleRing(b_ex, h_ex, b_in, h_in);
                // полярный момент для RectangleRing сосчитать не получается
                Result_1.BackColor = System.Drawing.Color.SpringGreen;
                Result_1.setText("Внутренняя ширина b = ", b_in.Mm, b_in.wtDim,
                                 "\nВнутренняя высота h = ", h_in.Mm, h_in.wtDim,
                                 "\nПлощадь сечения S = ", area,
                                 "\nМомент сопротивления осевой\nWx = ", axial_w,
                                 "\nМомент сопротивления полярный\nWp = ", "no data");
                break;      //end of - case Profile.RectangleRing:

                #endregion  case Profile.RectangleRing
            }   // end of - switch (profile)
            return(true);
        }       // end of - showResultProfile()
示例#5
0
        protected override void DispatchReceivedCall(ReceivedRpcCall call)
        {
            if (call.Version == PortMapperConstants.PortMapperVersion)
            {
                switch (call.Procedure)
                {
                case PortMapperConstants.Ping_2:
                {
                    var args = new Arguments_0();
                    call.RetrieveCall(args);
                    Ping_2(call.Caller);
                    call.Reply(new Result_0());
                    break;
                }

                case PortMapperConstants.Set_2:
                {
                    var args = new Mapping();
                    call.RetrieveCall(args);
                    var result = new Result_1();
                    result.Value = Set_2(call.Caller, args);
                    call.Reply(result);
                    break;
                }

                case PortMapperConstants.Unset_2:
                {
                    var args = new Mapping();
                    call.RetrieveCall(args);
                    var result = new Result_2();
                    result.Value = Unset_2(call.Caller, args);
                    call.Reply(result);
                    break;
                }

                case PortMapperConstants.GetPort_2:
                {
                    var args = new Mapping();
                    call.RetrieveCall(args);
                    var result = new Result_3();
                    result.Value = GetPort_2(call.Caller, args);
                    call.Reply(result);
                    break;
                }

                case PortMapperConstants.Dump_2:
                {
                    var args = new Arguments_4();
                    call.RetrieveCall(args);
                    var result = Dump_2(call.Caller);
                    call.Reply(result);
                    break;
                }

                case PortMapperConstants.Call_2:
                {
                    var args = new CallArguments();
                    call.RetrieveCall(args);
                    var result = Call_2(call.Caller, args);
                    call.Reply(result);
                    break;
                }

                default:
                    call.ProcedureUnavailable();
                    break;
                }
            }
            else
            {
                call.ProgramMismatch();
            }
        }