Beispiel #1
0
 public Vehicle(RigidBody2D mainBody, List <ConstraintWheel2D> wheelConstraints, VehicleModel vehicleType, VehicleLoad vehicleLoad)
 {
     MainBody            = mainBody;
     WheelConstraints    = wheelConstraints;
     SelectedVehicle     = vehicleType;
     SelectedVehicleLoad = vehicleLoad;
 }
        private void Delete()
        {
            string sId = Request.Form["id"];

            if (string.IsNullOrEmpty(sId))
            {
                DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                {
                    Data      = null,
                    ErrorCode = -1,
                    Message   = "Dữ liệu không hợp lệ!",
                }));

                return;
            }

            using (DALTools dalTools = new DALTools())
            {
                int         id  = int.Parse(sId);
                VehicleLoad obj = dalTools.VehicleLoad_Get(id);
                if (obj == null)
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = -1,
                        Message   = "Không tìm thấy Tải trọng xe!",
                    }));

                    return;
                }

                obj.UpdatedBy = CurrentSys_User.ID;
                if (!dalTools.VehicleLoad_Delete(obj))
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = 1,
                        Message   = "Xóa thất bại, vui lòng kiểm tra lại dữ liệu!",
                    }));
                }
                else
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = 0,
                        Message   = "Xóa thành công! Đang chuyển ...",
                    }));
                }
            }
        }
Beispiel #3
0
 public Vehicle InitCarInScene(VehicleLoad vehicleLoad)
 {
     return(new Vehicle(_mainBody, _wheelsConstraints, _vehicleModel, vehicleLoad));
 }
        private void Create()
        {
            string postdata = Request.Form["data"];

            if (postdata == string.Empty)
            {
                DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                {
                    Data      = null,
                    ErrorCode = -1,
                    Message   = "Dữ liệu không hợp lệ!",
                }));

                return;
            }

            dynamic data;

            try { data = JsonConvert.DeserializeObject(postdata); }
            catch { data = null; }

            if (data == null)
            {
                DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                {
                    Data      = null,
                    ErrorCode = -2,
                    Message   = "Dữ liệu không hợp lệ!",
                }));

                return;
            }

            using (DALTools dalTools = new DALTools())
            {
                int check = dalTools.VehicleLoad_CheckCode(data.code.ToString());
                if (check != 0)
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = 2,
                        Message   = "Code đã tồn tại!",
                    }));

                    return;
                }

                VehicleLoad obj = new VehicleLoad()
                {
                    Code           = data.code.ToString(),
                    Description    = data.description.ToString(),
                    Name           = data.name.ToString(),
                    IsDeleted      = false,
                    UpdatedBy      = CurrentSys_User.ID,
                    LastestUpdated = DateTime.Now,
                    VehicleTypeID  = int.Parse(data.vehicletypeid.ToString()),
                    FullLoad       = double.Parse(data.fullload.ToString()),
                };

                int result = dalTools.VehicleLoad_Create(obj);
                if (result != 0)
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = result,
                        Message   = "Thêm mới thất bại, vui lòng kiểm tra lại dữ liệu!",
                    }));
                }
                else
                {
                    DoResponse(JsonConvert.SerializeObject(new GlobalValues.ResponseData()
                    {
                        Data      = null,
                        ErrorCode = 0,
                        Message   = "Thêm mới thành công! Đang chuyển...",
                    }));
                }
            }
        }
Beispiel #5
0
        public void MovingLoad_Initialize(vdDocument vDoc, string file_name)
        {
            //InitializeComponent();
            if (doc != null)
            {
                AST_DOC_ORG.Members.DrawMember(doc);
            }
            if (MainDoc != null)
            {
                AST_DOC_ORG.Members.DrawMember(MainDoc);
            }

            doc = vDoc;

            //AST_DOC_ORG.Members.DrawMember(MainDoc);
            //AST_DOC_ORG.Joints.DrawJointsText(MainDoc, 0.1);


            string load_file = Path.Combine(Path.GetDirectoryName(file_name), "LL.fil");

            if (!File.Exists(load_file))
            {
                load_file = Path.Combine(Path.GetDirectoryName(file_name), "LL.txt");
            }

            if (File.Exists(load_file))
            {
                load_data = MLoadData.GetLiveLoads(load_file);
            }
            else
            {
                MessageBox.Show(this, load_file + " not found.");
                return;
            }

            VehicleLoad vl1 = null;

            for (int i = 0; i < AST_DOC_ORG.Load_Geneartion.Count; i++)
            {
                for (int j = 0; j < load_data.Count; j++)
                {
                    if (AST_DOC_ORG.Load_Geneartion[i].TypeNo == load_data[j].TypeNo)
                    {
                        try
                        {
                            //vl1 = new VehicleLoad(doc, MainDoc, load_data[j].Distances.Text);
                            vl1             = new VehicleLoad(MainDoc, MainDoc, load_data[j]);
                            vl1.TotalLength = AST_DOC_ORG.AnalysisData.Length;
                            vl1.XINC        = AST_DOC_ORG.Load_Geneartion[i].XINC;
                            vl1.X           = AST_DOC_ORG.Load_Geneartion[i].X;
                            vl1.Y           = AST_DOC_ORG.Load_Geneartion[i].Y;
                            vl1.Z           = AST_DOC_ORG.Load_Geneartion[i].Z;
                            if (list_vehicle == null)
                            {
                                list_vehicle = new List <VehicleLoad>();
                            }
                            list_vehicle.Add(vl1);
                        }
                        catch (Exception ex) { }
                    }
                }
            }

            VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(MainDoc);
            //VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VFront(MainDoc);
        }