private void btnOK_Click(object sender, EventArgs e) { //Symbol.Forms.SelectedItem<Funds> fundsItem = (Symbol.Forms.SelectedItem<Funds>)cbFundsId.SelectedItem; Symbol.Forms.SelectedItem <ConsumeType> consumeTypeItem = (Symbol.Forms.SelectedItem <ConsumeType>)cbConsumeTypeId.SelectedItem; if (!UIValidtion.Create() .Next(cbConsumeTypeId, p => p.SelectedIndex != -1, p => consumeTypeItem == null ? "" : consumeTypeItem.Text, "消费方式", true) .Next(dtByDate, p => p.Value.HasValue, p => p.Value == null ? "" : p.Value.Value.ToString(p.Format), "日期") .Null(txtMoney, "金额") .NumDec(0) .Null(txtRelatedPerson, "相关人") .Len(1, 10) .Result) { return; } _model = new FundsLog() { UserId = Program.CurrentUser.Id, ByDate = dtByDate.Value.Value, ByDateDay = dtByDate.DayNumber, //FundsId = fundsItem.Value.Id, ConsumeTypeId = consumeTypeItem.Value.Id, Money = Math.Abs(TypeExtensions.Convert <decimal>(txtMoney.Text, 0M)), //LastMoney= fundsItem.Value.Money, RelatedPerson = txtRelatedPerson.Text, Comment = txtComment.Text, IsOut = consumeTypeItem.Value.IsOut, }; Program.DataStore.Add(_model); //Symbol.FastWrapper.Set(_model, "FundsName", fundsItem.Value.Name); FastWrapper.Set(_model, "ConsumeTypeName", consumeTypeItem.Value.Name); DialogResult = System.Windows.Forms.DialogResult.OK; }
void OnOKClick() { if (!UIValidtion.Create() .Null(txtAccount, "帐号") .Len(2, 16) .Null(txtPassword, "密码") .Len(2, 16) .Result) { return; } //User model = Program.DataStore.FindUserByAccount(txtAccount.Text); //if (model == null) { // Symbol.Forms.ProgramHelper.ShowInformation("帐号不存在!"); // txtAccount.Focus(); // return; //} //string md5 = Symbol.Encryption.MD5EncryptionHelper.Encrypt(txtPassword.Text); //if (!string.Equals(md5, model.Password, StringComparison.OrdinalIgnoreCase)) { // Symbol.Forms.ProgramHelper.ShowInformation("密码不正确!"); // txtAccount.Focus(); // return; //} if (!Program.LastMoney.login(txtAccount.Text, txtPassword.Text)) { Symbol.Forms.ProgramHelper.ShowInformation(Program.LastMoney.lastMessage); return; } DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtName, "名称") .Len(2, 10) .My(p => { if (Program.DataStore.ExistsConsumeTypeWithName(p.LastValue, _model.Id)) { p.Return(false) .Msg("此消费方式已经存在!") .LastControl.Focus(); } }) .Null(txtOrder, "顺序") .NumDec() .Result) { return; } _model.Name = txtName.Text; _model.Order = TypeExtensions.Convert <double>(txtOrder.Text, 0D); Program.DataStore.Edit(_model); DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtAccount, "帐号") .Len(2, 16) .My(p => { if (Program.DataStore.ExistsUserWithAccount(p.LastValue)) { p.Return(false) .Msg("此帐号已经存在!") .LastControl.Focus(); } }) .Null(txtPassword, "密码") .Len(6, 16) .Null(txtPassword2, "确认密码") .Len(6, 16) .Eq(txtPassword.Text, "两次密码输入不一样!") .Null(txtName, "姓名") .Len(2, 10) .Result) { return; } _model = Program.DataStore.Register(txtAccount.Text, txtPassword.Text, txtName.Text); _password = txtPassword.Text; Symbol.Forms.ProgramHelper.ShowInformation("帐号注册成功!"); DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtName, "名称") .Len(2, 10) .My(p => { if (Program.DataStore.ExistsConsumeTypeWithName(p.LastValue, 0)) { p.Return(false) .Msg("此消费方式已经存在!") .LastControl.Focus(); } }) .Null(txtOrder, "顺序") .NumDec() .Result) { return; } _model = new ConsumeType() { UserId = Program.CurrentUser.Id, Name = txtName.Text, Order = TypeExtensions.Convert <double>(txtOrder.Text, 0D), IsOut = chkIsOut.Checked, }; Program.DataStore.Add(_model); DialogResult = System.Windows.Forms.DialogResult.OK; }
void OnOKClick() { if (!UIValidtion.Create() .Null(txtAccount, "帐号") .Len(2, 16) .Null(txtPassword, "密码") .Len(6, 16) .Result) { return; } User model = Program.DataStore.FindUserByAccount(txtAccount.Text); if (model == null) { Symbol.Forms.ProgramHelper.ShowInformation("帐号不存在!"); txtAccount.Focus(); return; } string md5 = Symbol.Encryption.MD5EncryptionHelper.Encrypt(txtPassword.Text); if (!string.Equals(md5, model.Password, StringComparison.OrdinalIgnoreCase)) { Symbol.Forms.ProgramHelper.ShowInformation("密码不正确!"); txtAccount.Focus(); return; } Program.CurrentUser = model; if (chkIsRemember.Checked) { Program.Config.Account = txtAccount.Text; Program.Config.Password = txtPassword.Text; Program.Config.IsRemember = true; Program.Config.IsAutoLogin = chkIsAutoLogin.Checked; } else { Program.Config.Account = ""; Program.Config.Password = ""; Program.Config.IsRemember = false; Program.Config.IsAutoLogin = false; } Program.SaveConfig(); DialogResult = System.Windows.Forms.DialogResult.OK; }
void OnGoClick() { if (!UIValidtion.Create() .Null(txtPageGo, "页码") .NumInt(1, _pageMax) .Result) { return; } int value; if (!int.TryParse(txtPageGo.Text, out value)) { return; } _page = value - 1; OnQueryClick(); }
void OnOKClick() { if (!UIValidtion.Create() .Null(txtYear, "年份") .NumInt(2010, System.DateTime.Today.Year) .Result) { return; } _chart = new XYChart(pictureBox1.Width, pictureBox1.Height, new System.Drawing.Font("宋体", 9F)); _chart.NumberFont = new System.Drawing.Font("宋体", 9F); _chart.NewLine("收入", System.Drawing.Color.ForestGreen); _chart.NewLine("支出", System.Drawing.Color.DarkRed); //lines[0].Points.Add(new LinePoint(){ X string xLabelNames = "零一二三四五六七八九十"; int year = int.Parse(txtYear.Text); decimal totalInMoney = 0M; decimal totalOutMoney = 0M; for (int i = 1; i < 13; i++) { decimal inMoney = Program.DataStore.GetTotalMoneyByMonth(year, i, false); decimal outMoney = Program.DataStore.GetTotalMoneyByMonth(year, i, true); _chart.Lines[0].AddPoint(i, inMoney); _chart.Lines[1].AddPoint(i, outMoney); string xLabelName = ""; if (i > 10) { xLabelName = "十" + xLabelNames[i - 10] + "月"; } else { xLabelName = xLabelNames[i] + "月"; } _chart.AddXLabel(i, xLabelName); totalInMoney += inMoney; totalOutMoney += outMoney; } _chart.Lines[0].Value = totalInMoney.ToString("#,###.##"); _chart.Lines[1].Value = totalOutMoney.ToString("#,###.##"); Render(); }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtName, "名称") .Len(2, 16) .My(p => { if (Symbol.TypeExtensions.Convert <int>(Program.DataContext.ExecuteScalar("select top 1 [Id] from [Funds] where [UserId]=@p1 and [Name]=@p2", Program.CurrentUser.Id, p.LastValue), 0) > 0) { p.Return(false) .Msg("此资金库已经存在!") .LastControl.Focus(); } }) .Null(txtMoney, "余额") .NumDec() .Null(txtOrder, "顺序") .NumDec() .Null(txtBankName, "银行", chkIsBank.Checked) .Len(2, 16) .Null(txtCardNumber, "卡号", chkIsBank.Checked) .Len(2, 32) .Result) { return; } _model = new Funds() { UserId = Program.CurrentUser.Id, Name = txtName.Text, Money = Symbol.TypeExtensions.Convert <decimal>(txtMoney.Text, 0M), Order = Symbol.TypeExtensions.Convert <double>(txtOrder.Text, 0D), IsBank = chkIsBank.Checked, BankName = txtBankName.Text, CardNumber = txtCardNumber.Text, }; using (InsertCommandBuilder builder = new InsertCommandBuilder("Funds")) { builder.Fields.SetValues(_model); builder.Fields.Remove("Id"); _model.Id = Symbol.TypeExtensions.Convert <int>(Program.DataContext.ExecuteScalar(builder.CommandText, builder.Values), 0); } DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Next(dtByDate, p => p.Value.HasValue, p => p.Value == null?"":p.Value.Value.ToString(p.Format), "日期") .Null(txtMoney, "金额") .NumDec(0) .Null(txtRelatedPerson, "相关人") .Len(1, 10) .Result) { return; } _model.RelatedPerson = txtRelatedPerson.Text; _model.ByDate = dtByDate.Value.Value; _model.ByDateDay = dtByDate.DayNumber; _model.Money = Math.Abs(TypeExtensions.Convert <decimal>(txtMoney.Text, 0M)); _model.Comment = txtComment.Text; Program.DataStore.Edit(_model); DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtOldPassword, "旧密码") .Len(6, 16) .My(p => { string md5 = Symbol.Encryption.MD5EncryptionHelper.Encrypt(p.LastValue); if (!string.Equals(md5, Program.CurrentUser.Password)) { p.Return(false).Msg("旧密码不正确!").LastControl.Focus(); } }) .Null(txtPassword, "密码") .Len(6, 16) .Null(txtPassword2, "确认密码") .Len(6, 16) .Eq(txtPassword.Text, "两次密码输入不一样!") .Result) { return; } string newPassword = txtPassword.Text; string newPasswordMd5 = Symbol.Encryption.MD5EncryptionHelper.Encrypt(newPassword); _password = newPassword; Program.DataStore.ChangePassword(Program.CurrentUser.Account, newPassword); Program.CurrentUser.Password = newPasswordMd5; if (Program.Config.IsRemember && !string.IsNullOrEmpty(Program.Config.Password)) { Program.Config.Password = newPassword; Program.SaveConfig(); } Symbol.Forms.ProgramHelper.ShowInformation("密码修改成功!"); DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!UIValidtion.Create() .Null(txtAccount, "手机") .Len(11, 11) .My(p => { if (Program.LastMoney.user_exists(new { telephone = p.LastValue })) { p.Return(false) .Msg("此手机已注册!") .LastControl.Focus(); } }) .Null(txtPassword, "密码") .Len(6, 16) .Null(txtPassword2, "确认密码") .Len(6, 16) .Eq(txtPassword.Text, "两次密码输入不一样!") .Null(txtName, "姓名") .Len(2, 10) .Result) { return; } bool ok = Program.LastMoney.register(new { telephone = txtAccount.Text, password = txtPassword.Text, nickName = txtName.Text, type = "User", }); _telephone = txtAccount.Text; _password = txtPassword.Text; Symbol.Forms.ProgramHelper.ShowInformation("帐号注册成功!"); DialogResult = System.Windows.Forms.DialogResult.OK; }