public ActionResult _FacilityMaintainPlanNew(FacilityMaintainPlan facilityMaintainPlan,MaintainPlan maintainPlan)
        {
            if (ModelState.IsValid)
            {
                if (this.genericMgr.FindAll<long>(facilityMaintainPlanDuiplicateVerifyStatement, new object[] { facilityMaintainPlan.FCID, maintainPlan.Code })[0] > 0)
                {
                    SaveErrorMessage(Resources.SYS.ErrorMessage.Errors_Existing_Code, facilityMaintainPlan.MaintainPlan.Code);
                }
               
                else
                {
                    facilityMaintainPlan.MaintainPlan = maintainPlan;
                    if (facilityMaintainPlan.StartQty != 0)
                    {
                        facilityMaintainPlan.NextMaintainQty = facilityMaintainPlan.StartQty;
                        facilityMaintainPlan.NextWarnQty = facilityMaintainPlan.StartQty;
                        facilityMaintainPlan.NextWarnDate = null;
                        facilityMaintainPlan.NextMaintainDate = null;
                        facilityMaintainPlan.StartDate = null;
                    }
                    if (facilityMaintainPlan.StartDate.HasValue)
                    {
                        facilityMaintainPlan.NextMaintainDate = facilityMaintainPlan.StartDate;
                        facilityMaintainPlan.NextWarnDate = facilityMaintainPlan.StartDate;
                    }
               
              
                    this.genericMgr.CreateWithTrim(facilityMaintainPlan);

                    SaveSuccessMessage(Resources.FMS.FacilityMaintainPlan.FacilityMaintainPlan_Added);
                    return RedirectToAction("_FacilityMaintainPlanEdit/" + facilityMaintainPlan.Id);
                }
            }

            return PartialView(facilityMaintainPlan);
        }
        public ActionResult _FacilityMaintainPlanEdit(FacilityMaintainPlan facilityMaintainPlan, MaintainPlan maintainPlan)
        {
            if (ModelState.IsValid)
            {
                facilityMaintainPlan.MaintainPlan = maintainPlan;
                if (facilityMaintainPlan.StartQty != 0)
                {
                    facilityMaintainPlan.NextMaintainQty = facilityMaintainPlan.StartQty;
                    facilityMaintainPlan.NextWarnQty = facilityMaintainPlan.StartQty;
                    facilityMaintainPlan.NextWarnDate = null;
                    facilityMaintainPlan.NextMaintainDate = null;
                    facilityMaintainPlan.StartDate = null;
                }
                if (facilityMaintainPlan.StartDate.HasValue)
                {
                    facilityMaintainPlan.NextMaintainDate = facilityMaintainPlan.StartDate;
                    facilityMaintainPlan.NextWarnDate = facilityMaintainPlan.StartDate;
                }
               
              
              
             
                this.genericMgr.UpdateWithTrim(facilityMaintainPlan);

                SaveSuccessMessage(Resources.FMS.FacilityMaintainPlan.FacilityMaintainPlan_Added);
              
            }
            TempData["TabIndex"] = 1;
            return PartialView(facilityMaintainPlan);
        }
 public ActionResult _FacilityMaintainPlanNew(string FCID)
 {
     FacilityMaintainPlan facilityMaintainPlan = new FacilityMaintainPlan();
     facilityMaintainPlan.FCID = FCID;
     return PartialView(facilityMaintainPlan);
 }