Beispiel #1
0
        public ActionResult ConfirmDeleteTax(int PrimaryID)
        {
            Tbl_FMTax taxiii = (from a in BOSSDB.Tbl_FMTax where a.TaxID == PrimaryID select a).FirstOrDefault();

            BOSSDB.Tbl_FMTax.Remove(taxiii);
            BOSSDB.SaveChanges();
            var result = "";

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult DeleteTax(int PrimaryID)
        {
            Tbl_FMTax taxTbl        = (from a in BOSSDB.Tbl_FMTax where a.TaxID == PrimaryID select a).FirstOrDefault();
            var       confirmDelete = "";

            if (taxTbl != null)
            {
                confirmDelete = "false";
            }
            var result = new { confirmDelete = confirmDelete };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult SaveTax(TaxModel model)
        {
            var isExist = "";

            if (ModelState.IsValid)
            {
                var desc      = model.TaxList.Description;
                var shortdesc = model.TaxList.ShortDescrption;

                Tbl_FMTax checkTax = (from a in BOSSDB.Tbl_FMTax where (a.Description == desc) select a).FirstOrDefault();

                if (model.ActionID == 1)
                {
                    if (checkTax == null)
                    {
                        Tbl_FMTax taxii = new Tbl_FMTax();
                        taxii.Description       = desc;
                        taxii.ShortDepscription = model.TaxList.ShortDescrption;
                        taxii.isUsed            = model.TaxList.isUsed;
                        taxii.Percentage        = model.TaxList.Percentage;
                        taxii.BaseTax           = model.TaxList.BaseTax;
                        taxii.GAID = model.GAID;
                        BOSSDB.Tbl_FMTax.Add(taxii);
                        BOSSDB.SaveChanges();
                        isExist = "false";
                    }
                    else if (checkTax != null)
                    {
                        isExist = "true";
                    }
                }
                else if (model.ActionID == 2)
                {
                    Tbl_FMTax        tax            = (from a in BOSSDB.Tbl_FMTax where a.TaxID == model.TaxList.TaxID select a).FirstOrDefault();
                    List <Tbl_FMTax> descCount      = (from e in BOSSDB.Tbl_FMTax where e.Description == desc select e).ToList();
                    List <Tbl_FMTax> shortdescCount = (from e in BOSSDB.Tbl_FMTax where e.ShortDepscription == shortdesc select e).ToList();
                    if (checkTax != null)
                    {
                        if (tax.Description == desc && tax.ShortDepscription == model.TaxList.ShortDescrption && tax.TaxID == model.TaxList.TaxID)
                        {
                            isExist = "justUpdate";
                        }
                        else
                        {
                            if (tax.Description != desc && descCount.Count >= 1 || tax.ShortDepscription != shortdesc && shortdescCount.Count >= 1)
                            {
                                isExist = "true";
                            }
                            else
                            {
                                isExist = "justUpdate";
                            }
                        }
                    }
                    else if (checkTax == null)
                    {
                        isExist = "justUpdate";
                    }
                    if (isExist == "justUpdate")
                    {
                        tax.Description       = desc;
                        tax.ShortDepscription = model.TaxList.ShortDescrption;
                        tax.isUsed            = model.TaxList.isUsed;
                        tax.Percentage        = model.TaxList.Percentage;
                        tax.BaseTax           = model.TaxList.BaseTax;
                        tax.GAID = model.GAID;
                        BOSSDB.Entry(tax);
                        BOSSDB.SaveChanges();
                    }
                }
            }
            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { isExist = isExist }
            });
        }