Exemplo n.º 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"));
            }
        }
        public async Task <IActionResult> GetCombinInfo([FromBody] TaxRegistration taxRegistration, TaxApplication taxApplication)
        {
            string Query = "[GET_All_TaxApplication] {0}";
            int    count = 10;

            object[] Parameters = { count };

            try
            {
                List <TaxApplication> Result = await Repo.TaxApp_Repository.ExecuteQuery(Query, Parameters);

                if (Result.Count() > 0)
                {
                    return(Ok(Result));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception Ex)
            {
                return(BadRequest(Ex));
            }
        }
Exemplo n.º 3
0
        public ActionResult Register(TaxRegistration obj)
        {
            if (ModelState.IsValid)
            {
                var EmailResult = db.TaxRegistrations.Where(m => m.Email.Equals(obj.Email)).FirstOrDefault();
                if (EmailResult != null)
                {
                    ModelState.AddModelError("", "Email Already Exist "); return(View());
                }

                var UseNameResult = db.TaxRegistrations.Where(m => m.UserName.Equals(obj.UserName)).FirstOrDefault();
                if (UseNameResult != null)
                {
                    ModelState.AddModelError("", " User Name already Exist"); return(View());
                }


                db.TaxRegistrations.Add(obj);
                db.SaveChanges();

                TempData["Registered"] = " Registration Successful,";
            }


            return(View());
        }
Exemplo n.º 4
0
        public ActionResult Manage(string id, Manage model)
        {
            if (Session["UserName"] != null)
            {
                if (ModelState.IsValid)
                {
                    string          username    = Session["UserName"].ToString();
                    TaxRegistration FindPasword = db.TaxRegistrations.Where(m => m.Password.Equals(model.OldPassword) && m.UserName.Equals(username)).FirstOrDefault();
                    if (FindPasword == null)
                    {
                        ModelState.AddModelError("", "Your Old Password Does Not Exist");
                    }
                    else
                    {
                        FindPasword.Password       = model.NewPassword;
                        FindPasword.PassworConfirm = model.ConfirmPassword;
                        db.SaveChanges();
                        TempData["P"]       = " Password Succesfully Updated ";
                        Session["UserName"] = null;
                        return(View());
                    }
                }

                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
 public void addTaxRegistration(TaxRegistration taxRegistration)
 {
     if (taxRegistration != null)
     {
         taxRegistration.Approved = true;
         _dbContext.TaxRegistrations.Add(taxRegistration);
     }
 }
        public async Task <IActionResult> Put(int?id, [FromBody] TaxRegistration taxRegistration)
        {
            if (id == null)
            {
                return(NotFound("empty id"));
            }

            string Query_Update = "[Update_TaxReg] {0},{1}, {2}, {3},{4},{5} ";

            object[] Parameter_uPDATE = { id,                       taxRegistration.Password,
                                          taxRegistration.Address,
                                          taxRegistration.PhoneNo,
                                          taxRegistration.UserName,
                                          taxRegistration.FullName, };


            string Query = "GetTaxRegByID {0}";

            object[] Para = { id };
            try
            {
                var Result_FInduser = await IUnitOfWork.TaxReg_Repository.ExecuteQuery(Query, Para);

                if (Result_FInduser.Count() > 0)
                {
                    var Result_Update = await IUnitOfWork.TaxReg_Repository.ExecuteCommand(Query_Update, Parameter_uPDATE);

                    if (Result_Update > 0)
                    {
                        return(Ok());
                    }
                    else
                    {
                        return(NotFound(" User  Not Found"));
                    }
                }
                else
                {
                    return(NotFound(" User  Not Found"));
                }
            }
            catch (Exception)
            {
                IUnitOfWork.RollBack();
                return(BadRequest());
            }
        }
Exemplo n.º 7
0
        public ActionResult ManageAccount(TaxRegistration obj)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            else
            {
                ModelState.Remove("UserName");
                ModelState.Remove("Password");
                ModelState.Remove("Email");

                ModelState.Remove("PassworConfirm");

                if (ModelState.IsValid)
                {
                    TempData["Mgs"] = " Your Update was Successful";

                    try
                    {
                        string username = Session["UserName"].ToString();
                        var    user     = db.TaxRegistrations.Where(a => a.UserName.Equals(username)).FirstOrDefault();

                        if (user == null)
                        {
                            ModelState.AddModelError("", " User Not Found");
                        }
                        else
                        {
                            user.Address  = obj.Address;
                            user.FullName = obj.FullName;
                            user.PhoneNo  = obj.PhoneNo;
                            db.SaveChanges();

                            TempData["Mgs"] = " Your Update was Successful";
                            return(View());
                        }
                    }

                    catch (Exception) { ModelState.AddModelError("", " User Not Found"); }
                }
            }
            return(View());
        }
Exemplo n.º 8
0
        public ActionResult MyProfile(string id)
        {
            if (Session["UserName"] != null)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
                }
                TaxRegistration User = db.TaxRegistrations.Where(m => m.UserName.Equals(id)).FirstOrDefault();

                if (User == null)
                {
                    return(HttpNotFound());
                }
                return(View(User));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemplo n.º 9
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());
        }
        public async Task <IActionResult> Post([FromBody] TaxRegistration taxRegistration)
        {
            string Query_FindEmail = "GetTaxRegByEmail {0}";

            object[] Para_FindEmail = { taxRegistration.Email };


            string Query_FindUsername = "******";

            object[] Para_FindUsername = { taxRegistration.UserName };

            string Query_FindPhone = "[GetTaxRegByPhone] {0}";

            object[] Para_FindPhone = { taxRegistration.PhoneNo };



            string Query_AddUser = "******";

            object[] Para_AddUser =
            {
                taxRegistration.UserName,
                taxRegistration.Password,
                taxRegistration.Address,
                taxRegistration.PhoneNo,
                taxRegistration.Email,
                taxRegistration.FullName
            };


            try
            {
                if (ModelState.IsValid)
                {
                    // await IUnitOfWork.Admin_Repository.Add(admin);
                    // await IUnitOfWork.Commit();
                    var Result_Email = await IUnitOfWork.TaxReg_Repository.ExecuteQuery(Query_FindEmail, Para_FindEmail);

                    if (Result_Email.Count() > 0)
                    {
                        return(NotFound("Email Already Exist"));
                    }

                    var Result_Username = await IUnitOfWork.TaxReg_Repository.ExecuteQuery(Query_FindUsername, Para_FindUsername);

                    if (Result_Username.Count() > 0)
                    {
                        return(NotFound("UserName  Already Exist"));
                    }

                    var Result_Phone = await IUnitOfWork.TaxReg_Repository.ExecuteQuery(Query_FindPhone, Para_FindPhone);

                    if (Result_Phone.Count() > 0)
                    {
                        return(NotFound("Phone Number  Already Exist"));
                    }

                    var Result_Add = await IUnitOfWork.TaxReg_Repository.ExecuteCommand(Query_AddUser, Para_AddUser);

                    if (Result_Add > 0)

                    {
                        return(Ok("Added Successfuly"));
                    }
                }
                return(NotFound("modelerror"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
 public void setApproved(TaxRegistration taxRegistration)
 {
     _dbContext.TaxRegistrations.Update(taxRegistration);
 }