using Founder.BLL;
using Founder.Common;
using Founder.Model;
using System;
using System.Data;
using System.Windows.Forms;
namespace Founder.SndBus.CountingSys
{
public partial class FrmLogin : DevComponents.DotNetBar.Office2007Form //Form
{
/// <summary>
/// 收银点钞权限
/// </summary>
static readonly string SY_AUTHORITY_ID = System.Configuration.ConfigurationManager.AppSettings["SY_AUTHORITY_ID"];
/// <summary>
/// 系统名称
/// </summary>
static readonly string SYS_NAME = System.Configuration.ConfigurationManager.AppSettings["SysName"];
/// <summary>
/// 用户权限ID为空
/// </summary>
const string SY_AUTHORITY_ID_NULL = "用户权限ID为空,请联系系统管理员";
private String[] arrLoginResult = { "用户登录成功", "用户不存在", "用户名或密码不正确", "用户没有权限" };
HrStaffBLL hrStaffbll = new HrStaffBLL();
public FrmLogin()
{
InitializeComponent();
this.MaximizeBox = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.ActiveControl = this.txtName;
this.Text = "用户登录";
if (string.IsNullOrEmpty(SY_AUTHORITY_ID))
{
MessageBox.Show(SY_AUTHORITY_ID_NULL, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
//test value
//this.txtName.Text = "100000";
//this.txtPwd.Text = "1";
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(this.txtName.Text.Trim()) || String.IsNullOrEmpty(this.txtPwd.Text.Trim()))
{
//using (var ctx = new OracleDbContext())
//{
// var test = new T_TEST { NAME = "1",VALUE="2" };
// ctx.T_TEST.Add(test);
// ctx.SaveChanges();
//}
//Founder.DAL.SndBusDaoFactory sndFac = new DAL.SndBusDaoFactory();
//Founder.DAL.CASH_COINCENTERDao ccDao = sndFac.GetCASH_COINCENTERDao();
//Founder.Model.CASH_COINCENTER cc = new Founder.Model.CASH_COINCENTER();
//cc.ID="1";
//cc.COINCODE="2";
//cc.BUSNO="3";
//cc.FSDATE="4";
//ccDao.Save(cc);
MessageBox.Show("用户名或密码不能为空");
return;
}
SysUserBLL userBLL = new SysUserBLL();
var ires = userBLL.IsLogin(this.txtName.Text.Trim(), this.txtPwd.Text.Trim(), SY_AUTHORITY_ID);
if (ires == 0)
{
GlobalValue.JobNumber = this.txtName.Text.Trim();
HrStaff hr = hrStaffbll.GetUserInfoByJb(this.txtName.Text.Trim());
GlobalValue.UserName = hr.USERNAME;
this.DialogResult = DialogResult.Yes;
}
else
{
MessageBox.Show(arrLoginResult[ires], "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void FrmLogin_FormClosing(object sender, FormClosingEventArgs e)
{
//this.DialogResult = DialogResult.No;
}
private void txtName_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.txtPwd.Focus();
}
}
private void txtPwd_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.btnLogin.Focus();
}
}
private void button1_Click(object sender, EventArgs e)
{
var sql = "select username from sys_user where ison=:ison";
var para = new { ISON = 1 };
using (IDataReader rd = DapperHelper.ExecuteReader(sql, para))
{
try
{
if (rd.Read())
{
var name = rd["username"].ToString();
rd.Dispose();
rd.Close();
MessageBox.Show(name);
}
}
catch (Exception)
{
throw;
}
}
}
}
}
部署要点:
该目录是微软操作系统预定义的特殊目录,无法直接操作里面的文件,只能通过命令来处理。
启动cmd.exe程序,在窗口中输入以下命令行,每次输入一个命令,回车后复制成功。
copy C:\Windows\assembly\gac_msil\Microsoft.ReportViewer.Common\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.Common.dll D:\ReportViewer
copy C:\Windows\assembly\gac_msil\Microsoft.ReportViewer.WinForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WinForms.DLL D:\ReportViewer
copy C:\Windows\assembly\gac_msil\Microsoft.ReportViewer.ProcessingObjectModel\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.ProcessingObjectModel.DLL D:\ReportViewer
copy C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.Types\11.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Types.dll D:\ReportViewer
【其他的dll复制方式与此类似】
复制到D盘ReportViewer目录后,将其复制到项目的bin\Debug目录,再次运行程序,一切正常。