public JsonResult InsertSalary(IndexSalariesListVM obj)
        {
            var    result  = (dynamic)null;
            string message = (dynamic)null;

            try
            {
                if (obj.Salaries != null)
                {
                    var Salaries = new InsertSalary_Salaries()
                    {
                        StaffId      = obj.Salaries.StaffId,
                        Date         = obj.Salaries.Date,
                        TermNo       = obj.Salaries.TermNo,
                        SalaryTypeId = obj.Salaries.SalaryTypeId,
                        Amount       = obj.Salaries.Amount,
                        Remark       = obj.Salaries.Remark
                    };
                    var model = new InsertSalary()
                    {
                        Salaries = Salaries
                    };
                    message = _SalariesServ.InsertSalary(model);
                    result  = Json(new { success = true, Message = message });
                }
            }
            catch (Exception ex)
            {
                result = Json(new { success = false, Message = "ERROR101:Salaries/InsertSalary - " + ex.Message });
            }
            return(result);
        }
        public string InsertSalary(InsertSalary obj)
        {
            string returnResult = (dynamic)null;

            try
            {
                if (obj != null)
                {
                    //[Note: insert 'states' table]
                    if (obj.Salaries != null)
                    {
                        var getSalaries = _SalariesRepo.GetAll().ToList();
                        var isExists    = (from s in getSalaries
                                           where s.StaffId == obj.Salaries.StaffId && s.TermNo == obj.Salaries.TermNo && s.SalaryTypeId == obj.Salaries.SalaryTypeId && s.Date.Year == DateTime.Now.Year
                                           select s).SingleOrDefault();
                        if (isExists != null)
                        {
                            isExists.Date   = obj.Salaries.Date;
                            isExists.Amount = obj.Salaries.Amount;
                            isExists.Remark = obj.Salaries.Remark;
                            _SalariesRepo.Update(isExists);
                        }
                        else
                        {
                            var Salaries = new InsertSalary_Salaries()
                            {
                                StaffId      = obj.Salaries.StaffId,
                                Date         = obj.Salaries.Date,
                                Amount       = obj.Salaries.Amount,
                                TermNo       = obj.Salaries.TermNo,
                                SalaryTypeId = obj.Salaries.SalaryTypeId,
                                Remark       = obj.Salaries.Remark
                            };
                            _SalariesRepo.Insert(Salaries);
                        }
                        returnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                returnResult = "ERROR102:ClassesServ/InsertClassessList - " + ex.Message;
            }
            return(returnResult);
        }