Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Fnc_Cost_Regular       fnc_Cost_Regular       = db.Fnc_Cost_Regular.Find(id);
            Mstr_Class_Program     mstr_Class_Program     = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == fnc_Cost_Regular.Class_Prog_Id).First();
            Mstr_Entry_Period_Type mstr_Entry_Period_Type = db.Mstr_Entry_Period_Type.Where(ept => ept.Entry_Period_Type_Id == fnc_Cost_Regular.Entry_Period_Type_Id).First();

            db.Fnc_Cost_Regular.Remove(fnc_Cost_Regular);
            db.SaveChanges();
            return(RedirectToAction("Index", new { Class_Prog_Id = mstr_Class_Program.Class_Prog_Id, Term_Year_Id = fnc_Cost_Regular.Term_Year_Id, Department_Id = fnc_Cost_Regular.Department_Id, Entry_Period_Type_Id = mstr_Entry_Period_Type.Entry_Period_Type_Id }));
        }
Exemple #2
0
        public ActionResult Edit([Bind(Include = "Cost_Regular_Id,Term_Year_Id,Department_Id,Class_Prog_Id,Entry_Year_Id,Entry_Period_Type_Id,Cost_Item_Id,Amount,Created_By,Created_Date,Modified_By,Modified_Date")] Fnc_Cost_Regular fnc_Cost_Regular, string SAmount)
        {
            fnc_Cost_Regular.Amount = (int)decimal.Parse(Regex.Replace(SAmount, @"[^\d.]", ""));

            if (ModelState.IsValid)
            {
                db.Entry(fnc_Cost_Regular).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { Class_Prog_Id = fnc_Cost_Regular.Class_Prog_Id, Term_Year_Id = fnc_Cost_Regular.Term_Year_Id, Department_Id = fnc_Cost_Regular.Department_Id, Entry_Period_Type_Id = fnc_Cost_Regular.Entry_Period_Type_Id }));
            }

            return(View(fnc_Cost_Regular));
        }
Exemple #3
0
        // GET: CostRegNonDPP/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Fnc_Cost_Regular fnc_Cost_Regular = db.Fnc_Cost_Regular.Find(id);

            if (fnc_Cost_Regular == null)
            {
                return(HttpNotFound());
            }
            return(View(fnc_Cost_Regular));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "Cost_Regular_Id,Term_Year_Id,Department_Id,Class_Prog_Id,Entry_Year_Id,Entry_Period_Type_Id,Cost_Item_Id,Amount,Created_By,Created_Date,Modified_By,Modified_Date")] Fnc_Cost_Regular fnc_Cost_Regular, string SAmount)
        {
            fnc_Cost_Regular.Amount = (int)decimal.Parse(Regex.Replace(SAmount, @"[^\d.]", ""));

            if (ModelState.IsValid)
            {
                db.Fnc_Cost_Regular.Add(fnc_Cost_Regular);
                db.SaveChanges();
                return(RedirectToAction("Index", new { Class_Prog_Id = fnc_Cost_Regular.Class_Prog_Id, Term_Year_Id = fnc_Cost_Regular.Term_Year_Id, Department_Id = fnc_Cost_Regular.Department_Id, Entry_Period_Type_Id = fnc_Cost_Regular.Entry_Period_Type_Id }));
            }

            ViewBag.Entry_Years       = db.Mstr_Entry_Year.OrderByDescending(ey => ey.Entry_Year_Id).ToList();
            ViewBag.Biayas            = db.Fnc_Cost_Item.ToList();
            ViewBag.Term_Year         = db.Mstr_Term_Year.Where(ty => ty.Term_Year_Id == fnc_Cost_Regular.Term_Year_Id).First();
            ViewBag.Department        = db.Mstr_Department.Where(d => d.Department_Id == fnc_Cost_Regular.Department_Id).First();
            ViewBag.Class_Prog        = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == fnc_Cost_Regular.Class_Prog_Id).First();
            ViewBag.Entry_Period_Type = db.Mstr_Entry_Period_Type.Where(ep => ep.Entry_Period_Type_Id == fnc_Cost_Regular.Entry_Period_Type_Id).First();

            return(View(fnc_Cost_Regular));
        }
Exemple #5
0
        public ActionResult CopyData(short Class_Prog_Id, short Term_Year_Id, short Department_Id, short Entry_Period_Type_Id, short ClassProgId, short TermYearId, short DepartmentId, short EntryPeriodTypeId)
        {
            //Sumber Data untuk diCopy
            var dataSource = db.Fnc_Cost_Regular.Where(cr => cr.Class_Prog_Id == Class_Prog_Id &&
                                                       cr.Term_Year_Id == Term_Year_Id &&
                                                       cr.Department_Id == Department_Id &&
                                                       cr.Entry_Period_Type_Id == Entry_Period_Type_Id).ToList();

            if (dataSource.Count() != 0)
            {
                //Delete Data Lama
                db.Fnc_Cost_Regular.Where(cr => cr.Class_Prog_Id == ClassProgId &&
                                          cr.Term_Year_Id == TermYearId &&
                                          cr.Department_Id == DepartmentId &&
                                          cr.Entry_Period_Type_Id == EntryPeriodTypeId).Delete();
                foreach (var item in dataSource)
                {
                    Fnc_Cost_Regular objNew = new Fnc_Cost_Regular();
                    objNew.Term_Year_Id         = TermYearId;
                    objNew.Department_Id        = DepartmentId;
                    objNew.Class_Prog_Id        = ClassProgId;
                    objNew.Entry_Year_Id        = item.Entry_Year_Id;
                    objNew.Entry_Period_Type_Id = EntryPeriodTypeId;
                    objNew.Cost_Item_Id         = item.Cost_Item_Id;
                    objNew.Amount = item.Amount;

                    //Insert New Data
                    db.Fnc_Cost_Regular.Add(objNew);
                }
                db.SaveChanges();
            }
            else
            {
                TempData["shortMessage"] = "Sumber Data yang Anda pilih untuk diCopy, Kosong!";
                return(RedirectToAction("CopyData", new { Class_Prog_Id = ClassProgId, Term_Year_Id = TermYearId, Department_Id = DepartmentId, Entry_Period_Type_Id = EntryPeriodTypeId }));
            }

            return(RedirectToAction("Index", new { Class_Prog_Id = ClassProgId, Term_Year_Id = TermYearId, Department_Id = DepartmentId, Entry_Period_Type_Id = EntryPeriodTypeId }));
        }