public Operation Delete(AnFAdvance objadvanceEntry)
        {
            Operation objOperation = new Operation { Success = true, Message = "Deleted successfully." };
            _anfAdvancetListRepository.Delete(objadvanceEntry);

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

                objOperation.Success = false;
                objOperation.Message = "Delete not successful.";
            }
            return objOperation;
        }
        //---------------------------Save Advance--------------------
        public ActionResult Save(AnFAdvance advanceEntry)
        {
            int companyId = Convert.ToInt32(Session["companyId"]);
            int userid = Convert.ToInt32(Session["userId"]);
            int financialYearId = Convert.ToInt32(Session["financialYear"]);

            Operation objOperation = new Operation();
            if (ModelState.IsValid)
            {
                if (advanceEntry.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        advanceEntry.SecCompanyId = companyId;
                        advanceEntry.CmnFinancialYearId = financialYearId;
                        advanceEntry.CreatedBy = userid;
                        //advanceEntry.IsPosted = false;

                        advanceEntry.CreatedDate = DateTime.Now.Date;
                        objOperation = _advanceListService.Save(advanceEntry);
                    }
                    else
                    {
                        objOperation.OperationId = -2;
                        objOperation.Success = false;
                    }
                }
                else
                {
                    if ((bool)Session["Edit"])
                    {
                        advanceEntry.SecCompanyId = companyId;
                        advanceEntry.ModifiedBy = userid;
                        advanceEntry.ModifiedDate = DateTime.Now.Date;
                        objOperation = _advanceListService.Update(advanceEntry);
                    }
                    else
                    {
                        objOperation.OperationId = -2;
                        objOperation.Success = false;
                    }
                }
            }
            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
        //public Operation Save(AnFAdvance objAnFAdvance)
        //{
        //    Operation objOperation = new Operation { Success = true };
        //    long Id = _anfAdvancetListRepository.AddEntity(objAnFAdvance);
        //    objOperation.OperationId = Id;
        //    try
        //    {
        //        _UnitOfWork.Commit();
        //    }
        //    catch (Exception ex)
        //    {
        //        objOperation.Success = false;
        //    }
        //    return objOperation;
        //}
        //public Operation Delete(AnFAdvance objAnFAdvance)
        //{
        //    Operation objOperation = new Operation { Success = true, OperationId = objAnFAdvance.Id };
        //    _anfAdvancetListRepository.Delete(objAnFAdvance);
        //    try
        //    {
        //        _UnitOfWork.Commit();
        //    }
        //    catch (Exception)
        //    {
        //        objOperation.Success = false;
        //    }
        //    return objOperation;
        //}
        //public Operation UpdateAnFCostCenter(AnFCostCenter objAnFCostCenter)
        //{
        //    Operation objOperation = new Operation { Success = true, OperationId = objAnFCostCenter.Id };
        //    _AnFCostCenterRepository.Update(objAnFCostCenter);
        //    try
        //    {
        //        _UnitOfWork.Commit();
        //    }
        //    catch (Exception)
        //    {
        //        objOperation.Success = false;
        //    }
        //    return objOperation;
        //}
        public Operation Save(AnFAdvance objadvanceEntry)
        {
            Operation objOperation = new Operation { Success = true, Message = "Saved successfully." };

            int Id = _anfAdvancetListRepository.AddEntity(objadvanceEntry);
            objOperation.OperationId = Id;

            try
            {
                _UnitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
                objOperation.Message = "Save not successful.";
            }
            return objOperation;
        }