Пример #1
0
 public void Add(Mezzo myMezzo)
 {
     idMezzo++;
     myMezzo.id = idMezzo;
     listMezzi.Add(myMezzo);
     ManageDB.StoreMezzi(this);
 }
        private void changeFunc()
        {
            this.txtStatus.ForeColor = Color.Blue;
            this.txtStatus.Text      = "修改信息:正在修改...";
            Application.DoEvents();
            RegexInfo myLoginInfo = new RegexInfo();

            if (this.txtChangeTo.Text != "")
            {
                if (myLoginInfo.isMailAddress(this.txtChangeTo.Text))
                {
                    ManageDB myManageDB = new ManageDB();
                    myManageDB.UpdateDB("用户管理", "email", this.txtChangeTo);
                    TimeDelay myTimeDelay = new TimeDelay();
                    this.btnOK.Enabled     = false;
                    this.btnCancel.Enabled = false;
                    myTimeDelay.closingCurrentWindowDelay(3, this.txtStatus, this, "修改信息:修改成功!", "");
                }
                else
                {
                    this.txtStatus.ForeColor = Color.Red;
                    this.txtStatus.Text      = "修改信息:修改失败!邮箱地址不合法!";
                }
            }
            else
            {
                this.txtStatus.ForeColor = Color.Red;
                this.txtStatus.Text      = "修改信息:修改失败,所有项不能为空!";
            }
        }
Пример #3
0
        public void Delete(int id)
        {
            int tmp = listMezzi.FindIndex(item => item.id == id);

            listMezzi.RemoveAt(tmp);
            ManageDB.StoreMezzi(this);
        }
Пример #4
0
        public void Edit(int id, Mezzo myMezzo)
        {
            int tmp = listMezzi.FindIndex(item => item.id == id);

            listMezzi[tmp].Descrizione = myMezzo.Descrizione;
            ManageDB.StoreMezzi(this);
        }
Пример #5
0
        public HttpResponseMessage Get()
        {
            try
            {
                var value = ManageDB.GetCO2LastValue();

                var valueInt = Convert.ToInt32(value);

                int valueInPercent;

                if (value < 350)
                {
                    valueInPercent = 0;
                }
                else if (value > 1000)
                {
                    valueInPercent = 100;
                }
                else
                {
                    valueInPercent = Convert.ToInt32((value / 100) * 6.5);
                }

                //var valueInPercent =  / 70);

                return(Request.CreateResponse(HttpStatusCode.OK, valueInPercent));
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Пример #6
0
        public void Edit(int id, Autista myAutista)
        {
            int tmp = listAutisti.FindIndex(item => item.id == id);

            listAutisti[tmp].Cognome = myAutista.Cognome;
            listAutisti[tmp].Nome    = myAutista.Nome;
            ManageDB.StoreAutisti(this);
        }
Пример #7
0
 public void Add(Autista myAutista)
 {
     idAutista++;
     myAutista.id = idAutista;
     listAutisti.Add(myAutista);
     //ManageDB.StoreAutisti(listAutisti);
     ManageDB.StoreAutisti(this);
 }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            pnlContent.Controls.Clear();
            Form f2 = new ManageDB();

            f2.TopLevel   = false;
            f2.AutoScroll = true;
            pnlContent.Controls.Add(f2);
            f2.Show();
        }
Пример #9
0
        private void MainUserInfo_Load(object sender, EventArgs e)
        {
            ManageDB myManageDB = new ManageDB();

            myManageDB.queryEmailAddress(UserLogin.pubUserName, UserLogin.pubPasswd);
            myManageDB.queryUserFullName(UserLogin.pubUserName, UserLogin.pubPasswd);
            this.labUserName.Text     = UserLogin.pubUserName;
            this.labFullName.Text     = ManageDB.userFullName;
            this.labEmailAddress.Text = ManageDB.userEmailAddress;
        }
Пример #10
0
        public HttpResponseMessage Get(int value)
        {
            try
            {
                ManageDB.SetCO2Value(value);

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Пример #11
0
        public HttpResponseMessage Get(int mode)
        {
            var change = ManageDB.ChangeStatus(Convert.ToByte(mode));

            if (change)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Пример #12
0
        public HttpResponseMessage Get()
        {
            try
            {
                var status = ManageDB.GetStatus();

                return(Request.CreateResponse(HttpStatusCode.OK, status));
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Пример #13
0
        private void myLoginFunc()
        {
            RegexInfo myLoginInfo = new RegexInfo();
            ManageDB  myManageDB  = new ManageDB();

            this.txtStatus.ForeColor = Color.Blue;
            this.txtStatus.Text      = "重置信息:重置中...";
            Application.DoEvents();

            if (this.txtUserName.Text != "" && this.txtUserEmail.Text != "")
            {
                if (myManageDB.checkUserName(this.txtUserName.Text))
                {
                    if (myLoginInfo.isMailAddress(this.txtUserEmail.Text))
                    {
                        if (myManageDB.userMailToResetPassword(this.txtUserName.Text, this.txtUserEmail.Text))
                        {
                            TimeDelay myTimeDelay = new TimeDelay();
                            this.btnOK.Enabled     = false;
                            this.btnCancel.Enabled = false;
                            myTimeDelay.closingCurrentWindowDelay(3, this.txtStatus, this, "重置信息:验证成功,即将开始重置...", "");
                            UserChangePSD myUserChangePSD = new UserChangePSD();
                            myUserChangePSD.Show();
                        }
                        else
                        {
                            this.txtStatus.ForeColor = Color.Red;
                            this.txtStatus.Text      = "重置信息:重置失败,请确认邮箱是否填写正确!";
                        }
                    }
                    else
                    {
                        this.txtStatus.ForeColor = Color.Red;
                        this.txtStatus.Text      = "重置信息:重置失败!邮箱地址不合法!";
                    }
                }
                else
                {
                    this.txtStatus.ForeColor = Color.Red;
                    this.txtStatus.Text      = "重置信息:重置失败,用户名不存在!";
                }
            }
            else
            {
                this.txtStatus.ForeColor = Color.Red;
                this.txtStatus.Text      = "重置信息:重置失败,用户名和邮箱均不能为空!";
            }
        }
Пример #14
0
 private void myLoginFunc()
 {
     if (Properties.Settings.Default.ConnectionString == null || Properties.Settings.Default.ConnectionString == "")
     {
         this.txtStatus.ForeColor = Color.Red;
         this.txtStatus.Text      = "登录信息:登录失败,无法连接到服务器!";
     }
     else
     {
         this.txtStatus.ForeColor = Color.Blue;
         this.txtStatus.Text      = "登录信息:登录中...";
         Application.DoEvents();
         ManageDB myManageDB = new ManageDB();
         if (this.txtUserName.Text != "" && this.txtPasswd.Text != "")
         {
             if (myManageDB.checkUserName(this.txtUserName.Text))
             {
                 if (myManageDB.queryUserFullName(this.txtUserName.Text, this.txtPasswd.Text) && myManageDB.queryEmailAddress(this.txtUserName.Text, this.txtPasswd.Text))
                 {
                     pubUserName = this.txtUserName.Text;
                     pubPasswd   = this.txtPasswd.Text;
                     this.txtStatus.ForeColor = Color.Green;
                     this.txtStatus.Text      = "登录信息:成功!";
                     Application.DoEvents();
                     this.Visible = false;
                     d_ShowMainFrom();
                 }
                 else
                 {
                     this.txtStatus.ForeColor = Color.Red;
                     this.txtStatus.Text      = "登录信息:登录失败,请确认密码是否填写正确!";
                 }
             }
             else
             {
                 this.txtStatus.ForeColor = Color.Red;
                 this.txtStatus.Text      = "登录信息:登录失败,用户名不存在,请注册!";
             }
         }
         else
         {
             this.txtStatus.ForeColor = Color.Red;
             this.txtStatus.Text      = "登录信息:登录失败,用户名和密码不能为空!";
         }
     }
 }
Пример #15
0
        private void changeFunc()
        {
            this.txtStatus.ForeColor = Color.Blue;
            this.txtStatus.Text      = "修改信息:正在修改...";
            Application.DoEvents();
            RegexInfo myLoginInfo = new RegexInfo();

            if (this.txtPasswd.Text != "" && this.txtChangeTo.Text != "")
            {
                if (this.txtPasswd.Text == this.txtChangeTo.Text)
                {
                    if (myLoginInfo.isPasswdSecurity(this.txtChangeTo.Text))
                    {
                        ManageDB myManageDB = new ManageDB();
                        myManageDB.UpdateDB("用户管理", "[passWord]", this.txtChangeTo);
                        TimeDelay myTimeDelay = new TimeDelay();
                        this.btnOK.Enabled     = false;
                        this.btnCancel.Enabled = false;
                        myTimeDelay.restartDelay(3, this.txtStatus, "修改信息:修改成功!", "请重新登录!");
                    }
                    else
                    {
                        this.txtStatus.ForeColor = Color.Red;
                        this.txtStatus.Text      = "修改信息:修改失败!密码为含数字、字母6位以上字符!";
                    }
                }
                else
                {
                    this.txtStatus.ForeColor = Color.Red;
                    this.txtStatus.Text      = "修改信息:修改失败,密码输入不一致!";
                }
            }
            else
            {
                this.txtStatus.ForeColor = Color.Red;
                this.txtStatus.Text      = "修改信息:修改失败,所有项不能为空!";
            }
        }
Пример #16
0
 public List <Mezzo> GetMezzi()
 {
     listMezzi = ManageDB.GetMezzi();
     idMezzo   = ManageDB.GetLastIDMezzo();
     return(listMezzi);
 }
Пример #17
0
 public List <Autista> GetAutisti()
 {
     listAutisti = ManageDB.GetAutisti();
     idAutista   = ManageDB.GetLastIDAutista();
     return(listAutisti);
 }
Пример #18
0
        private void myRegisterFunc()
        {
            ManageDB  myManageDB  = new ManageDB();
            RegexInfo myLoginInfo = new RegexInfo();

            this.txtStatus.ForeColor = Color.Blue;
            this.txtStatus.Text      = "注册信息:注册中...";
            Application.DoEvents();

            if (this.txtUserName.Text != "" && this.txtPasswd.Text != "" && this.txtConfirmPassWD.Text != "" & txtEmailAddress.Text != "" && this.txtUserFullName.Text != "")
            {
                if (myLoginInfo.isUserNameFair(this.txtUserName.Text))
                {
                    if (!myManageDB.checkUserNameDuplicate(this.txtUserName.Text))
                    {
                        if (this.txtPasswd.Text == this.txtConfirmPassWD.Text)
                        {
                            if (myLoginInfo.isPasswdSecurity(this.txtPasswd.Text))
                            {
                                if (myLoginInfo.isMailAddress(this.txtEmailAddress.Text))
                                {
                                    userName     = this.txtUserName.Text;
                                    passwd       = this.txtPasswd.Text;
                                    fullName     = this.txtUserFullName.Text;
                                    emailAddress = this.txtEmailAddress.Text;
                                    verificationReg();
                                    this.Visible = false;
                                    this.Close();
                                    UserAuthentication myAuthentication = new UserAuthentication();
                                    myAuthentication.Show();
                                }
                                else
                                {
                                    this.txtStatus.ForeColor = Color.Red;
                                    this.txtStatus.Text      = "注册信息:注册失败,请正确填写邮箱格式!";
                                }
                            }
                            else
                            {
                                this.txtStatus.ForeColor = Color.Red;
                                this.txtStatus.Text      = "注册信息:注册失败!密码为含数字、字母6-20位以上字符!";
                            }
                        }
                        else if (myManageDB.checkUserNameDuplicate(this.txtUserName.Text))
                        {
                            this.txtStatus.ForeColor = Color.Red;
                            this.txtStatus.Text      = "注册信息:注册失败,密码不一致!";
                        }
                    }
                    else
                    {
                        this.txtStatus.ForeColor = Color.Red;
                        this.txtStatus.Text      = "注册信息:注册失败,用户名已存在!";
                    }
                }
                else
                {
                    this.txtStatus.ForeColor = Color.Red;
                    this.txtStatus.Text      = "注册信息:注册失败,用户名为含数字、字母的6-20位字符!";
                }
            }
            else
            {
                this.txtStatus.ForeColor = Color.Red;
                this.txtStatus.Text      = "注册信息:注册失败,所有项均不能为空!";
            }
        }
Пример #19
0
        private void addDataToDB()
        {
            ManageDB myManageDB = new ManageDB();

            myManageDB.UpdateDB("insert into 用户管理(userName,[passWord],FullName,email,administrator) values ('" + UserRegister.userName + "','" + UserRegister.passwd + "','" + UserRegister.fullName + "','" + UserRegister.emailAddress + "','False')");
        }