public ActionResult SaveMeasurementUnit(AnFMeasurementUnit anFMeasurementUnit)
        {
            Operation objOperation = new Operation { Success = false };
            int companyId = Convert.ToInt32(Session["companyId"]);
            if (ModelState.IsValid)
            {
                anFMeasurementUnit.CmnCompanyId = companyId;
                if (anFMeasurementUnit.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        objOperation = _pmService.SaveAnFMeasurementUnit(anFMeasurementUnit);
                    }
                    else { objOperation.OperationId = -1; }
                }
                else
                {
                    if ((bool)Session["Edit"])
                    {
                        objOperation = _pmService.UpdateAnFMeasurementUnit(anFMeasurementUnit);
                    }
                    else { objOperation.OperationId = -2; }
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
        public Operation DeleteAnFMeasurementUnit(AnFMeasurementUnit objAnFMeasurementUnit)
        {
            Operation objOperation = new Operation { Success = true, OperationId = objAnFMeasurementUnit.Id };
            _AnFMeasurementUnitRepository.Delete(objAnFMeasurementUnit);

            try
            {
                _UnitOfWork.Commit();
            }
            catch (Exception)
            {

                objOperation.Success = false;
            }
            return objOperation;
        }
        public Operation SaveAnFMeasurementUnit(AnFMeasurementUnit objAnFMeasurementUnit)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _AnFMeasurementUnitRepository.AddEntity(objAnFMeasurementUnit);
            objOperation.OperationId = Id;

            try
            {
                _UnitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }