示例#1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            var path = string.Empty;

            if (args.Length > 0)
            {
                path = args[0];
            }

            while (!FileValidate.Validate(path))
            {
                Console.WriteLine(Messages.PromtPath);
                path = Console.ReadLine();
            }

            var analyzer = new DataAnalyzer(path);

            analyzer.Analyze();
            analyzer.Report();
        }
示例#2
0
        public ActionResult RegisterUser(MindfireEmployeeRegister employeeRegister)
        {
            if (ModelState.IsValid)
            {
                if (dbReference.GetEmployeeDetails.Where(m => m.Email == employeeRegister.Email).SingleOrDefault() == null)
                {
                    string extension = Path.GetExtension(Path.GetFileName(employeeRegister.ImageUpload.FileName));
                    if (FileValidate.IsFileValid(extension))
                    {
                        if (ContactValidate.IsContactValid(employeeRegister))
                        {
                            var email = new Create().SaveData(employeeRegister);
                            FormsAuthentication.SetAuthCookie(email, false);
                            return(RedirectToAction("DisplayUserDetails", "Details"));
                        }
                        else
                        {
                            TempData["contactError"] = "*Contact number Length should be between 5 and 12";
                            return(View());
                        }
                    }
                    else
                    {
                        TempData["fileError"] = "Only Image files(.jpg .png .jpeg) can be uploaded";
                        return(View());
                    }
                }
                else
                {
                    TempData["emailError"] = "Email-Id already Exists";
                    return(View());
                }
            }

            return(View());
        }
        public void ValidateTest_ShouldReturnTrueIfTxtOrCsv(string path, bool expected)
        {
            var actual = FileValidate.Validate(path);

            Assert.AreEqual(expected, actual);
        }
        public void IsCorrectFormat_ShouldReturnTrueIfTxtOrCsv(string path, bool expected)
        {
            var actual = FileValidate.IsCorrectFormat(path);

            Assert.AreEqual(expected, actual);
        }