Ejemplo n.º 1
0
        public ActionResult DeleteFund(int PrimaryID)
        {
            Tbl_FMFund_Fund      fund    = (from a in BOSSDB.Tbl_FMFund_Fund where a.FundID == PrimaryID select a).FirstOrDefault();
            Tbl_FMFund_SubFund   subFund = (from a in BOSSDB.Tbl_FMFund_SubFund where a.FundID == PrimaryID select a).FirstOrDefault();
            Tbl_FMRes_Department dept    = (from e in BOSSDB.Tbl_FMRes_Department where e.FundID == PrimaryID select e).FirstOrDefault();
            var confirmDelete            = "";

            if (fund != null)
            {
                if (dept != null)
                {
                    confirmDelete = "restricted";
                }
                else if (subFund != null)
                {
                    confirmDelete = "true";
                }
                else
                {
                    confirmDelete = "false";
                }
            }
            var result = new { confirmDelete = confirmDelete };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult ConfirmDelete(int PrimaryID)
        {
            Tbl_FMFund_Fund fund = (from a in BOSSDB.Tbl_FMFund_Fund where a.FundID == PrimaryID select a).FirstOrDefault();

            BOSSDB.Tbl_FMFund_Fund.Remove(fund);
            BOSSDB.SaveChanges();

            var result = "";

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult SaveFund(FundModel model)
        {
            var isExist = "";

            if (ModelState.IsValid)
            {
                var fundTitle = model.FundList.FundTitle;
                fundTitle = new CultureInfo("en-US").TextInfo.ToTitleCase(fundTitle);
                Tbl_FMFund_Fund checkFund = (from a in BOSSDB.Tbl_FMFund_Fund where (a.FundTitle == fundTitle || a.FundCode == model.FundList.FundCode) select a).FirstOrDefault();

                if (model.ActionID == 1)
                {
                    if (checkFund == null)
                    {
                        Tbl_FMFund_Fund fund = new Tbl_FMFund_Fund();
                        fund.FundTitle = fundTitle;
                        fund.FundCode  = model.FundList.FundCode;
                        BOSSDB.Tbl_FMFund_Fund.Add(fund);
                        BOSSDB.SaveChanges();
                        isExist = "false";
                    }
                    else if (checkFund != null)
                    {
                        isExist = "true";
                    }
                }
                else if (model.ActionID == 2)
                {
                    Tbl_FMFund_Fund        fund          = (from a in BOSSDB.Tbl_FMFund_Fund where a.FundID == model.FundList.FundID select a).FirstOrDefault();
                    List <Tbl_FMFund_Fund> fundTitlelist = (from e in BOSSDB.Tbl_FMFund_Fund where e.FundTitle == fundTitle select e).ToList();
                    List <Tbl_FMFund_Fund> fundCode      = (from e in BOSSDB.Tbl_FMFund_Fund where e.FundCode == model.FundList.FundCode select e).ToList();
                    if (checkFund != null)
                    {
                        if (fund.FundTitle == fundTitle && fund.FundCode == model.FundList.FundCode)
                        {
                            fund.FundTitle = fundTitle;
                            fund.FundCode  = model.FundList.FundCode;
                            BOSSDB.Entry(fund);
                            BOSSDB.SaveChanges();
                            isExist = "justUpdate";
                        }
                        else
                        {
                            if (fund.FundTitle != fundTitle && fundTitlelist.Count >= 1 || fund.FundCode != model.FundList.FundCode && fundCode.Count >= 1)
                            {
                                isExist = "true";
                            }
                            else
                            {
                                fund.FundTitle = fundTitle;
                                fund.FundCode  = model.FundList.FundCode;
                                BOSSDB.Entry(fund);
                                BOSSDB.SaveChanges();
                                isExist = "justUpdate";
                            }
                        }
                    }
                    else if (checkFund == null)
                    {
                        fund.FundTitle = fundTitle;
                        fund.FundCode  = model.FundList.FundCode;
                        BOSSDB.Entry(fund);
                        BOSSDB.SaveChanges();
                        isExist = "justUpdate";
                    }
                }
            }
            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { isExist = isExist }
            });
        }