Beispiel #1
0
        public ActionResult Index()
        {
            MasterTax TaxList = PTax.GetAllTaxes();

            Session["TaxStructure"] = TaxList.Taxstructure;
            return(View("Tax", TaxList));
        }
Beispiel #2
0
        public MasterTax GetAllTaxes()
        {
            DataTable           Taxset           = productData.GetTaxSet();
            DataTable           TaxStructure     = productData.GetTaxStructure();
            MasterTax           taxlist          = new MasterTax();
            List <TaxSet>       taxsetlist       = new List <TaxSet>();
            List <TaxStructure> taxstructurelist = new List <TaxStructure>();

            foreach (DataRow dr in Taxset.Rows)
            {
                TaxSet tmodel = new TaxSet();
                tmodel.TaxId      = dr.IsNull("TaxId") ? 0 : int.Parse(dr["TaxId"].ToString());
                tmodel.TaxName    = dr.IsNull("TaxName") ? "" : (dr["TaxName"].ToString());
                tmodel.TaxPercent = dr.IsNull("TaxPercent") ? 0 : decimal.Parse(dr["TaxPercent"].ToString());
                tmodel.ActiveFlag = dr.IsNull("ActiveFlag") ? false : bool.Parse(dr["ActiveFlag"].ToString());
                taxlist.Taxset.Add(tmodel);
            }

            foreach (DataRow dr in TaxStructure.Rows)
            {
                TaxStructure tsmodel = new TaxStructure();
                tsmodel.TaxId                  = dr.IsNull("TaxId") ? 0 : int.Parse(dr["TaxId"].ToString());
                tsmodel.TaxStructureId         = dr.IsNull("TaxStructureId") ? 0 : int.Parse(dr["TaxStructureId"].ToString());
                tsmodel.TaxStructureName       = dr.IsNull("TaxStructureName") ? "" : (dr["TaxStructureName"].ToString());
                tsmodel.TaxStructurePercentage = dr.IsNull("TaxStructurePercentage") ? 0 : decimal.Parse(dr["TaxStructurePercentage"].ToString());
                taxlist.Taxstructure.Add(tsmodel);
            }
            return(taxlist);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MasterTax masterTax = db.masterTaxes.Find(id);

            db.masterTaxes.Remove(masterTax);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MasterTax masterTax = db.masterTaxes.Find(id);

            if (masterTax == null)
            {
                return(HttpNotFound());
            }
            return(View(masterTax));
        }
        public ActionResult Edit(MasterTax cvm)
        {
            var cat = db.masterTaxes.Where(x => x.TaxID == cvm.TaxID).FirstOrDefault();

            cat.Tax      = cvm.Tax;
            cat.TaxValue = cvm.TaxValue;
            cat.isActive = false;
            if (cvm.statusez == "Yes")
            {
                cat.isActive = true;
            }
            db.masterTaxes.Add(cat);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(MasterTax cvm)
        {
            MasterTax cat = new MasterTax();

            cat.Tax      = cvm.Tax;
            cat.TaxValue = cvm.TaxValue;
            cat.isActive = false;
            if (cvm.statusez == "Yes")
            {
                cat.isActive = true;
            }
            db.masterTaxes.Add(cat);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }