/// <summary>
    /// copy chargeable record into a manager chargeable record
    /// </summary>
    /// <param name="j"></param>
    public void copyToManagerChargeable(ChargeableJob j)
    {
        using (var context = new PetoEntities())
        {
            try
            {
                ManagerChargeable m = new ManagerChargeable();

                m.BillingHours = j.EmpHours;
                m.PayRollHours = j.EmpHours;

                m.BillingAccomodation = j.Accomodations;
                m.PayRollAccomodation = j.Accomodations;

                m.BillingTravelDistance = j.TravelDistance;
                m.PayRollTravelDistance = j.TravelDistance;

                m.TruckDistance = j.TruckDistance;

                m.TimeSheetId = j.TimeSheetId;
                m.ProjectId = j.ProjectId.Value;

                m.Classification = j.Classification;
                m.Activity = j.Activity;
                m.Day = j.Day;

                m.Remarks = j.Remarks;

                context.ManagerChargeables.AddObject(m);
                context.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
 /// <summary>
 /// Create a new ChargeableJob object.
 /// </summary>
 /// <param name="chargeableId">Initial value of the ChargeableId property.</param>
 /// <param name="timeSheetId">Initial value of the TimeSheetId property.</param>
 /// <param name="day">Initial value of the Day property.</param>
 /// <param name="empHours">Initial value of the EmpHours property.</param>
 /// <param name="classification">Initial value of the Classification property.</param>
 /// <param name="activity">Initial value of the Activity property.</param>
 public static ChargeableJob CreateChargeableJob(global::System.Int32 chargeableId, global::System.Int32 timeSheetId, global::System.String day, global::System.Decimal empHours, global::System.String classification, global::System.String activity)
 {
     ChargeableJob chargeableJob = new ChargeableJob();
     chargeableJob.ChargeableId = chargeableId;
     chargeableJob.TimeSheetId = timeSheetId;
     chargeableJob.Day = day;
     chargeableJob.EmpHours = empHours;
     chargeableJob.Classification = classification;
     chargeableJob.Activity = activity;
     return chargeableJob;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ChargeableJobs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToChargeableJobs(ChargeableJob chargeableJob)
 {
     base.AddObject("ChargeableJobs", chargeableJob);
 }
    /// <summary>
    /// create chargeable job in db
    /// </summary>
    /// <param name="j"></param>
    public string createChargeable(string hours, string accom, string distance, string truckDist, string misc, string day, string projectNo, string classification, string activity, int timesheetID, string remarks,
        ref decimal hoursLBL, ref int distLBL, ref int truckLBL, ref decimal expenseLBL)
    {
        using (var context = new PetoEntities())
        {
            try
            {
                if (timesheetID > 0 && hours != "0" && hours != string.Empty || accom != "0" && accom != string.Empty || distance != "0" && distance != string.Empty || misc != "0" && misc != string.Empty || truckDist != "0" && truckDist != string.Empty)
                {
                    ChargeableJob c = new ChargeableJob();

                    if (hours != "0" && hours != string.Empty)
                    {
                        c.EmpHours = Convert.ToDecimal(hours);
                        hoursLBL += c.EmpHours;
                    }
                    if (accom != "0" && accom != string.Empty)
                    {
                        c.Accomodations = Convert.ToDecimal(accom);
                        expenseLBL += Convert.ToDecimal(c.Accomodations);
                    }
                    if (distance != "0" && distance != string.Empty)
                    {
                        c.TravelDistance = Convert.ToInt32(distance);
                        distLBL += Convert.ToInt32(distance);
                    }
                    if (truckDist != "0" && truckDist != string.Empty)
                    {
                        c.TruckDistance = Convert.ToInt32(truckDist);
                        truckLBL += Convert.ToInt32(truckDist);
                    }

                    if (misc != "0" && misc != string.Empty)
                    {
                        c.Misc = Convert.ToDecimal(misc);
                        expenseLBL += Convert.ToDecimal(misc);
                    }
                    if (remarks != string.Empty)
                    {
                        c.Remarks = remarks;
                    }
                    if (c.EmpHours > 0 || c.TravelDistance > 0 || c.Accomodations > 0 || c.Misc > 0 || c.TruckDistance > 0)
                    {
                        c.Day = day;
                        c.ProjectId = idForProjectNo(projectNo);

                        if (classification != "Select")
                        {
                            c.Classification = classification;
                        }

                        c.Activity = activity;
                        c.TimeSheetId = Convert.ToInt32(timesheetID);

                        context.ChargeableJobs.AddObject(c);
                        context.SaveChanges();
                        return "Data was successfully saved";
                    }
                    else
                    {
                        return "Data was not Entered in input fields.";
                    }
                }
                else
                {
                    return "";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
    }