Ejemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            log4net.Config.XmlConfigurator.Configure();

            LogManager.LogManager.Info("启动软件");

            //应用程序关闭时,才 System.Windows.Application.Shutdown 调用
            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            //验证License
            if (!RegisterMaster.CanStart())
            {
                this.Shutdown();
            }

            //登录
            bool?loginDlgResult = (new LoginDlg(AppSettings["DEFAULT_USER_MAIL"])).ShowDialog();

            if (!loginDlgResult.HasValue || !loginDlgResult.Value)
            {
                this.Shutdown();
            }

            circleProgressBox.ShowPregress();

            base.OnStartup(e);
        }
Ejemplo n.º 2
0
 public bool GetRegister([FromUri] RegisterMaster a)
 {
     try
     {
         bool b = checkForMail(a.mail);
         if (b == true)
         {
             AuthorMaster au = new AuthorMaster()
             {
                 mail  = a.mail,
                 uname = a.uname,
                 fname = a.fname,
                 pass  = a.pass,
                 lname = a.lname
             };
             dc.AuthorMasters.InsertOnSubmit(au);
             dc.SubmitChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> RegisterFirstMaster([FromBody] RegisterMaster command)
        {
            if (await _masterService.ExistAsync())
            {
                ModelState.AddModelError("exists", "first master already exists");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try {
                await _authService.RegisterMasterAsync(command.Name, command.Surname, command.Email,
                                                       command.PhoneNumber, command.Password);

                return(StatusCode(201));
            } catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> RegisterMaster([FromBody] RegisterMaster command)
        {
            command.Email = command.Email.ToLowerInvariant();
            if (await _accountService.ExistsByEmailAsync(command.Email))
            {
                ModelState.AddModelError("Email", "Email is already taken.");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try {
                await _authService.RegisterMasterAsync(command.Name, command.Surname, command.Email,
                                                       command.PhoneNumber, command.Password);

                return(StatusCode(201));
            } catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //应用程序关闭时,才 System.Windows.Application.Shutdown 调用
            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            //验证License
            if (!RegisterMaster.CanStart())
            {
                this.Shutdown();
            }

            //登录
            bool?loginDlgResult = (new LoginDlg(AppSettings["DEFAULT_USER_MAIL"])).ShowDialog();

            if (!loginDlgResult.HasValue || !loginDlgResult.Value)
            {
                this.Shutdown();
            }

            base.OnStartup(e);
        }
Ejemplo n.º 6
0
        public ActionResult Register(RegisterMaster registermaster, string address)
        {
            if (ModelState.IsValid)
            {
                // Code for validating the CAPTCHA
                if (this.IsCaptchaValid("Captcha is not valid"))
                {
                    db.Register(registermaster.CategoryId, "1", registermaster.CompanyName, registermaster.RegAddress, registermaster.City, registermaster.StateId, registermaster.pincode, registermaster.PanNo, registermaster.ContactPerson, registermaster.Email, registermaster.Mobile, registermaster.Telephone, registermaster.Tin);

                    return(RedirectToAction("Login"));
                }
                else
                {
                    ViewBag.ErrMessage = "Error: captcha is not valid.";
                    return(RedirectToAction("Register"));
                }
            }
            ViewBag.CategoryListbag = new SelectList(db.CategoryMasters.ToList(), "CategoryID", "CategoryName");
            ViewBag.StateListbag    = new SelectList(db.StateMasters.ToList(), "stateId", "StateName");
            return(View());
        }