private void Button_创建_Click(object sender, RoutedEventArgs e) { if (!Validate()) //校验不成功 { return; } List <Model.DataGrid.Model_账套> lm = new List <Model.DataGrid.Model_账套>(); Model.DataGrid.Model_账套 m = new Model.DataGrid.Model_账套(); m.ID = DateTime.Now.ToString("yyyyMMddHHmmss"); CommonInfo.账薄号 = m.ID; CommonInfo.当前期 = Convert.ToInt32(TextBox_期.Text.Trim()); m.账套名称 = TextBox_账套名称.Text.Trim(); m.单位名称 = TextBox_公司.Text.Trim(); m.启用期间 = TextBox_year.Text + "年" + TextBox_期.Text + "期"; m.创建时间 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); m.会计制度 = ComboBox_制度.Text.Trim(); m.制度索引 = ComboBox_制度.SelectedIndex; m.当前期 = Convert.ToInt32(TextBox_期.Text.Trim()); CommonInfo.年 = TextBox_year.Text; CommonInfo.制度索引 = m.制度索引.ToString(); CommonInfo.制表单位 = m.单位名称; lm.Add(m); //修改下次启动时帐套的显示 xw.WriteXML("账套信息", m.账套名称); xw.WriteXML("单位", TextBox_公司.Text.Trim()); //数据创建步骤 //1.创建账套 bool flag1 = new ViewModel_Books().Insert(lm); if (!flag1) { MessageBoxCommon.Show("创建帐套时候发生异常,请联系开发商解决问题!"); return; } //2.为账套新建初始年初数 new ViewModel_年初金额().Insert(m.ID); Model_操作日志 mr = new Model_操作日志(); ViewModel_操作日志 vmr = new ViewModel_操作日志(); mr = vmr.GetOperateLog(); mr.日志 = "创建了账套:" + m.账套名称; vmr.Insert(mr); //调整至主页面 CommonInfo.账套信息 = m.账套名称; MainWindow mw = new MainWindow(); mw.Show(); this.Close(); }
private void Button_PopCommit_Click(object sender, RoutedEventArgs e) { if (ComboBox_用户权限.SelectedIndex == 0) { MessageBoxCommon.Show("请选择用户权限"); ComboBox_用户权限.Focus(); return; } Model_用户 m = SetUserInfo(); bool flag = vm.Update(m); if (flag) { _mr.日志 = "修改用户:" + m.用户名 + "相关信息"; vmr.Insert(_mr); NowClose(this, e); } else { MessageBoxCommon.Show("修改用户失败,请联系管理员!"); } }
private void Button_PopCommit_Click(object sender, RoutedEventArgs e) { if (!Validate()) { return; } Model_用户 m = SetData(); List <Model_用户> lm = new List <Model_用户>(); lm.Add(m); bool flag = vm.Insert(lm); if (flag) { _mr.日志 = "新增用户:" + m.用户名; vmr.Insert(_mr); NowClose(this, e); } else { MessageBoxCommon.Show("添加用户失败!"); } }
private void Button_ChangePassword_Click(object sender, RoutedEventArgs e) { string OldPassword = Secure.TranslatePassword(this.PasswordBox_Old.SecurePassword); string NewPassword = Secure.TranslatePassword(this.PasswordBox_New.SecurePassword); string NewPasswordRepeat = Secure.TranslatePassword(this.PasswordBox_NewRepeat.SecurePassword); string username = PA.Helper.DataDefind.CommonInfo.用户名; bool flag = vm.ValidateAccount(username, OldPassword); //检验旧密码是否一致 if (!flag) { this.Label_密码错误.Visibility = System.Windows.Visibility.Visible; return; } else { this.Label_密码错误.Visibility = Visibility.Collapsed; } if (NewPasswordRepeat.Equals(NewPassword)) { if (vm.UpdatePassword(username, NewPassword)) { this.Label_密码修改成功.Visibility = System.Windows.Visibility.Visible; this.PasswordBox_Old.Clear(); this.PasswordBox_New.Clear(); this.PasswordBox_NewRepeat.Clear(); mrc.日志 = "修改密码"; vmr.Insert(mrc); CommonInfo.登录密码 = NewPassword; } else { MessageBoxCommon.Show("当前尝试修改密码失败,请联系软件开发商!"); } } else { this.Label_新密码不一致.Visibility = System.Windows.Visibility.Visible; return; } }
private void Button_登陆_Click(object sender, RoutedEventArgs e) { if (!vsy.GetRunningFlag()) { TextBlock_登陆警告信息.Text = "出于安全考虑,您无法进入系统,详细请联系开发商!"; #if (!DEBUG) return; #endif } string bookname = ComboBox_账套.Text.ToString(); string id = ComboBox_账套.SelectedValue.ToString(); CommonInfo.账薄号 = id; CommonInfo.账套信息 = bookname; string UserName = TextBox_登陆用户名.Text.Trim(); string Password = Secure.TranslatePassword(PasswordBox_登陆密码.SecurePassword); if (vm.ValidateAccount(UserName, Password)) { Model.DataGrid.Model_用户 m = new Model.DataGrid.Model_用户(); m = vm.GetUserInfo(UserName); CommonInfo.真实姓名 = m.真实姓名; CommonInfo.用户名 = UserName; CommonInfo.用户权限 = m.用户权限; CommonInfo.权限值 = m.权限值; CommonInfo.登录密码 = Password; CommonInfo.制表单位 = xr.ReadXML("单位"); //先记录一些信息 Model_操作日志 mr = new Model_操作日志(); mr = vmr.GetOperateLog(); if (ComboBox_账套.SelectedIndex == 0) { if (m.权限值 >= 2) { Win_账套页面 w = new Win_账套页面(this.Left, this.Top); w.Show(); this.Close(); } else { TextBlock_登陆警告信息.Text = "您的权限不够,无法新建账套!"; return; } } else { CommonInfo.制度索引 = vmb.GetStandardIndex(); CommonInfo.是否初始化年初数 = new ViewModel_年初金额().IsSaved(); CommonInfo.当前期 = vmb.GetPeriod(); CommonInfo.年 = vmb.GetYear(); //这里写日志信息 mr.日志 = "登录了账套:" + bookname; vmr.Insert(mr); xw.WriteXML("账套信息", bookname); MainWindow mw = new MainWindow(); mw.Show(); this.Close(); } } else { TextBlock_登陆警告信息.Text = "账号或密码错误。"; } }
private void Button_生成1_Click(object sender, RoutedEventArgs e) { int value = ComboBox_Date.SelectedIndex; if (value == CommonInfo.当前期 - 1) { MessageBoxCommon.Show("结账后方可生成报表!"); return; } mr.日志 = "生成" + ComboBox_Date.Text + "资产负债表"; vm.Insert(mr); //清除上一次赋值的值 foreach (Model_报表类 m in last_资产负债表) { Label lb = FindName("y" + m.编号) as Label; lb.Content = ""; Label lb2 = FindName("n" + m.编号) as Label; lb2.Content = ""; } List <Model_报表类> list = new List <Model_报表类>(); list = vmr.GetBalanceSheet(value + 1); decimal dy = 0; decimal dn = 0; decimal sumy1 = 0; decimal sumn1 = 0; decimal sumy2 = 0; decimal sumn2 = 0; decimal sumy3 = 0; decimal sumn3 = 0; decimal sumy4 = 0; decimal sumn4 = 0; decimal sumy5 = 0; decimal sumn5 = 0; if (list.Count > 0) { foreach (Model_报表类 m in list) { Label lb = FindName("y" + m.编号) as Label; lb.Content = m.年初数; Label lb2 = FindName("n" + m.编号) as Label; lb2.Content = m.期末数; decimal.TryParse(m.年初数, out dy); decimal.TryParse(m.期末数, out dn); if (m.编号.StartsWith("1")) { sumy1 += dy; sumn1 += dn; } else if (m.编号.StartsWith("2")) { sumy2 += dy; sumn2 += dn; } else if (m.编号.StartsWith("3")) { sumy3 += dy; sumn3 += dn; } else if (m.编号.StartsWith("4")) { sumy4 += dy; sumn4 += dn; } else if (m.编号.StartsWith("5")) { sumy5 += dy; sumn5 += dn; } } //赋值 sumY1.Content = sumy1; sumN1.Content = sumn1; sumY2.Content = sumy2; sumN2.Content = sumn2; sumY3.Content = sumy3; sumN3.Content = sumn3; sumY4.Content = sumy4; sumN4.Content = sumn4; sumY5.Content = sumy5; sumN5.Content = sumn5; totalY1.Content = sumy1 + sumy5; totalN1.Content = sumn1 + sumn5; totalY2.Content = sumy2 + sumy3 + sumy4; totalN2.Content = sumn2 + sumn3 + sumn4; Label_填表人.Content = "填表人:" + CommonInfo.真实姓名; Label_填表日期.Content = "填表日期:" + DateTime.Now.ToLongDateString(); last_资产负债表 = list; } else { for (int i = 0; i < 5; i++) { Label lb = FindName("sumY" + (i + 1)) as Label; lb.Content = ""; Label lb1 = FindName("sumN" + (i + 1)) as Label; lb1.Content = ""; } totalN1.Content = ""; totalN2.Content = ""; totalY1.Content = ""; totalY2.Content = ""; Label_填表日期.Content = "填表日期:"; } }
private void Button_凭证审核_Click(object sender, RoutedEventArgs e) { mr.日志 = "进入凭证审核模块!"; vmr.Insert(mr); OnTabChange(1, 0, "凭证审核"); }