コード例 #1
0
 public IHttpActionResult UpdateVehicleDailyLogbook(VehicleDailyLogbookModel vehDLB)
 {
     try
     {
         object op = null;
         // calls the procedure proVDLBEntry to insert the vehicle log details
         dbobj.ExecProc(Servo_API.App_Start.DbOperations_LATEST.OprType.Insert, "proVDLBUpdate", ref op, "@VDLB_ID", vehDLB.VDLB_ID, "@vehicle_no", vehDLB.Vehicle_no, "@DOE", vehDLB.DOE, "@Meter_Reading_Pre", vehDLB.Meter_reading_pre, "@Meter_Reading_Cur", vehDLB.Meter_reading_cur, "@vehicle_route", vehDLB.Vehicle_route, "@Fuel_Used", vehDLB.Fuel_Used, "@Fuel_Used_Qty", vehDLB.Fuel_Used_Qty, "@Engine_Oil", vehDLB.EngineOil, "@Engine_pack", vehDLB.Engine_Oil_Pack, "@Engine_Oil_Qty", vehDLB.Engine_Oil_Qty, "@Gear_Oil", vehDLB.Gear_Oil, "@Gear_pack", vehDLB.Gear_Oil_Pack, "@Gear_Oil_Qty", vehDLB.Gear_Oil_Qty, "@Grease", vehDLB.Grease, "@Grease_pack", vehDLB.Grease_Pack, "@Grease_Qty", vehDLB.Grease_Qty,
                        "@Brake_Oil", vehDLB.Brake_Oil, "@Brake_pack", vehDLB.Brake_Oil_Pack, "@Brake_Oil_Qty", vehDLB.Brake_Oil_Qty, "@Coolent", vehDLB.Coolent, "@Coolent_Pack", vehDLB.Coolent_Oil_Pack, "@Coolent_Qty", vehDLB.Coolent_Oil_Qty, "@Trans_Oil", vehDLB.Trans_Oil, "@Trans_pack", vehDLB.Trans_Oil_Pack, "@Trans_Oil_Qty", vehDLB.Trans_Oil_Qty, "@Toll", vehDLB.Toll, "@Police", vehDLB.Police, "@Food", vehDLB.Food, "@Misc", vehDLB.Misc);
         return(Ok(true));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.NotFound, "Vehicle Logbbok ID could not update data"));
     }
 }
コード例 #2
0
        public IHttpActionResult GetDropVehicleID_SelectedData(string VehicleID)
        {
            VehicleDailyLogbookModel vehDLB = new VehicleDailyLogbookModel();

            try
            {
                SqlDataReader SqlDtr  = null;
                SqlDataReader SqlDtr1 = null;
                dbobj.SelectQuery("select v.*,(ve.vehicle_no+' VID '+cast(ve.vehicledetail_id as varchar)) as v_no,ve.vehicle_name,ve.vehicledetail_id from vdlb v,vehicleentry ve where  ve.vehicledetail_id = v.vehicle_no and  vdlb_id =" + VehicleID, ref SqlDtr);
                if (SqlDtr.Read())
                {
                    string emp_name = "";
                    dbobj.SelectQuery("Select emp_name from employee where vehicle_id = " + SqlDtr["vehicledetail_id"].ToString().Trim() + " and designation = 'Driver'", ref SqlDtr1);
                    if (SqlDtr1.HasRows)
                    {
                        if (SqlDtr1.Read())
                        {
                            emp_name = SqlDtr1.GetValue(0).ToString().Trim();
                        }
                    }
                    SqlDtr1.Close();

                    vehDLB.Vehicle_no = SqlDtr["v_no"].ToString().Trim();
                    // DropVehicleNo.SelectedIndex = DropVehicleNo.Items.IndexOf(DropVehicleNo.Items.FindByText(vehicle_no));
                    vehDLB.Vehicle_Name      = SqlDtr["vehicle_name"].ToString().Trim();
                    vehDLB.DOE               = SqlDtr["DOE"].ToString().Trim();
                    vehDLB.DriverName        = emp_name;
                    vehDLB.Meter_reading_pre = SqlDtr["meter_reading_pre"].ToString().Trim();
                    vehDLB.Meter_reading_cur = SqlDtr["meter_reading_cur"].ToString().Trim();
                    dbobj.SelectQuery("Select route_name From route where route_id =" + SqlDtr["vehicle_route"].ToString().Trim(), ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Vehicle_route = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Fuel_Used     = SqlDtr["Fuel_Used"].ToString().Trim();
                    vehDLB.Fuel_Used_Qty = SqlDtr["Fuel_Used_Qty"].ToString().Trim();
                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Engine_Oil"].ToString().Trim() + " and Category like 'Engine Oil%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.EngineOil = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Engine_Oil_Qty = SqlDtr["Engine_Oil_Qty"].ToString().Trim();

                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Gear_Oil"].ToString().Trim() + " and Category like 'Gear Oil%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Gear_Oil = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Gear_Oil_Qty = SqlDtr["Gear_Oil_Qty"].ToString().Trim();

                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Grease"].ToString().Trim() + " and Category like 'Grease%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Grease = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Grease_Qty = SqlDtr["Grease_Qty"].ToString().Trim();

                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Brake_Oil"].ToString().Trim() + " and Category like 'Brake Oil%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Brake_Oil = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Brake_Oil_Qty = SqlDtr["Brake_Oil_Qty"].ToString().Trim();

                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Coolent"].ToString().Trim() + " and Category like 'Collents%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Coolent = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();

                    vehDLB.Coolent_Oil_Qty = SqlDtr["Coolent_Qty"].ToString().Trim();

                    dbobj.SelectQuery("Select prod_name+':'+pack_type from products where prod_id =" + SqlDtr["Trans_Oil"].ToString().Trim() + " and Category like 'Transmission Oil%'", ref SqlDtr1);
                    if (SqlDtr1.Read())
                    {
                        vehDLB.Trans_Oil = SqlDtr1.GetValue(0).ToString().Trim();
                    }
                    SqlDtr1.Close();
                    vehDLB.Trans_Oil_Qty = SqlDtr["Trans_Oil_Qty"].ToString().Trim();

                    vehDLB.Toll   = SqlDtr["Toll"].ToString().Trim();
                    vehDLB.Police = SqlDtr["Police"].ToString().Trim();
                    vehDLB.Food   = SqlDtr["Food"].ToString().Trim();
                    vehDLB.Misc   = SqlDtr["misc"].ToString().Trim();
                }
                SqlDtr.Close();
                if (vehDLB == null)
                {
                    return(Content(HttpStatusCode.NotFound, "Vehicle Logbbok ID Data Not found"));
                }
                return(Ok(vehDLB));
            }
            catch
            {
                return(Content(HttpStatusCode.NotFound, "Vehicle Logbbok ID Data Not found"));
            }
        }