예제 #1
0
        public ActionResult EditExpType(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DomainModel.BusinessLayer.ExpenseType exptype = new DomainModel.BusinessLayer.ExpenseType();
            var x = exptype.GetExpenseTypeDetails(Convert.ToInt32(id), Convert.ToInt32(UserDetails.Current.SchoolId));

            DomainModel.BusinessLayer.ExpenseType qryExpType = new DomainModel.BusinessLayer.ExpenseType();
            qryExpType.id           = x.id;
            qryExpType.expense_type = x.expense_type;
            qryExpType.isactive     = x.isactive;
            return(View(qryExpType));
        }
예제 #2
0
        public int SaveExpenseType(ExpenseType ExpCat)
        {
            try
            {
                var exptrans = db.sch_expense_type.Where(x => x.id == ExpCat.id && x.idSchool == ExpCat.idSchool).FirstOrDefault();
                exptrans.expense_type    = ExpCat.expense_type;
                exptrans.last_updated_by = ExpCat.last_updated_by;
                exptrans.ts_updated      = DateTime.Now;
                exptrans.isactive        = ExpCat.isactive;
                db.SaveChanges();
                return(exptrans.id);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public int AddExpenseType(ExpenseType Exp)
        {
            try
            {
                DataModel.sch_expense_type ExpCat = new DataModel.sch_expense_type();
                ExpCat.entered_by      = Exp.entered_by;
                ExpCat.expense_type    = Exp.expense_type;
                ExpCat.idSchool        = Exp.idSchool;
                ExpCat.isactive        = Exp.isactive;
                ExpCat.last_updated_by = Exp.last_updated_by;
                ExpCat.ts_entered      = DateTime.Now;
                ExpCat.ts_updated      = DateTime.Now;
                db.sch_expense_type.Add(ExpCat);
                db.SaveChanges();
                return(ExpCat.id);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        //
        //// GET: Finance/ExpenseList
        public ActionResult ExpenseList()
        {
            DomainModel.BusinessLayer.ExpenseType exptype = new DomainModel.BusinessLayer.ExpenseType();

            var x = exptype.GetExpenseType(Convert.ToInt32(UserDetails.Current.SchoolId));

            var query = from exp in x
                        select new DomainModel.BusinessLayer.ExpenseType()
            {
                id              = exp.id,
                idSchool        = exp.idSchool,
                expense_type    = exp.expense_type,
                entered_by      = exp.entered_by,
                isactive        = exp.isactive,
                last_updated_by = exp.last_updated_by,
                ts_entered      = exp.ts_entered,
                ts_updated      = exp.ts_updated
            };



            return(View(query.ToList()));
        }
예제 #5
0
 public ActionResult EditExpType([Bind(Include = "id,expense_type,isactive")] DomainModel.BusinessLayer.ExpenseType Exp)
 {
     try
     {
         if (ModelState.IsValid)
         {
             DomainModel.BusinessLayer.ExpenseType ExpCat = new DomainModel.BusinessLayer.ExpenseType();
             ExpCat.id              = Exp.id;
             ExpCat.expense_type    = Exp.expense_type;
             ExpCat.idSchool        = UserDetails.Current.SchoolId;
             ExpCat.isactive        = Exp.isactive;
             ExpCat.last_updated_by = UserDetails.Current.Iduser;
             ExpCat.ts_entered      = DateTime.Now;
             ExpCat.ts_updated      = DateTime.Now;
             int res = ExpCat.SaveExpenseType(ExpCat);
             return(RedirectToAction("ExpenseList"));
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }