Beispiel #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(moneyTextBox.Text) > 0)
            {
                DataRow newIncomeLine = userDBDataSet.Tables["UserIncome"].NewRow();
                newIncomeLine["Money"]    = moneyTextBox.Text.Trim();
                newIncomeLine["Datetime"] = datetimeDateTimePicker.Value;
                newIncomeLine["Source"]   = comboBoxSource.Text;
                newIncomeLine["Comments"] = commentsTextBox.Text.Trim();
                newIncomeLine["Type"]     = comboBoxType.Text.Trim();

                try
                {
                    userDBDataSet.Tables["UserIncome"].Rows.Add(newIncomeLine);
                    this.userIncomeTableAdapter.Update(this.userDBDataSet.UserIncome);
                    FormMessageAutoClose fm = new FormMessageAutoClose();
                    fm.setLabel("添加成功返回主界面。");
                    fm.ShowDialog();
                    //this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("请输入数据");
            }
        }
Beispiel #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(moneyTextBox.Text)>0)
              {
            DataRow newIncomeLine = userDBDataSet.Tables["UserIncome"].NewRow();
            newIncomeLine["Money"] = moneyTextBox.Text.Trim();
            newIncomeLine["Datetime"] = datetimeDateTimePicker.Value;
            newIncomeLine["Source"] = comboBoxSource.Text;
            newIncomeLine["Comments"] = commentsTextBox.Text.Trim();
            newIncomeLine["Type"] = comboBoxType.Text.Trim();

            try
            {

                userDBDataSet.Tables["UserIncome"].Rows.Add(newIncomeLine);
                this.userIncomeTableAdapter.Update(this.userDBDataSet.UserIncome);
                FormMessageAutoClose fm = new FormMessageAutoClose();
                fm.setLabel("添加成功返回主界面。");
                fm.ShowDialog();
                //this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
              }
            else
            {
                MessageBox.Show("请输入数据");
            }
        }
Beispiel #3
0
        private void buttonSaveAgain_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(textBoxCost.Text.Trim()) > 0)
            {
            DataRow newCostLine = userDBDataSet.Tables["UserExpense"].NewRow();
            newCostLine["Cost"] = Convert.ToInt32(textBoxCost.Text.Trim());
            newCostLine["Class"] = comboBoxBig.Text.Trim();
            newCostLine["Event"] = comboBoxSmall.Text.Trim();
            newCostLine["Merchant"] = comboBoxShop.Text.Trim();
            newCostLine["CostData"] = dateTimePickerCost.Value;
            newCostLine["Comments"] = textBoxComments.Text.Trim();
            try
            {

                userDBDataSet.Tables["UserExpense"].Rows.Add(newCostLine);
                this.userExpenseTableAdapter.Update(this.userDBDataSet.UserExpense);
                FormMessageAutoClose fm = new FormMessageAutoClose();
                fm.setLabel("添加成功。");
                fm.ShowDialog();
                textBoxCost.Text = "0.00";

                dateTimePickerCost.Value = DateTime.Now;
                textBoxComments.Text = "";

            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            }
            else
            {
            MessageBox.Show("请输入数据");
            }
        }
Beispiel #4
0
        private void buttonOK_Click(object sender, EventArgs e)
        {   
            if (Convert.ToInt32(textBoxCost.Text.Trim())>0)
            {
                DataRow newCostLine = userDBDataSet.Tables["UserExpense"].NewRow();
                newCostLine["Cost"] = Convert.ToInt32(textBoxCost.Text.Trim());
                newCostLine["Class"] = comboBoxBig.Text.Trim();
                newCostLine["Event"] = comboBoxSmall.Text.Trim();
                newCostLine["Merchant"] = comboBoxShop.Text.Trim();
                newCostLine["CostData"] = dateTimePickerCost.Value;
                newCostLine["Comments"] = textBoxComments.Text.Trim();
                try
                {

                    userDBDataSet.Tables["UserExpense"].Rows.Add(newCostLine);
                    this.userExpenseTableAdapter.Update(this.userDBDataSet.UserExpense);
                    FormMessageAutoClose fm = new FormMessageAutoClose();
                    fm.setLabel("添加成功返回主界面。");
                    fm.ShowDialog();
                    //this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            
            } 
            else
            {
                MessageBox.Show("请输入数据");
            }
          
        }
 private void userExpenseBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
     this.Validate();
     this.userExpenseBindingSource.EndEdit();
     this.tableAdapterManager.UpdateAll(this.userDBDataSet);
     this.DialogResult = DialogResult.OK;
     }
     catch (System.Exception ex)
     {
     FormMessageAutoClose fma=new FormMessageAutoClose();
     fma.setLabel("输入数据有误,请检查后重新输入。");
     fma.ShowDialog();
     }
 }
Beispiel #6
0
 private void userExpenseBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         this.Validate();
         this.userExpenseBindingSource.EndEdit();
         this.tableAdapterManager.UpdateAll(this.userDBDataSet);
         this.DialogResult = DialogResult.OK;
     }
     catch (System.Exception ex)
     {
         FormMessageAutoClose fma = new FormMessageAutoClose();
         fma.setLabel("输入数据有误,请检查后重新输入。");
         fma.ShowDialog();
     }
 }
Beispiel #7
0
        private void button_Login_Click(object sender, EventArgs e)
        {
            // string sUserLoginPath = @".\App_Data\userLogin.dll";
            string PassWord = textBox_Password.Text.Trim();

            PassWord += "abc";
            string sPassWordmd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord, "MD5");
            string sPassWordmd5Twice
                = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sPassWordmd5, "MD5");
            //输入密码 两次MD5加密


            string sPassWordmd5Auth = "";

            //sPassWordmd5Auth = File.ReadAllText(sUserLoginPath);
            sPassWordmd5Auth = Properties.Settings.Default.PassWordMd5Twice.ToString();
            // int iPassWordMd5Lenth = Convert.ToInt16(fUserLogin.Length);

            if (sPassWordmd5Auth.Length != 32)
            {
                FormMessageAutoClose fPassWordNoSet = new FormMessageAutoClose();
                fPassWordNoSet.setLabel("密码未设置");
                fPassWordNoSet.ShowDialog();
                Form fReg = new FormRegister();
                fReg.ShowDialog();
            }

            else
            {
                if (sPassWordmd5Auth == sPassWordmd5Twice)
                {
                    FormMessageAutoClose fLoginSuccess = new FormMessageAutoClose();
                    fLoginSuccess.setLabel("登录成功,自动跳转中");
                    fLoginSuccess.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("密码错误");
                    // textBox_UserName.Text = "";
                    textBox_Password.Text = "";
                }
            }
        }
Beispiel #8
0
        private void button_Login_Click(object sender, EventArgs e)
        {
            // string sUserLoginPath = @".\App_Data\userLogin.dll";
            string PassWord = textBox_Password.Text.Trim();
            PassWord += "abc";
            string sPassWordmd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord, "MD5");
            string sPassWordmd5Twice
                = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sPassWordmd5, "MD5");
            //输入密码 两次MD5加密

            string sPassWordmd5Auth = "";
            //sPassWordmd5Auth = File.ReadAllText(sUserLoginPath);
            sPassWordmd5Auth = Properties.Settings.Default.PassWordMd5Twice.ToString();
               // int iPassWordMd5Lenth = Convert.ToInt16(fUserLogin.Length);

            if (sPassWordmd5Auth.Length!=32)
            {
                FormMessageAutoClose fPassWordNoSet = new FormMessageAutoClose();
                fPassWordNoSet.setLabel("密码未设置");
                fPassWordNoSet.ShowDialog();
                Form fReg = new FormRegister();
                fReg.ShowDialog();
            }

            else
            {
                if (sPassWordmd5Auth == sPassWordmd5Twice)
                {
                    FormMessageAutoClose fLoginSuccess = new FormMessageAutoClose();
                    fLoginSuccess.setLabel("登录成功,自动跳转中");
                    fLoginSuccess.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("密码错误");
                    // textBox_UserName.Text = "";
                    textBox_Password.Text = "";
                }
            }
        }
Beispiel #9
0
        private void button_Reg_Click(object sender, EventArgs e)
        {
            //////////////////////////////////////////////////////////////////////////
            string pattern   = @"^[A-Za-z0-9]{6,}$";
            Match  mPassWord = Regex.Match(this.TextBoxNewPassword.Text, pattern);

            //旧密码MD5
            string sOldPassword = textBoxOldPassword.Text.Trim();

            sOldPassword += "abc";

            string sOldPasswordmd5      = FormsAuthentication.HashPasswordForStoringInConfigFile(sOldPassword, "MD5");
            string sOldPasswordmd5Twice = FormsAuthentication.HashPasswordForStoringInConfigFile(sOldPasswordmd5, "MD5");
            //////////////////////////////////////////////////////////////////////////
            //新密码MD5
            string sNewPassWord = TextBoxNewPassword.Text;

            sNewPassWord += "abc";

            string sNewPassWordmd5      = FormsAuthentication.HashPasswordForStoringInConfigFile(sNewPassWord, "MD5");
            string sNewPassWordmd5Twice = FormsAuthentication.HashPasswordForStoringInConfigFile(sNewPassWordmd5, "MD5");
            // string sUserLoginPath = @".\App_Data\userLogin.dll";
            //string sPassWordmd5Auth = File.ReadAllText(sUserLoginPath);
            string sPassWordmd5Auth = Properties.Settings.Default.PassWordMd5Twice.ToString();


            if (sPassWordmd5Auth != sOldPasswordmd5Twice)
            {
                auth.setLabel("原始密码错误请重新输入");
                auth.ShowDialog();
                textBoxOldPassword.Text = "";
                textBoxOldPassword.Focus();
            }
            else
            {
                if (!mPassWord.Success)
                {
                    MessageBox.Show("请重新输入密码 注意只能包含英文大小写和数字");
                    this.TextBoxNewPassword.Text   = "";
                    this.textBoxPasswordCheck.Text = "";
                    this.TextBoxNewPassword.Focus();
                }
                else
                {
                    if (!textBoxPasswordCheck.Text.Equals(TextBoxNewPassword.Text))
                    {
                        MessageBox.Show("密码不一致 请重新输入, GV好赞");
                        this.textBoxPasswordCheck.Text = "";
                        this.TextBoxNewPassword.Text   = "";
                        this.TextBoxNewPassword.Focus();
                    }
                    else
                    {
                        // File.WriteAllText(sUserLoginPath, sNewPassWordmd5Twice);
                        Properties.Settings.Default.PassWordMd5Twice = sNewPassWordmd5Twice;

                        Properties.Settings.Default.Save();
                        MessageBox.Show("密码修改。返回登录界面");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            try
            {
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
                // MessageBox.Show("用户名重复 请更换");
                // TextBox_UserName.Text = "";
                TextBoxNewPassword.Focus();
            }

            finally
            {
            }
        }