public clsAccident(int? id)
 {
     Repositories_Accidents AccRep = new Repositories_Accidents();
      Accident = AccRep.Get_tblAccident((id == null) ? 0 : id.Value);
      if (Accident == null) {
     Accident = new tblAccident {
        ID = 0,
        //Accident.AccountID=
        DriverID = 1,
        No = 0,
        Date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0),
        IsNotOurFault = false,
        IsOtherParticipants = false,
        ShortNote = "",
        LocationCountry = "",
        LocationAddress = "",
        LocationDistrict = "",
        Lat = 0,
        Lng = 0,
        GMT = 0
     };
     NewRec = 1;
      }
      else { NewRec = 0; }
      var s = AccRep.Get_tblAccident_Types();
      //AccTypes = s.ToSelectListItem(1, i => i.ID, i => i.Name, i => i.ID.ToString());
 }
 public JsonResult AccidentsList()
 {
     Repositories_Accidents acc = new Repositories_Accidents();
      return Json(new {
     proc_Accidents = acc.GetJSON_proc_Accidents(),
      });
 }
Exemple #3
0
 public JsonResult tabAccidents()
 {
     Repositories_Accidents acc = new Repositories_Accidents();
      return Json(new {
     proc_Accidents = acc.GetJSON_proc_Accidents(),
     tblAccidents = acc.GetJSON_tblAccidents(),
     proc_Drivers = acc.GetJSON_proc_Drivers(false),
     tblAccidentsTypes = acc.GetJSON_tblAccidentTypes(),
     tblClaimTypes = acc.GetJSON_tblClaimTypes(),
     proc_Vehicles = acc.GetJSON_proc_Vehicles(false),
     proc_InsPolicies = acc.GetJSON_proc_InsPolicies(false),
     tblInsurers = acc.GetJSON_tblInsurers(),
     tblVehicleMakes = acc.GetJSON_tblVehicleMakes(),
     tblClaims = acc.GetJSON_tblClaims()
      });
 }
 public JsonResult GetAccident(int? AccidentNo)
 {
     Repositories_Accidents AccRep = new Repositories_Accidents();
      string View = ""; int AccNo = (AccidentNo.HasValue) ? AccidentNo.Value : 0;
      clsAccident a = new clsAccident(AccNo);
      View = RenderPartialViewToString("Card", a);
      //if (AccidentNo == 0) { }//new { NewRec = NewRec }
      //else {
      //   View = RenderPartialViewToString("Card", a);
      //}
      return Json(new {
     //Render - pirmas, ExecFn - paskutinis
     Render = new { tabAccidents = View },
     tblAccidentsTypes = AccRep.GetJSON_tblAccidentTypes(),
     proc_Drivers = AccRep.GetJSON_proc_Drivers(false),
     ExecFn = new { tabAccidents = "tabs" }
      });
 }
        public JsonResult GetListItem(int? id, string tbl, bool GetAll)
        {
            /// <summary>
             /// Siuncia Json objektus kiekvienam lenteles list itemsui.
             /// <para>Tusti objektai ("") ignoruojami<see cref="System.Console.WriteLine(System.String)"/></para>
             /// <para>Render = new { div = View } - renderina View i #div ir jei ten yra div.inputForm pravaro ją per js UpdatableForm metoda,
             ///  taip prideda controlsus pagal markupa arba jsona kuris nurodomas tam div.inputForm kaip Source</para>
             /// <para>ExecFn = new { tabAccidents = "tabs" } - pravaro jQuery pluginus ant kontrolsu</para>
             /// </summary>

             Repositories_Lists ListRep = new Repositories_Lists();
             string View = ""; object obj;
             if (tbl == "tblDrivers") {
            clsDriver d = new clsDriver(id);
            View = RenderPartialViewToString(tbl, d);//"tblDriver"
             }
             else if (tbl == "tblVehicles") {
            clsVehicle d = new clsVehicle(id);
            View = RenderPartialViewToString(tbl, d);//"tblVehicles"
             }
             else if (tbl == "tblInsPolicies") {
            clsInsPolicy d = new clsInsPolicy(id);
            View = RenderPartialViewToString(tbl, d);//"tblInsPolicies"
             }

             if (GetAll) {
            Repositories_Accidents AccRep = new Repositories_Accidents();
            obj = new {
               //tbl pirmi, Render - antras, ExecFn - paskutinis
               ItemData = ListRep.Get_ItemData(tbl, (id.HasValue) ? id.Value : 0),
               tblDocs = ListRep.GetJSON_tblDocs(),
               tblDocType = ListRep.GetJSON_tblDocType(),
               tblDocGroup = ListRep.GetJSON_tblDocGroup(),
               tblVehicleTypes = AccRep.GetJSON_tblVehicleTypes(),
               tblVehicleMakes = AccRep.GetJSON_tblVehicleMakes(),
               tblInsurers = AccRep.GetJSON_tblInsurers(),
               Render = new { divEditableForm = View }//,
               //ExecFn = new { tabAccidents = "tabs" }
            };
             }
             else { obj = new { Render = new { divEditableForm = View } }; }
             return Json(obj);
        }