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="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 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); }
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 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); } }
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); } }
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); } }
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; } }
/// <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 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("原密码与登陆密码不一致,请重新输入!"); } }