Beispiel #1
0
        private void backgroundWorkerForSignUp_DoWork(object sender, DoWorkEventArgs e)
        {
            AdministratorInfo adminInfo = new AdministratorInfo();

            byte[] img = null;
            if (imageLocation == null || imageLocation == "")
            {
                IsImageNotUploaded = true;
                return;
            }
            FileStream fs = new FileStream(imageLocation, FileMode.Open, FileAccess.Read);

            BinaryReader br = new BinaryReader(fs);

            img = br.ReadBytes((int)fs.Length);

            string username        = usernameBox.Text;
            string password        = passwordBox.Text;
            string confirmPassword = confirmPassowordBox.Text;
            int    cnic;
            bool   flag = int.TryParse(cnicBox.Text, out cnic);

            if ((password != confirmPassword) || (!flag))
            {
                IsPasswordNotConfirmed = true;
                return;
            }
            adminInfo.UserName = username;
            adminInfo.Password = password;
            adminInfo.Cnic     = cnic;
            adminInfo.Image    = img;
            //bool executionState = api.SendAdminInfo(username, password, cnic, img);
            IsSignUpSuccessfull = api.AdminRegistration(adminInfo);
        }