Example #1
0
        //Geta all records function
        public JsonResult GetAllOrientation()
        {
            var db   = new qhsedbEntities();
            var data = db.orientation_tr_mat.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        //Geta all records function
        public JsonResult GetAllReturnPlan()
        {
            var db   = new qhsedbEntities();
            var data = db.return_to_work_plan.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        //Geta all records function
        public JsonResult GetAllEarlySafe()
        {
            var db   = new qhsedbEntities();
            var data = db.early_safe_return_wp.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public JsonResult Edit(tool_box_topic ToolBoxObj)
        {
            try
            {
                ToolBoxObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    ToolBoxObj.id = ToolBoxObj.id;
                    db.Entry(ToolBoxObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited ToolBox System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #5
0
        //Get records for reporting purposes
        public JsonResult GetJourneyMgmtByQueryReport(string id, string fromDate, string toDate)
        {
            try
            {
                var db   = new qhsedbEntities();
                var data = (from
                            p in db.journey_mgmt
                            .OrderBy(c => c.date_of_entry)
                            //join c in db.tblCustomers on p.EntityNum equals c.AccountNo



                            select new JourneyMgmt()
                {
                    id = p.id,
                    driver_name = p.driver_name,
                    journey_status = p.journey_status,
                    vehicle_id = p.vehicle_id,
                    start_location = p.start_location,
                    destination = p.destination,
                    start_dt = p.start_dt,
                    arrival_dt = p.arrival_dt,
                    total_distance = p.total_distance,
                    total_travel_time = p.total_travel_time,
                    rest_time = p.rest_time,
                    supervisor_start = p.supervisor_start,
                    supervisor_phone_start = p.supervisor_phone_start,
                    supervisor_arrival = p.supervisor_arrival,
                    supervisor_phone_arrival = p.supervisor_phone_arrival,
                    flight_route = p.flight_route,
                    attach_map = p.attach_map,
                    attach_directions = p.attach_directions,
                    attach_other = p.attach_other,
                    userID = p.userID,
                }
                            );
                if (!String.IsNullOrEmpty(fromDate) && !String.IsNullOrEmpty(toDate))
                {
                    DateTime fromdate = Convert.ToDateTime(fromDate);
                    DateTime todate   = Convert.ToDateTime(toDate);
                    data = data.Where(p => (p.date_of_entry > fromdate && p.date_of_entry < todate));
                }
                else
                {
                    data = data.Where(p => (p.date_of_entry < DateTime.Now));
                }

                var dataResult = data.ToList();

                dataResult.ForEach(m =>
                {
                    m.journeyMgmtDateStr = Convert.ToString(Convert.ToDateTime(m.date_of_entry).Month + "/" + Convert.ToDateTime(m.date_of_entry).Day + "/" + Convert.ToDateTime(m.date_of_entry).Year);
                });
                return(Json(dataResult, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #6
0
        //Geta all records function
        public JsonResult GetAllOhsComm()
        {
            var db   = new qhsedbEntities();
            var data = db.ohs_committee.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public JsonResult Edit(company_information CompanyInfoObj)
        {
            try
            {
                CompanyInfoObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    CompanyInfoObj.id = CompanyInfoObj.id;
                    db.Entry(CompanyInfoObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited CompanyInfo System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #8
0
        //Geta all records function
        public JsonResult GetAllOccupationHist()
        {
            var db   = new qhsedbEntities();
            var data = db.occupational_history_form.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        public JsonResult Edit(occupational_history_form OccupationHistObj)
        {
            try
            {
                OccupationHistObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    OccupationHistObj.id = OccupationHistObj.id;
                    db.Entry(OccupationHistObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited OccupationHist System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #10
0
        //Geta all records function
        public JsonResult GetAllGenSafety()
        {
            var db   = new qhsedbEntities();
            var data = db.general_safety_meetings.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #11
0
        //Get records for reporting purposes
        public JsonResult GetGenSafetyByQueryReport(string id, string fromDate, string toDate)
        {
            try
            {
                var db   = new qhsedbEntities();
                var data = (from
                            p in db.general_safety_meetings
                            .OrderBy(c => c.dt_of_meeting)
                            //join c in db.tblCustomers on p.EntityNum equals c.AccountNo



                            select new GenSafety()
                {
                    id = p.id,
                    dt_of_meeting = p.dt_of_meeting,
                    project_name = p.project_name,
                    work_area = p.work_area,
                    other_dept = p.other_dept,
                    shift = p.shift,
                    no_in_crew = p.no_in_crew,
                    no_attending = p.no_attending,
                    topic_disc = p.topic_disc,
                    employee_con_sug = p.employee_con_sug,
                    OHS_con_sug = p.OHS_con_sug,
                    attended_by = p.attended_by,
                    managers_remarks = p.managers_remarks,
                    presenter = p.presenter,
                    supervisor = p.supervisor,
                    manager = p.manager,
                    attachment_1 = p.attachment_1,
                    attachment_2 = p.attachment_2,
                    attachment_3 = p.attachment_3,
                    userID = p.userID,
                }
                            );
                if (!String.IsNullOrEmpty(fromDate) && !String.IsNullOrEmpty(toDate))
                {
                    DateTime fromdate = Convert.ToDateTime(fromDate);
                    DateTime todate   = Convert.ToDateTime(toDate);
                    data = data.Where(p => (p.dt_of_meeting > fromdate && p.dt_of_meeting < todate));
                }
                else
                {
                    data = data.Where(p => (p.dt_of_meeting < DateTime.Now));
                }

                var dataResult = data.ToList();

                dataResult.ForEach(m =>
                {
                    m.genSafetyDateStr = Convert.ToString(Convert.ToDateTime(m.dt_of_meeting).Month + "/" + Convert.ToDateTime(m.dt_of_meeting).Day + "/" + Convert.ToDateTime(m.dt_of_meeting).Year);
                });
                return(Json(dataResult, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
        //Geta all records function
        public JsonResult GetAllMonthlySafety()
        {
            var db   = new qhsedbEntities();
            var data = db.monthly_safety_summary.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #13
0
        //Geta all records function
        public JsonResult GetAllSafeProc()
        {
            var db   = new qhsedbEntities();
            var data = db.safe_work_procedure.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #14
0
        //Geta all records function
        public JsonResult GetAllHarzardNm()
        {
            var db   = new qhsedbEntities();
            var data = db.hazard_nm_fin_rep.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #15
0
        public JsonResult Edit(audit_guildlines audit_guildlines)
        {
            try
            {
                audit_guildlines.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    audit_guildlines.audit_guildlines_id = audit_guildlines.audit_guildlines_id;
                    db.Entry(audit_guildlines).State     = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited Audit System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #16
0
        //Geta all records function
        public JsonResult GetAllProbSolv()
        {
            var db   = new qhsedbEntities();
            var data = db.prob_solv_meet_rep.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #17
0
        //Geta all records function
        public JsonResult GetAllMeetingPlan()
        {
            var db   = new qhsedbEntities();
            var data = db.meeting_planning_work.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #18
0
        public JsonResult Edit(prob_solv_meet_rep ProbSolvObj)
        {
            try
            {
                ProbSolvObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    ProbSolvObj.id = ProbSolvObj.id;
                    db.Entry(ProbSolvObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited ProbSolv System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #19
0
        //Geta all records function
        public JsonResult GetAllCompanyInfo()
        {
            var db   = new qhsedbEntities();
            var data = db.company_information.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #20
0
        //Geta all records function
        public JsonResult GetAllWitnessStmt()
        {
            var db   = new qhsedbEntities();
            var data = db.witness_statement.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #21
0
        //Geta all records function
        public JsonResult GetAllToolBox()
        {
            var db   = new qhsedbEntities();
            var data = db.tool_box_topic.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #22
0
        public JsonResult Edit(witness_statement WitnessStmtObj)
        {
            try
            {
                WitnessStmtObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    WitnessStmtObj.id = WitnessStmtObj.id;
                    db.Entry(WitnessStmtObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited WitnessStmt System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #23
0
        //Geta all records function
        public JsonResult GetAllJourneyMgmt()
        {
            var db   = new qhsedbEntities();
            var data = db.journey_mgmt.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #24
0
        //Geta all records function
        public JsonResult GetAllMgmtRev()
        {
            var db   = new qhsedbEntities();
            var data = db.mgmt_rev_agenda.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #25
0
        //Geta all records function
        public JsonResult GetAllTrainAware()
        {
            var db   = new qhsedbEntities();
            var data = db.train_aware_comp.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #26
0
        public JsonResult Edit(mgmt_rev_agenda MgmtRevObj)
        {
            try
            {
                MgmtRevObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    MgmtRevObj.id = MgmtRevObj.id;
                    db.Entry(MgmtRevObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited MgmtRev System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
Example #27
0
        public JsonResult Edit(return_to_work_plan ReturnPlanObj)
        {
            try
            {
                ReturnPlanObj.date_of_entry = DateTime.Now;

                var db = new qhsedbEntities();
                if (ModelState.IsValid)
                {
                    ReturnPlanObj.id = ReturnPlanObj.id;
                    db.Entry(ReturnPlanObj).State = EntityState.Modified;

                    // loanRequest.LoanDate = loanRequest.LoanDate;
                    db.SaveChanges();
                }



                return(Json("Edited ReturnPlan System", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
        //Geta all records function
        public JsonResult GetAllQualification()
        {
            var db   = new qhsedbEntities();
            var data = db.qualifications.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #29
0
        //Geta all records function
        public JsonResult GetAllWorkerStat()
        {
            var db   = new qhsedbEntities();
            var data = db.worker_comp_insurace_reports_stats.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #30
0
        //Geta all records function
        public JsonResult GetAllEmergRescue()
        {
            var db   = new qhsedbEntities();
            var data = db.emerg_rescue_plan.ToList();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }