示例#1
0
        public ActionResult Delete(string id, ApplyForTax model)
        {
            if (Session["AdminUser"] != null)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
                }
                else
                {
                    ApplyForTax     User    = Db.ApplyForTaxes.Where(m => m.BVN.Equals(id)).FirstOrDefault();
                    TaxRegistration TAxUser = Db.TaxRegistrations.Where(m => m.BVN == id).FirstOrDefault();
                    if (User == null && TAxUser == null)
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        TAxUser.BVN = null;
                        Db.SaveChanges();
                        Db.ApplyForTaxes.Remove(User);
                        Db.SaveChanges();

                        TempData["D"] = " User Removed Successfully";
                        return(RedirectToAction("AdminPanel", "Admin"));
                    }
                }
            }
            else

            {
                return(RedirectToAction("Index", "Admin"));
            }
        }
示例#2
0
        public ActionResult PayTax(PayTax payTax_Obj)
        {
            if (Session["UserName"] != null)
            {
                if (ModelState.IsValid)
                {
                    try {
                        ApplyForTax User = db.ApplyForTaxes.Where(m => m.UserTin.Equals(payTax_Obj.Tin)).FirstOrDefault();

                        if (User == null)
                        {
                            ModelState.AddModelError("", " TIN Record Not Found ");
                        }
                        else if (User.Payment_Status == "1")
                        {
                            ModelState.AddModelError("", " You Have Already Made Payment ");
                        }

                        else
                        {
                            Session["Tin"] = payTax_Obj.Tin;
                            int Income = Convert.ToInt32(User.CurrentSalary);
                            Session["S"] = User.CurrentSalary;
                            int taxre = Convert.ToInt32(payTax_Obj.TaxRelief);

                            int TaxableIncome = Income - taxre;

                            Session["T"] = TaxableIncome * 0.24;

                            User.TaxAmount      = (TaxableIncome * 0.24).ToString("C");
                            User.Payment_Status = "0";

                            db.SaveChanges();

                            return(RedirectToAction("UserDetails", "Account"));
                        }
                    }

                    catch { ModelState.AddModelError("", " Fail to Connect to Database "); }
                }

                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#3
0
        public ActionResult Edit(string id, ApplyForTax model)
        {
            if (Session["AdminUser"] != null)
            {
                ModelState.Remove("UserTin");
                ModelState.Remove("Email");
                ModelState.Remove("BVN");
                ModelState.Remove("Payment_Status");
                ModelState.Remove("TaxAmount");

                if (ModelState.IsValid)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
                    }
                    ApplyForTax User = Db.ApplyForTaxes.Where(m => m.BVN.Equals(id)).FirstOrDefault();


                    if (User == null)
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        User.CompanyContactNumber  = model.CompanyContactNumber;
                        User.CompanyPhsicalAddress = model.CompanyPhsicalAddress;
                        User.CompanyWebsite        = model.CompanyWebsite;
                        User.CompnayName           = model.CompnayName;
                        User.CurrentPosition       = model.CurrentPosition;
                        User.CurrentSalary         = model.CurrentSalary;
                        User.StaffId = model.StaffId;
                        Db.SaveChanges();
                        TempData["Suc"] = " Update was Successfully";
                    }
                }

                return(View());
            }
            else
            {
                return(RedirectToAction("Index", "Admin"));
            }
        }
示例#4
0
        public ActionResult ApplyForTax(ApplyForTax model)
        {
            if (Session["UserName"] != null)
            {
                ModelState.Remove("UserTin");
                ModelState.Remove("TaxAmount");
                ModelState.Remove("Payment_Status");
                if (ModelState.IsValid)
                {
                    try
                    {
                        var FindEmail = db.ApplyForTaxes.Where(m => m.Email.Equals(model.Email)).FirstOrDefault();
                        if (FindEmail == null)
                        {
                            Session["P_Email"]        = model.Email;
                            Session["CompanyName"]    = model.CompnayName;
                            Session["CompanyAddress"] = model.CompanyPhsicalAddress;
                            Session["CompanyContcat"] = model.CompanyContactNumber;
                            Session["Position"]       = model.CurrentPosition;
                            Session["Salary"]         = model.CurrentSalary;
                            Session["StaffId"]        = model.StaffId;
                            Session["CompanyWebsite"] = model.CompanyWebsite;
                            Session["BVN"]            = model.BVN;
                            Session["TaxAmount"]      = 0;
                            Session["Payment_Status"] = 0;

                            return(RedirectToAction("PreviewApplication", "Account"));
                        }
                        else
                        {
                            ModelState.AddModelError("", " User with the same Email Already Exist");
                        }
                    }
                    catch { }
                }


                return(View(model));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#5
0
        public ActionResult Edit(string id)
        {
            if (Session["AdminUser"] != null)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
                }
                ApplyForTax User = Db.ApplyForTaxes.Where(m => m.BVN.Equals(id)).FirstOrDefault();

                if (User == null)
                {
                    return(HttpNotFound());
                }
                return(View(User));
            }
            else
            {
                return(RedirectToAction("Index", "Admin"));
            }
        }
示例#6
0
        public ActionResult AdminPanel(ApplyForTax model)
        {
            if (Session["AdminUser"] == null)
            {
                return(RedirectToAction("Index", "Admin"));
            }
            else
            {
                var Result = Db.ApplyForTaxes.ToList();

                if (Result.Count == 0)
                {
                    TempData["Mgs1"] = " Record Not Found ";

                    return(View(Result));
                }
                else
                {
                    return(View(Result));
                }
            }
        }
示例#7
0
        public ActionResult PayNow()
        {
            if (Session["UserName"] != null)
            {
                string Tin = Session["Tin"].ToString();


                try
                {
                    ApplyForTax User = db.ApplyForTaxes.Where(m => m.UserTin.Equals(Tin)).FirstOrDefault();
                    if (User != null)
                    {
                        Session["BVN"]       = User.BVN;
                        Session["TaxAmount"] = User.TaxAmount;



                        TaxRegistration Reg = db.TaxRegistrations.Where(m => m.BVN.Equals(User.BVN)).FirstOrDefault();
                        if (Reg != null)
                        {
                            Session["Name"] = Reg.FullName;
                        }
                    }



                    return(View());
                }

                catch (Exception Ex) { ModelState.AddModelError(Ex.Message, " Could Not Load Data"); }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }


            return(View());
        }
示例#8
0
        public ActionResult PreviewApplication(ApplyForTax model)



        {
            if (Session["UserName"] != null)
            {
                try
                {
                    Random random  = new Random();
                    int    randnum = random.Next(0, 1000000);
                    string Tin     = randnum.ToString("000000");
                    string UserTin = " FIRS-" + Tin;



                    model.CompnayName           = Session["CompanyName"].ToString();
                    model.CompanyPhsicalAddress = Session["CompanyAddress"].ToString();
                    model.CompanyContactNumber  = Session["CompanyContcat"].ToString();
                    model.CurrentPosition       = Session["Position"].ToString();
                    model.CurrentSalary         = Session["Salary"].ToString();
                    model.StaffId        = Session["StaffId"].ToString();
                    model.CompanyWebsite = Session["CompanyWebsite"].ToString();
                    model.BVN            = Session["BVN"].ToString();
                    model.UserTin        = UserTin;
                    model.TaxAmount      = Session["TaxAmount"].ToString();
                    model.Email          = Session["P_Email"].ToString();
                    model.Payment_Status = "0";



                    var FindTin   = db.ApplyForTaxes.Where(m => m.BVN.Equals(model.BVN)).FirstOrDefault();
                    var FindEmail = db.TaxRegistrations.Where(m => m.Email.Equals(model.Email)).FirstOrDefault();

                    if (FindEmail == null)
                    {
                        ModelState.AddModelError("", " Email Not the same as Registration Email");
                    }
                    else
                    {
                        if (FindTin != null)
                        {
                            ModelState.AddModelError("", " User With The Same BVN Already Exits");
                        }
                        else
                        {
                            db.ApplyForTaxes.Add(model);
                            db.SaveChanges();

                            var Update = db.TaxRegistrations.Where(m => m.Email.Equals(model.Email)).FirstOrDefault();

                            Update.BVN = model.BVN;

                            db.SaveChanges();
                            Session["UserTin"] = UserTin;
                            return(RedirectToAction("Tinpage", "Account"));
                        }
                    }
                }
                catch { ModelState.AddModelError("", " Application Failed"); }
            }


            else
            {
                return(RedirectToAction("Login", "Account"));
            }


            return(View());
        }