public ActionResult ResetPassword(ResetPasswordModel model)
        {
            var message = "";

            if (ModelState.IsValid)
            {
                using (TaxSystemEntities1 dc = new TaxSystemEntities1())
                {
                    var user = dc.AdminInformations.Where(a => a.ResetPasswordCode == model.ResetCode).FirstOrDefault();
                    if (user != null)
                    {
                        user.Password          = model.NewPassword;
                        user.ResetPasswordCode = "";
                        dc.Configuration.ValidateOnSaveEnabled = false;
                        dc.SaveChanges();
                        message = "New password updated successfully";
                    }
                }
            }
            else
            {
                message = "Something invalid";
            }
            ViewBag.Message = message;
            return(View(model));
        }
        public ActionResult ResetPassword(string id)
        {
            //Verify the reset password link
            //Find account associated with this link
            //redirect to reset password page
            if (string.IsNullOrWhiteSpace(id))
            {
                return(HttpNotFound());
            }

            using (TaxSystemEntities1 dc = new TaxSystemEntities1())
            {
                var user = dc.AdminInformations.Where(a => a.ResetPasswordCode == id).FirstOrDefault();
                if (user != null)
                {
                    ResetPasswordModel model = new ResetPasswordModel();
                    model.ResetCode = id;
                    return(View(model));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
        }
        public ActionResult ForgotPassword(string EmailID)
        {
            //Verify Email ID
            //Generate Reset password link
            //Send Email
            string message = "";

            using (TaxSystemEntities1 dc = new TaxSystemEntities1())
            {
                var account = dc.AdminInformations.Where(a => a.Email == EmailID).FirstOrDefault();
                if (account != null)
                {
                    //Send email for reset password
                    string resetCode = Guid.NewGuid().ToString();
                    SendVerificationLinkEmail(account.Email, resetCode, "ResetPassword");
                    account.ResetPasswordCode = resetCode;
                    //This line I have added here to avoid confirm password not match issue , as we had added a confirm password property
                    //in our model class in part 1
                    dc.Configuration.ValidateOnSaveEnabled = false;
                    dc.SaveChanges();
                    message = "Reset password link has been sent to your email id.";
                }
                else
                {
                    message = "Account not found";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
        public ActionResult Sendrefund()
        {
            if (Session["Admin"] != null)
            {
                var    Email             = Session["Email"].ToString();
                var    total             = Session["Total"].ToString();
                var    fromEmail         = new MailAddress("*****@*****.**", "TaxBazar");
                var    toEmail           = new MailAddress(Email);
                var    fromEmailPassword = "******";
                string subject           = "Refund Information";
                string body = "Your Refund is credited in your Bank Account.Amount is " + total;
                var    smtp = new SmtpClient
                {
                    Host                  = "smtp.gmail.com",
                    Port                  = 587,
                    EnableSsl             = true,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials           = new NetworkCredential(fromEmail.Address, fromEmailPassword)
                };
                using (var message = new MailMessage(fromEmail, toEmail)
                {
                    Subject = subject,
                    Body = body,
                    IsBodyHtml = true
                })
                    smtp.Send(message);
            }
            else
            {
                return(RedirectToAction("Index", "AdminInformations"));
            }

            using (TaxSystemEntities1 db = new TaxSystemEntities1())
            {
                var x     = Session["Email"].ToString();
                var data  = db.Registrations.Where(m => m.Email.Equals(x)).SingleOrDefault();
                var data1 = db.GSTINformations.Where(q => q.Uid.Equals(data.Uid)).ToList();
                foreach (var model in data1)
                {
                    model.Flag = 0;
                }
                db.SaveChanges();
            }


            Session["Email"] = null;
            Session["Total"] = null;
            ViewBag.message  = "SuccessFul";
            return(RedirectToAction("Search", "AdminInformations"));
        }
 public ActionResult Search()
 {
     if (Session["Admin"] != null)
     {
         using (TaxSystemEntities1 db = new TaxSystemEntities1())
         {
             return(View(db.Registrations.ToList()));
         }
     }
     else
     {
         return(RedirectToAction("Index", "AdminInformations"));
     }
 }
 public ActionResult History(TaxInformation tax)
 {
     if (Session["PanNumber"] != null)
     {
         ViewBag.m = Session["PanNumber"].ToString();
         using (TaxSystemEntities1 db = new TaxSystemEntities1())
         {
             var x    = Convert.ToInt32(Session["Uid"]);
             var data = db.TaxInformations.Where(m => m.Uid.Equals(x)).ToList();
             return(View(data));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
 public ActionResult Index(Registration reg)
 {
     using (TaxSystemEntities1 db = new TaxSystemEntities1())
     {
         var obj = db.Registrations.Where(a => a.PanNumber.Equals(reg.PanNumber) && a.Password.Equals(reg.Password)).FirstOrDefault();
         if (obj != null)
         {
             Session["PanNumber"] = obj.PanNumber.ToString();
             Session["Uid"]       = Convert.ToInt32(obj.Uid);
             Session["Username"]  = obj.FirstName.ToString() + " " + obj.LastName.ToString();;
             return(RedirectToAction("Index", "Home"));
         }
     }
     ViewBag.Message = "Invalid Pan Number or Password";
     // Response.Write("<script>alert(' Invalid PanNumber or Password')</script>");
     return(View(reg));
 }
 public ActionResult Index(AdminInformation reg)
 {
     if (ModelState.IsValid)
     {
         using (TaxSystemEntities1 db = new TaxSystemEntities1())
         {
             var obj = db.AdminInformations.Where(a => a.UserName.Equals(reg.UserName) && a.Password.Equals(reg.Password)).FirstOrDefault();
             if (obj != null)
             {
                 Session["Admin"] = obj.UserName.ToString();
                 return(RedirectToAction("Index", "Home"));
             }
         }
     }
     ViewBag.Message = "Invalid User Name or Password";
     // Response.Write("<script>alert(' Invalid PanNumber or Password')</script>");
     return(View(reg));
 }
 public ActionResult DGSTbill(GSTINformation gst)
 {
     if (Session["Admin"] != null)
     {
         using (TaxSystemEntities1 db = new TaxSystemEntities1())
         {
             var x = Convert.ToInt32(Request["item.Uid"]);
             ViewBag.email    = Request["item.Email"].ToString();
             Session["Email"] = Request["item.Email"].ToString();
             var data = db.GSTINformations.Where(m => m.Registration.Uid.Equals(x)).ToList();
             if (data == null)
             {
                 return(View());
             }
             return(View(data));
         }
     }
     else
     {
         return(RedirectToAction("Index", "AdminInformations"));
     }
 }
Example #10
0
 public ActionResult EnterGST(GSTNumber gstnumber)
 {
     if (Session["PanNumber"] != null)
     {
         using (TaxSystemEntities1 db = new TaxSystemEntities1())
         {
             var x    = Request["GSTNumber"].ToString();
             var y    = Convert.ToInt32(Session["Uid"]);
             var data = db.GSTNumbers.Where(m => m.Uid.Equals(y)).FirstOrDefault();
             if (data.GSTNumber1 == x)
             {
                 return(RedirectToAction("Gstrate", "GSTINformations"));
             }
             ViewBag.Message = "Invalid GST Number";
         }
         return(View());
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
Example #11
0
        public ActionResult ComputeTax(TaxInformation taxinfo)
        {
            string year = Request["year"].ToString();
            string tptext = Request["tptext"].ToString();
            string stext = Request["statustext"].ToString();
            string status = tptext + " || " + stext;
            int    taxpayer = Convert.ToInt32(Request["taxpayer"].ToString());
            int    statusnum = Convert.ToInt32(Request["status"].ToString());
            int    taxableincome = Convert.ToInt32(Request["taxableincome"].ToString());
            int    arincometax = 0, surcharge = 0, educationcess = 0, totaltax = 0;

            if (taxpayer <= 1)
            {
                if (statusnum <= 1)
                {
                    if (taxableincome <= 250000)
                    {
                        arincometax   = 0;
                        surcharge     = 0;
                        educationcess = 0;
                        totaltax      = 0;
                    }
                    else if (taxableincome <= 500000)
                    {
                        arincometax = (taxableincome - 250000) * 5 / 100;
                        if (taxableincome <= 350000)
                        {
                            if (arincometax <= 2500)
                            {
                                arincometax = 0;
                            }
                            else
                            {
                                arincometax = arincometax - 2500;
                            }
                        }
                        surcharge = 0;
                    }
                    else if (taxableincome <= 1000000)
                    {
                        arincometax = 12500 + (taxableincome - 500000) * 20 / 100;
                        surcharge   = 0;
                    }
                    else
                    {
                        arincometax = 112500 + (taxableincome - 1000000) * 30 / 100;
                        if (taxableincome <= 10000000 && taxableincome > 5000000)
                        {
                            surcharge = arincometax / 10;
                        }
                        else
                        {
                            surcharge = arincometax * 15 / 100;
                        }
                    }
                    educationcess = arincometax * 4 / 100;
                    totaltax      = arincometax + surcharge + educationcess;
                }
                else if (statusnum == 2)
                {
                    if (taxableincome <= 300000)
                    {
                        arincometax   = 0;
                        surcharge     = 0;
                        educationcess = 0;
                        totaltax      = 0;
                    }
                    else if (taxableincome <= 500000)
                    {
                        arincometax = (taxableincome - 300000) * 5 / 100;
                        if (taxableincome <= 350000)
                        {
                            if (arincometax <= 2500)
                            {
                                arincometax = 0;
                            }
                            else
                            {
                                arincometax = arincometax - 2500;
                            }
                        }
                        surcharge = 0;
                    }
                    else if (taxableincome <= 1000000)
                    {
                        arincometax = 10000 + (taxableincome - 500000) * 20 / 100;
                        surcharge   = 0;
                    }
                    else
                    {
                        arincometax = 110000 + (taxableincome - 1000000) * 30 / 100;
                        if (taxableincome <= 10000000 && taxableincome > 5000000)
                        {
                            surcharge = arincometax / 10;
                        }
                        else
                        {
                            surcharge = arincometax * 15 / 100;
                        }
                    }
                    educationcess = arincometax * 4 / 100;
                    totaltax      = arincometax + surcharge + educationcess;
                }
                else
                {
                    if (taxableincome <= 500000)
                    {
                        arincometax   = 0;
                        surcharge     = 0;
                        educationcess = 0;
                        totaltax      = 0;
                    }
                    else if (taxableincome <= 1000000)
                    {
                        arincometax = (taxableincome - 500000) * 20 / 100;
                        surcharge   = 0;
                    }
                    else
                    {
                        arincometax = 100000 + (taxableincome - 1000000) * 30 / 100;
                        if (taxableincome <= 10000000 && taxableincome > 5000000)
                        {
                            surcharge = arincometax / 10;
                        }
                        else
                        {
                            surcharge = arincometax * 15 / 100;
                        }
                    }
                    educationcess = arincometax * 4 / 100;
                    totaltax      = arincometax + surcharge + educationcess;
                }
            }
            else
            {
                if (taxableincome <= 10000)
                {
                    arincometax = (taxableincome - 0) * 10 / 100;
                    surcharge   = 0;
                }
                else if (taxableincome <= 20000)
                {
                    arincometax = (taxableincome - 10000) * 20 / 100;
                    surcharge   = 0;
                }
                else
                {
                    arincometax = (taxableincome - 20000) * 30 / 100;
                    surcharge   = 0;
                }
                educationcess = arincometax * 4 / 100;
                totaltax      = arincometax + surcharge + educationcess;
            }
            if (totaltax <= 250000)
            {
                using (TaxSystemEntities1 db = new TaxSystemEntities1())
                {
                    if (ModelState.IsValid)
                    {
                        taxinfo.TotalIncome = taxableincome;
                        taxinfo.Status      = status;
                        taxinfo.TotalTax    = totaltax;
                        taxinfo.Year        = year;
                        taxinfo.Uid         = Convert.ToInt32(Session["Uid"]);
                        db.TaxInformations.Add(taxinfo);
                        db.SaveChanges();
                    }
                }
            }
            ViewBag.arincometax   = arincometax;
            ViewBag.taxableincome = taxableincome;
            ViewBag.surcharge     = surcharge;
            ViewBag.educationcess = educationcess;
            ViewBag.totaltax      = totaltax;
            ModelState.Clear();
            return(View("Index"));
        }