Exemplo n.º 1
0
        public OperationResult InsertVehicleData(InsertVehcielModel model)
        {
            OperationResult or;

            try
            {
                or = new VehicelBl().InsertNewVehicle(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(or);
        }
        public OperationResult UpdateVehicleData(InsertVehcielModel vehciel)
        {
            OperationResult or;

            try
            {
                or = new VehicelBl().UpdateVehicleData(vehciel);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(or);
        }
Exemplo n.º 3
0
        public OperationResult InsertNewVehicle(InsertVehcielModel vehciel)
        {
            var             be = new BusinessException();
            OperationResult or = new OperationResult();

            using (IDbConnection db = new SqlConnection(TransportationConstants.Cn))
            {
                if (db.State == ConnectionState.Closed)
                {
                    db.Open();
                }
                try
                {
                    var result = db.Query <int>("Mob_InsertNewVehcile",
                                                new
                    {
                        VId               = vehciel.VId,
                        UserID            = vehciel.UserID,
                        VehicleCategoryId = vehciel.vCategoryNameId,
                        WeightCapacity    = vehciel.vWeight,
                        VehicleModelId    = vehciel.vModelId,
                        OperationCard     = vehciel.OperationCard,
                        ManufactureYear   = vehciel.manufactureYear,
                        InsuranceNo       = vehciel.insuranceNumber,
                        PlatNumber        = vehciel.platNumber
                    },
                                                commandType: CommandType.StoredProcedure).SingleOrDefault();
                    db.Close();
                    if (result > 0)
                    {
                        or.Result = result;
                    }
                    else
                    {
                        or.Result = 0;
                    }
                    return(or);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }