public FrmProduceProductDialog(BaseUserTable user) { InitializeComponent(); _userInfo = user; }
public MachineReceive(string aFileName, string fileType, string sheet, Hashtable _filedsHt, BaseUserTable userInfo) : base(aFileName, fileType, sheet, _filedsHt, userInfo) { }
public SafetyStockReceive(bool anAutoMode, string aFileName, string fileType, string sheet, Hashtable _filedsHt, BaseUserTable userInfo) : base(anAutoMode, aFileName, fileType, sheet, _filedsHt, userInfo) { }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(BaseUserTable model) { StringBuilder strSql = null; int rows = 0; if (Exists(model.CODE, model.COMPANY_CODE)) { strSql = new StringBuilder(); strSql.Append("update BASE_USER set "); strSql.Append("PASSWORD=@PASSWORD,"); strSql.Append("NAME=@NAME,"); strSql.Append("PHONE=@PHONE,"); strSql.Append("EMAIL=@EMAIL,"); strSql.Append("DEPARTMENT_CODE=@DEPARTMENT_CODE,"); strSql.Append("ROLES_CODE=@ROLES_CODE,"); strSql.Append("PHOTO=@PHOTO,"); strSql.Append("STATUS_FLAG=@STATUS_FLAG,"); strSql.Append("LAST_UPDATE_USER=@LAST_UPDATE_USER,"); strSql.Append("LAST_UPDATE_TIME=GETDATE(), "); strSql.Append("INT_COMMUNITY_DATE=@INT_COMMUNITY_DATE, "); strSql.Append("OUT_COMMUNITY_DATE=@OUT_COMMUNITY_DATE,"); strSql.Append("LEVEL=@LEVEL"); strSql.Append(" where CODE=@CODE and COMPANY_CODE=@COMPANY_CODE "); SqlParameter[] parameters = { new SqlParameter("@CODE", SqlDbType.VarChar, 20), new SqlParameter("@PASSWORD", SqlDbType.VarChar, 50), new SqlParameter("@NAME", SqlDbType.NVarChar, 50), new SqlParameter("@PHONE", SqlDbType.VarChar, 20), new SqlParameter("@EMAIL", SqlDbType.VarChar, 100), new SqlParameter("@DEPARTMENT_CODE", SqlDbType.VarChar, 20), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 20), new SqlParameter("@ROLES_CODE", SqlDbType.VarChar, 20), new SqlParameter("@PHOTO", SqlDbType.Image, 16), new SqlParameter("@STATUS_FLAG", SqlDbType.Int, 4), new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@INT_COMMUNITY_DATE", SqlDbType.DateTime), new SqlParameter("@OUT_COMMUNITY_DATE", SqlDbType.DateTime), new SqlParameter("@LEVEL", SqlDbType.Int, 8) }; parameters[0].Value = model.CODE; parameters[1].Value = model.PASSWORD; parameters[2].Value = model.NAME; parameters[3].Value = model.PHONE; parameters[4].Value = model.EMAIL; parameters[5].Value = model.DEPARTMENT_CODE; parameters[6].Value = model.COMPANY_CODE; parameters[7].Value = model.ROLES_CODE; parameters[8].Value = model.PHOTO; parameters[9].Value = CConstant.NORMAL; parameters[10].Value = model.LAST_UPDATE_USER; parameters[11].Value = model.INT_COMMUNITY_DATE; parameters[12].Value = model.OUT_COMMUNITY_DATE; parameters[13].Value = model.LEVEL; rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); } else { strSql = new StringBuilder(); strSql.Append("insert into BASE_USER("); strSql.Append("CODE,PASSWORD,NAME,PHONE,EMAIL,DEPARTMENT_CODE,COMPANY_CODE,ROLES_CODE,PHOTO,STATUS_FLAG,CREATE_USER,CREATE_DATE,LAST_UPDATE_USER,LAST_UPDATE_TIME,INT_COMMUNITY_DATE,OUT_COMMUNITY_DATE,LEVEL)"); strSql.Append(" values ("); strSql.Append("@CODE,@PASSWORD,@NAME,@PHONE,@EMAIL,@DEPARTMENT_CODE,@COMPANY_CODE,@ROLES_CODE,@PHOTO,@STATUS_FLAG,@CREATE_USER,GETDATE(),@LAST_UPDATE_USER,GETDATE(),@INT_COMMUNITY_DATE,@OUT_COMMUNITY_DATE,@LEVEL)"); SqlParameter[] parameters = { new SqlParameter("@CODE", SqlDbType.VarChar, 20), new SqlParameter("@PASSWORD", SqlDbType.VarChar, 50), new SqlParameter("@NAME", SqlDbType.NVarChar, 50), new SqlParameter("@PHONE", SqlDbType.VarChar, 20), new SqlParameter("@EMAIL", SqlDbType.VarChar, 100), new SqlParameter("@DEPARTMENT_CODE", SqlDbType.VarChar, 20), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 20), new SqlParameter("@ROLES_CODE", SqlDbType.VarChar, 20), new SqlParameter("@PHOTO", SqlDbType.Image, 16), new SqlParameter("@STATUS_FLAG", SqlDbType.Int, 4), new SqlParameter("@CREATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@INT_COMMUNITY_DATE", SqlDbType.DateTime), new SqlParameter("@OUT_COMMUNITY_DATE", SqlDbType.DateTime), new SqlParameter("@LEVEL", SqlDbType.Int, 8) }; parameters[0].Value = model.CODE; parameters[1].Value = model.PASSWORD; parameters[2].Value = model.NAME; parameters[3].Value = model.PHONE; parameters[4].Value = model.EMAIL; parameters[5].Value = model.DEPARTMENT_CODE; parameters[6].Value = model.COMPANY_CODE; parameters[7].Value = model.ROLES_CODE; parameters[8].Value = model.PHOTO; parameters[9].Value = model.STATUS_FLAG; parameters[10].Value = model.CREATE_USER; parameters[11].Value = model.LAST_UPDATE_USER; parameters[12].Value = model.INT_COMMUNITY_DATE; parameters[13].Value = model.OUT_COMMUNITY_DATE; parameters[14].Value = model.LEVEL; rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }
public CustomerReportedReceive(bool anAutoMode, string aFileName, string fileType, string sheet, Hashtable _filedsHt, BaseUserTable userInfo) : base(anAutoMode, aFileName, fileType, sheet, _filedsHt, userInfo) { }
public SpecificationReceive(string aFileName, string fileType, string sheet, Hashtable _filedsHt, BaseUserTable userInfo) : base(aFileName, fileType, sheet, _filedsHt, userInfo) { }
/// <summary> /// 得到一个对象实体 /// </summary> public BaseUserTable GetModel(string CODE, string COMPANY_CODE) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CODE,PASSWORD,NAME,PHONE,EMAIL,DEPARTMENT_CODE,COMPANY_CODE,ROLES_CODE,PHOTO,STATUS_FLAG,CREATE_USER,CREATE_DATE,LAST_UPDATE_USER,LAST_UPDATE_TIME,DEPARTMENT_NAME,COMPANY_NAME,ROLES_NAME,INT_COMMUNITY_DATE,OUT_COMMUNITY_DATE,LEVEL,DEFAULTINFO from base_user_view "); strSql.Append(" where CODE=@CODE and COMPANY_CODE=@COMPANY_CODE "); strSql.AppendFormat(" and STATUS_FLAG <> {0}", CConstant.DELETE); SqlParameter[] parameters = { new SqlParameter("@CODE", SqlDbType.VarChar, 50), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 50) }; parameters[0].Value = CODE; parameters[1].Value = COMPANY_CODE; BaseUserTable model = new BaseUserTable(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.CODE = ds.Tables[0].Rows[0]["CODE"].ToString(); model.PASSWORD = ds.Tables[0].Rows[0]["PASSWORD"].ToString(); model.NAME = ds.Tables[0].Rows[0]["NAME"].ToString(); model.PHONE = ds.Tables[0].Rows[0]["PHONE"].ToString(); model.EMAIL = ds.Tables[0].Rows[0]["EMAIL"].ToString(); model.DEPARTMENT_CODE = ds.Tables[0].Rows[0]["DEPARTMENT_CODE"].ToString(); model.COMPANY_CODE = ds.Tables[0].Rows[0]["COMPANY_CODE"].ToString(); model.ROLES_CODE = ds.Tables[0].Rows[0]["ROLES_CODE"].ToString(); if (ds.Tables[0].Rows[0]["INT_COMMUNITY_DATE"].ToString() != "") { model.INT_COMMUNITY_DATE = CConvert.ToDateTime(ds.Tables[0].Rows[0]["INT_COMMUNITY_DATE"].ToString()); } if (ds.Tables[0].Rows[0]["OUT_COMMUNITY_DATE"].ToString() != "") { model.OUT_COMMUNITY_DATE = CConvert.ToDateTime(ds.Tables[0].Rows[0]["OUT_COMMUNITY_DATE"].ToString()); } if (ds.Tables[0].Rows[0]["PHOTO"].ToString() != "") { model.PHOTO = (byte[])ds.Tables[0].Rows[0]["PHOTO"]; } if (ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString() != "") { model.STATUS_FLAG = CConvert.ToInt32(ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString()); } model.CREATE_USER = ds.Tables[0].Rows[0]["CREATE_USER"].ToString(); if (ds.Tables[0].Rows[0]["CREATE_DATE"].ToString() != "") { model.CREATE_DATE = CConvert.ToDateTime(ds.Tables[0].Rows[0]["CREATE_DATE"].ToString()); } model.LAST_UPDATE_USER = ds.Tables[0].Rows[0]["LAST_UPDATE_USER"].ToString(); if (ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString() != "") { model.LAST_UPDATE_TIME = CConvert.ToDateTime(ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString()); } model.DEPARTMENT_NAME = ds.Tables[0].Rows[0]["DEPARTMENT_NAME"].ToString(); model.COMPANY_NAME = ds.Tables[0].Rows[0]["COMPANY_NAME"].ToString(); model.ROLES_NAME = ds.Tables[0].Rows[0]["ROLES_NAME"].ToString(); model.LEVEL = CConvert.ToInt32(ds.Tables[0].Rows[0]["LEVEL"].ToString()); if (ds.Tables[0].Rows[0]["DEFAULTINFO"].ToString() != "") { model.INFO = ds.Tables[0].Rows[0]["DEFAULTINFO"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(BaseUserTable model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BaseUserTable model) { return(dal.Update(model)); }
public override string[] doUpdateDB() { BaseUserTable UserTable = null; BUser bUser = new BUser(); StringBuilder strError = new StringBuilder(); int successData = 0; int failureData = 0; string errorFilePath = ""; string backupFilePath = ""; //数据导入处理 foreach (DataRow dr in _csvDataTable.Rows) { StringBuilder str = new StringBuilder(); //编号 if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "CODE")))) { str.Append(CheckString(GetValue(dr, "CODE"), 18, "编号")); } else { str.Append("编号不能为空!"); } //名称 str.Append(CheckLenght(GetValue(dr, "NAME"), 100, "名称")); //密码 if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "PASSWORD")))) { str.Append(CheckString(GetValue(dr, "PASSWORD"), 50, "密码")); } //电话 str.Append(CheckLenght(GetValue(dr, "PHONE"), 20, "电话")); //邮箱 str.Append(CheckLenght(GetValue(dr, "EMIAL"), 50, "邮箱")); if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "DEPARTMENT_CODE")))) { str.Append(CheckDepartment(CConvert.ToString(GetValue(dr, "DEPARTMENT_CODE")), "部门")); } str.Append(CheckCompany(CConvert.ToString(GetValue(dr, "COMPANY_CODE")), "公司")); if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "ROLES_CODE")))) { str.Append(CheckRoles(CConvert.ToString(GetValue(dr, "ROLES_CODE")), "角色")); } //状态 str.Append(CheckInt(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL), 9, "状态")); if (str.ToString().Trim().Length > 0) { strError.Append(GetStringBuilder(dr, str.ToString().Trim())); failureData++; continue; } try { UserTable = new BaseUserTable(); UserTable.CODE = CConvert.ToString(GetValue(dr, "COMPANY_CODE")) + CConvert.ToString(GetValue(dr, "CODE")); UserTable.NAME = CConvert.ToString(GetValue(dr, "NAME")); UserTable.PASSWORD = CConvert.ToString(GetValue(dr, "PASSWORD")); UserTable.PHONE = CConvert.ToString(GetValue(dr, "PHONE")); UserTable.EMAIL = CConvert.ToString(GetValue(dr, "EMAIL")); UserTable.DEPARTMENT_CODE = CConvert.ToString(GetValue(dr, "DEPARTMENT_CODE")); UserTable.COMPANY_CODE = CConvert.ToString(GetValue(dr, "COMPANY_CODE")); UserTable.ROLES_CODE = CConvert.ToString(GetValue(dr, "ROLES_CODE")); UserTable.CREATE_USER = _userInfo.CODE; UserTable.LAST_UPDATE_USER = _userInfo.CODE; UserTable.STATUS_FLAG = CConvert.ToInt32(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL)); if (!bUser.Exists(UserTable.CODE, UserTable.COMPANY_CODE)) { bUser.Add(UserTable); } else { bUser.Update(UserTable); } successData++; } catch { strError.Append(GetStringBuilder(dr, " 数据导入失败,请与系统管理员联系!").ToString()); failureData++; } } //错误记录处理 if (strError.Length > 0) { errorFilePath = WriteFile(strError.ToString()); } //备份处理 backupFilePath = BackupFile(); return(new string[] { successData.ToString(), failureData.ToString(), errorFilePath, backupFilePath }); }
public FrmMain(BaseUserTable userTable) { InitializeComponent(); _userInfo = userTable; }
//构造函数 public AbstractReceive(string aFileName, string aFileType, string aSheet, Hashtable aFiledsHt, BaseUserTable userInfo) { this._autoMode = false; this._fileName = aFileName; this._fileType = aFileType; this._sheet = aSheet; this._filedsHt = aFiledsHt; this._csvDataTable = new DataTable(); this._userInfo = userInfo; }
public FrmSpecificationDialog(BaseUserTable user) { InitializeComponent(); _userInfo = user; }
public MasterMachineReceive(bool anAutoMode, string aFileName, string fileType, string sheet, Hashtable _filedsHt, BaseUserTable userInfo) : base(anAutoMode, aFileName, fileType, sheet, _filedsHt, userInfo) { }
/// <summary> /// 登录验证 /// </summary> private void login() { this.Cursor = Cursors.WaitCursor; string strErrorlog = string.Empty; string _errorLog = string.Empty; try { BUser buser = new BUser(); BaseUserTable tuser = new BaseUserTable(); if (string.IsNullOrEmpty(this.txtLoginUserCode.Text.Trim())) { strErrorlog = "登录名不能为空!"; this.txtLoginUserCode.Focus(); this.txtLoginUserCode.Select(); MessageBox.Show(strErrorlog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Cursor = Cursors.Default; return; } tuser = buser.GetModel(CConvert.ToString(cboCompany.SelectedValue) + this.txtLoginUserCode.Text.Trim(), CConvert.ToString(cboCompany.SelectedValue)); //用户名验证 if (null == tuser) { strErrorlog = "登录名不存在或密码错误!"; _errorLog = "登录名不存在!"; this.txtLoginUserCode.Focus(); } //公司验证 else if (tuser.COMPANY_CODE != CConvert.ToString(cboCompany.SelectedValue)) { strErrorlog = "登录名不存在或密码错误!"; _errorLog = "公司与登录名不符合!"; this.txtLoginUserCode.Focus(); } else { //密码验证 if (DESEncrypt.Encrypt(this.txtLoginPassword.Text.Trim()) != tuser.PASSWORD) { strErrorlog = "登录名不存在或密码错误!"; _errorLog = "密码错误!"; this.txtLoginPassword.Focus(); } } if (!string.IsNullOrEmpty(strErrorlog)) { MessageBox.Show(strErrorlog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); strErrorlog += " " + this.txtLoginUserCode.Text.Trim(); } else { if (null != _mainWin) { _mainWin.Die(); if (_mainWin.IsHandleCreated) { this.Hide(); return; } } FrmMain mainForm = new FrmMain(tuser); this.Hide(); mainForm.Show(); _mainWin = mainForm; _errorLog = "登录成功!"; } //new BBaseLogs().Info(UserConstants.LOG_MODE_LOGIN, strErrorlog, tuser.USERID); } catch (Exception err) { MessageBox.Show(err.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // Logger.Error("数据库连接失败!", err); this.Cursor = Cursors.Default; ShowDBConfig(); } this.Cursor = Cursors.Default; }
public bool UpdateDefault(BaseUserTable model) { return(dal.UpdateDefault(model)); }