Example #1
0
        public int[] Delete(int[] ids)
        {
            List <int> ibIds = new List <int>();

            foreach (int id in ids)
            {
                Data.Models.IndentBudget IndentBudget = _IndentBudgetRepository.Table.FirstOrDefault(w => w.Id == id);
                _IndentBudgetRepository.Delete(IndentBudget);
            }
            return(ibIds.ToArray());
        }
Example #2
0
        public void Update(Data.Models.IndentBudget IndentBudget)
        {
            Data.Models.IndentBudget existingIB = _IndentBudgetRepository.Table.FirstOrDefault(w => w.Id == IndentBudget.Id);

            if (existingIB != null)
            {
                existingIB.BudgetType    = IndentBudget.BudgetType;
                existingIB.BudgetCode    = IndentBudget.BudgetCode;
                existingIB.Amount        = IndentBudget.Amount;
                existingIB.IsActive      = IndentBudget.IsActive;
                existingIB.FinancialYear = IndentBudget.FinancialYear;

                this._IndentBudgetRepository.Update(existingIB);
            }
        }
Example #3
0
        public JsonResult GetIndentBudgetById(int Id)
        {
            IndentBudgetViewModel model = new IndentBudgetViewModel();

            Data.Models.IndentBudget objIB = this._IndentBudgetServices.GetForId(Id);

            if (objIB != null)
            {
                model.Id            = objIB.Id;
                model.BudgetType    = objIB.BudgetType;
                model.BudgetCode    = objIB.BudgetCode;
                model.Amount        = objIB.Amount;
                model.IsActive      = objIB.IsActive;
                model.FinancialYear = objIB.FinancialYear;
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        //Indent Budget
        public JsonNetResult SaveIndentBudget(IndentBudget IndentBudget)
        {
            var result = new JsonResponse();

            try
            {
                result.Status = JsonResponseStatus.Success;
                IndentBudget IBobj = new Data.Models.IndentBudget();
                if (IndentBudget.Id == 0)

                {
                    if (IndentBudget.BudgetType == null)
                    {
                        result.Status  = JsonResponseStatus.Warning;
                        result.Message = "Please insert budget type.";
                    }
                    else if (IndentBudget.BudgetCode == null)
                    {
                        result.Status  = JsonResponseStatus.Warning;
                        result.Message = "Please insert budget code.";
                    }
                    else if (IndentBudget.Amount == null)
                    {
                        result.Status  = JsonResponseStatus.Warning;
                        result.Message = "Amount must be greater than zero(0).";
                    }
                    else
                    {
                        this._IndentBudgetServices.Add(IndentBudget);
                    }
                }
                else
                {
                    this._IndentBudgetServices.Update(IndentBudget);
                }
            }
            catch (Exception ex)
            {
                result.Status = JsonResponseStatus.Error;
                return(JsonNet(new { Type = "Error", Message = ex.Message + ex.InnerException ?? ex.InnerException.Message }, JsonRequestBehavior.AllowGet));
            }
            return(JsonNet(result, JsonRequestBehavior.AllowGet));
        }
Example #5
0
 public int Add(Data.Models.IndentBudget IndentBudget)
 {
     _IndentBudgetRepository.Insert(IndentBudget);
     return(IndentBudget.Id);
 }