/// <summary> /// 新增用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnNew_Click(object sender, RoutedEventArgs e) { try { mStatus = "add"; if (!string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(txtCode.Text)) { if (!getUserInfo(txtCode.Text)) { return; } TB_User user = new TB_User(); user.USER_NAME = this.txtName.Text.Trim(); user.USER_CODE = this.txtCode.Text.Trim(); user.ROLEID = (this.cmbUserRole.SelectedValue as PTS_TABLE_SRC).ID; TB_User tmp = TB_UserDao.FindFirst(new EqExpression("USER_CODE", this.txtCode.Text.Trim())); user.PASSWORD = DES.Encode("111111", Global.DB_PWDKEY); user.DEPT = txtDept.Text; user.Save(); //保存 MessageHelper.ShowMessage("保存成功"); this.txtName.Text = ""; this.txtCode.Text = ""; this.cmbUserRole.SelectedIndex = 0; } mStatus = ""; bindUserData(); } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
public ucMainExprense() { InitializeComponent(); this.dgExpense.ContextMenu = contextMenuLogs; //绑定数据 rdo1.Checked -= rdo1_Checked; rdo2.Checked -= rdo2_Checked; BindDataSource(); rdo1.Checked += rdo1_Checked; rdo2.Checked += rdo2_Checked; rdo1.IsChecked = true; //报销项目需要以当前登录人员参与的项目为数据源 if (Global.g_userrole != 8 && Global.g_userrole != 9) { this.txtUser.Text = Global.g_usercode; this.txtUser.Tag = TB_UserDao.FindFirst(new EqExpression("USER_CODE", Global.g_usercode)); this.txtUser.IsEnabled = false; this.imgDel2.IsEnabled = false; } if (Global.g_userrole == 8 || Global.g_userrole == 9) { this.btnPass.Visibility = System.Windows.Visibility.Visible; } else { this.btnPass.Visibility = System.Windows.Visibility.Hidden; } }
private void bindProjectData() { try { //mProj this.txtOBJECTNAME.Text = mProj.OBJECTNAME; this.txtCONTRACTNO.Text = mProj.CONTRACTNO; this.txtCOMPANYNAME.Text = mProj.COMPANYNAME; this.txtADDRESS.Text = mProj.ADDRESS; this.dtpBeginDate.DateTime = mProj.BEGINDATE; this.dtpEndDate.DateTime = mProj.ENDDATE; if (mProj.OBJECTTYPENAME != null) { setProjIdentity(mProj.OBJECTTYPENAME); } this.txtMoney.Text = mProj.MONEY.ToString(); if (mProj.BILLSTATUS == "已结算") { this.chkBillStatus.IsChecked = true; } if (!string.IsNullOrEmpty(mProj.TEAMLEDER)) { TB_User leader = TB_UserDao.FindFirst(new EqExpression("USER_CODE", mProj.TEAMLEDER)); this.txtleder.Text = leader.USER_NAME; this.txtleder.Tag = leader; } //绑定组员 string menbers = mProj.TEAMMEMBER; if (!string.IsNullOrEmpty(menbers)) { string[] arr = menbers.Split('|'); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { TB_User user = TB_UserDao.FindFirst(new EqExpression("USER_CODE", arr[i])); uc_user uc = new uc_user(user); uc.DelSelectUser += uc_DelSelectUser; this.warp.Children.Add(uc); } } TB_BILL[] arr_bills = TB_BILLDAO.FindAll(new EqExpression("PROJECTID", mProj.Id), new EqExpression("STATUS", 1)); if (arr_bills.Length > 0) { //绑定发票信息 for (int i = 0; i < arr_bills.Length; i++) { uc_bill uc = new uc_bill(arr_bills[i]); uc.DelSelectBill += uc_DelSelectBill; this.warp2.Children.Add(uc); } } this.txtMemo.Text = mProj.MEMO; } } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
/// <summary> /// 查询条件 /// </summary> /// <param name="hs"></param> /// <returns></returns> public static TB_User[] findUserByCondition(Hashtable hs) { try { List <ICriterion> list = new List <ICriterion>(); //List<EqExpression> list = new List<EqExpression>(); //List<LikeExpression> list2 = new List<LikeExpression>(); if (hs.ContainsKey("Name")) { list.Add(new LikeExpression("Name", "%" + hs["Name"] + "%")); } if (hs.ContainsKey("Logid")) { list.Add(new EqExpression("LogName", hs["Logid"])); } if (hs.ContainsKey("role")) { list.Add(new EqExpression("Role", hs["role"])); } if (hs.ContainsKey("Isdeleted")) { list.Add(new EqExpression("Isdeleted", hs["Isdeleted"])); } TB_User[] users = TB_UserDao.FindAll(list.ToArray()); return(users); } catch (Exception ex) { Log.Error(ex.Message); MessageHelper.ShowMessage("E999"); return(null); } }
public ucPersonalRatio(decimal profile1, decimal profile2, TB_RATIO ratio) { InitializeComponent(); labName.Content = TB_UserDao.FindFirst(new EqExpression("USER_CODE", ratio.USERCODE)).USER_NAME; labtc1.Content = profile1; labf.Content = ratio.RATIO; labtc2.Content = Math.Round((profile2 * ratio.RATIO / 10), 2); labtotal.Content = Utils.NvDecimal(labtc2.Content) + profile1; }
public static bool checkPwd(int id, string pwd) { TB_User user = TB_UserDao.FindFirst(new EqExpression("Id", id), new EqExpression("Password", DES.Encode(pwd, Global.DB_PWDKEY))); if (user != null) { return(true); } return(false); }
private void bindUserData() { TB_User[] arr = TB_UserDao.FindAll(new EqExpression("STATUS", 1)); List <TB_User> list = new List <TB_User>(arr); if (arr.Length > 0) { dgUser.ItemsSource = list; //dgUser.SelectedIndex = 0; } }
public ucMainExpense3() { InitializeComponent(); BindDataSource(); if (Global.g_userrole != 8 || Global.g_userrole != 9) { this.txtUser.Text = Global.g_usercode; this.txtUser.Tag = TB_UserDao.FindFirst(new EqExpression("USER_CODE", Global.g_usercode)); this.txtUser.IsEnabled = false; this.imgDel2.IsEnabled = false; } }
public static int isRepeatUserId(string number, int id) { try { TB_User[] user = TB_UserDao.FindAll(new EqExpression("LogName", number), new NotExpression(new EqExpression("Id", id))); return(user.Length); } catch (Exception ex) { MessageHelper.ShowMessage("E999", "保存数据发生错误。"); return(-1); } }
private void BindUserData() { TB_User[] arr = TB_UserDao.FindAll(new EqExpression("STATUS", 1)); List <TB_User> list = new List <TB_User>(arr); if (arr.Length > 0) { list = list.FindAll(a => a.USER_CODE != "财务" && a.USER_CODE != "系统管理员"); dgUser.ItemsSource = list; dgUser.SelectedIndex = 0; } }
public static bool changePwd(int id, string newPwd) { try { TB_User user = TB_UserDao.FindFirst(new EqExpression("Id", id)); user.PASSWORD = DES.Encode(newPwd, Global.DB_PWDKEY); user.Update(); return(true); } catch { return(false); } }
public static TB_User[] getAllSalers() { try { TB_User[] salers = TB_UserDao.FindAll(new Order("Id", true), new EqExpression("Isdeleted", (int)EnmIsdeleted.使用中), new EqExpression("Role", (int)EnmUserRole.销售渠道)); return(salers); } catch (Exception ex) { Log.Error(ex.Message); MessageHelper.ShowMessage("E999", "销售渠道信息获取发生错误。"); return(null); } }
public static TB_User findUserById(int uid) { try { TB_User user = TB_UserDao.FindFirst(new EqExpression("Id", uid)); return(user); } catch (Exception ex) { Log.Error(ex.Message); MessageHelper.ShowMessage("E999"); return(null); } }
private void BindUserData(string str) { TB_User[] arr = TB_UserDao.FindAll(new EqExpression("STATUS", 1), new EqExpression("DEPT", str)); if (!string.IsNullOrEmpty(txtName.Text)) { arr = TB_UserDao.FindAll(new EqExpression("STATUS", 1), new LikeExpression("USER_CODE", "%" + txtName.Text + "%"), new EqExpression("DEPT", str)); } List <TB_User> list = new List <TB_User>(arr); if (arr.Length > 0) { dgUser.ItemsSource = list; dgUser.SelectedIndex = 0; } }
public static TB_User[] getAllSalersAndWrite() { try { Order[] orders = { new Order("Id", true), new Order("Role", true) }; //排序规则 TB_User[] salers = TB_UserDao.FindAll(orders, new EqExpression("Isdeleted", (int)EnmIsdeleted.使用中), new OrExpression(new EqExpression("Role", (int)EnmUserRole.销售渠道), new EqExpression("Role", (int)EnmUserRole.录入人员))); return(salers); } catch (Exception ex) { Log.Error(ex.Message); MessageHelper.ShowMessage("E999", "人员信息获取发生错误。"); return(null); } }
private void btn_Click(object sender, RoutedEventArgs e) { try { string logName = this.txtLogName.Text.Trim(); //用户工号 string pwd = DES.Encode(this.pwd.Password, Global.DB_PWDKEY); //Utils.MD5(txtPwd.Text); string dcodePwd = DES.Decode("G2ZaEl9zO9xeS+77fmGKow==", Global.DB_PWDKEY); TB_User user = TB_UserDao.FindFirst(new EqExpression("USER_CODE", logName), new EqExpression("PASSWORD", pwd), new EqExpression("STATUS", 1)); if (user != null) { Global.g_username = user.USER_NAME; Global.g_userid = user.Id; Global.g_userrole = user.ROLEID; Global.g_usercode = user.USER_CODE; Global.g_password = user.PASSWORD; //已加密 Global.g_dept = user.DEPT; //获取默认提成比例 PTS_OBJECT_TYPE_SRC[] arr = PTS_OBJECT_TYPE_SRCDAO.FindAll(new EqExpression("STATUS", 1)); if (arr.Length > 0) { Global.g_ratio1 = arr[0].RATIO1; Global.g_ratio2 = arr[0].RATIO2; } writeSystemIni(); writeLogName(); this.Cursor = Cursors.Arrow; frmMain Main = new frmMain(); Main.Show(); if (Global.g_userrole == 7 || Global.g_userrole == 8 || Global.g_userrole == 9) { Main.autoAlert(); } this.Close(); } else { this.Cursor = Cursors.Arrow; MessageHelper.ShowMessage("E008"); } } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
/// <summary> /// 查询已结算项目的成员提成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, RoutedEventArgs e) { dgProfile.ItemsSource = null; if (this.txtProj.Tag == null) { MessageHelper.ShowMessage("请选择需要查询的项目"); return; } else { TB_PROJECT proj = this.txtProj.Tag as TB_PROJECT; if (proj.BILLSTATUS == "已结算") { profileporcess pp = new profileporcess(); projProfileClass ppc = pp.getProfile(TB_PROJECTDAO.FindFirst(new EqExpression("Id", proj.Id))); List <TB_PERSONAL_PROFILE> list = pp.personalProcess(ppc, proj.Id); List <TB_PERSONAL_PROFILE> _list = new List <TB_PERSONAL_PROFILE>(); if (txtUser.Tag == null) { _list = list; } else { TB_User user = txtUser.Tag as TB_User; _list = list.FindAll(a => a.USERCODE == user.USER_CODE); } if (_list.Count > 0) { for (int i = 0; i < _list.Count; i++) { _list[i].INDEX = i + 1; _list[i].USERNAME = TB_UserDao.FindFirst(new EqExpression("USER_CODE", _list[i].USERCODE)).USER_NAME; } dgProfile.ItemsSource = list; } } else { MessageHelper.ShowMessage("该项目未结算"); return; } } }
private bool getUserInfo(string usercode) { try { //新增用户工号查重 TB_User _user = TB_UserDao.FindFirst(new EqExpression("STATUS", 1), new EqExpression("USER_CODE", usercode)); if (_user != null) { MessageHelper.ShowMessage("工号重复,请确认!"); this.txtCode.Focus(); return(false); } return(true); } catch (Exception ex) { throw ex; } }
private void txtProj_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { try { if (txtProj.Tag == null) { frmObjectSearch frm = new frmObjectSearch(); frm.ShowDialog(); if (frm.mProj != null && frm.mProj.Id > 0) { this.txtProj.Tag = frm.mProj; this.txtProj.Text = frm.mProj.OBJECTNAME; if (frm.mProj.CREATEUSER == Global.g_usercode || Global.g_userrole == 8 || Global.g_userrole == 9) //登陆者是否是项目的销售(创建者)/总经理/财务 { this.txtUser.IsEnabled = true; this.txtUser.Tag = null; this.txtUser.Text = string.Empty; this.imgDel2.IsEnabled = true; } else { this.txtUser.Text = Global.g_usercode; this.txtUser.Tag = TB_UserDao.FindFirst(new EqExpression("USER_CODE", Global.g_usercode)); this.txtUser.IsEnabled = false; this.imgDel2.IsEnabled = false; } } else { this.txtProj.Tag = null; this.txtProj.Text = ""; } } } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { //判断当前密码的有效性 if (DES.Encode(this.txtpwd.Password, Global.DB_PWDKEY) == Global.g_password) { string newpwd = this.txtnewpwd.Password; string newpwd2 = this.txtnewpwd2.Password; if (newpwd == newpwd2) { if (newpwd.Length < 6) { MessageHelper.ShowMessage("新密码不能少于6位!"); return; } TB_User user = TB_UserDao.FindFirst(new EqExpression("STATUS", 1), new EqExpression("USER_CODE", Global.g_usercode)); if (user != null) { user.PASSWORD = DES.Encode(this.txtnewpwd.Password, Global.DB_PWDKEY); user.Update(); MessageHelper.ShowMessage("密码更新成功!"); Global.g_password = DES.Encode(this.txtnewpwd.Password, Global.DB_PWDKEY); this.Close(); } else { MessageHelper.ShowMessage("当前用户信息已失效,请与管理员确认!"); } } else { MessageHelper.ShowMessage("新密码不一致,请重新确认!"); } } else { MessageHelper.ShowMessage("原密码与登陆密码不一致,请重新输入!"); } }