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("请输入数据"); } }
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("请输入数据"); } }
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("请输入数据"); } }
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(); } }
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(); } }
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 = ""; } } }
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 = ""; } } }