private string GetSysVariable(string Vname) { string returnstr = ""; WX.WXUser cu = WX.Main.CurUser; WX.Flow.Model.Process.MODEL pmodel = WX.Flow.Model.Process.GetModel("select top 1 * from TE_VarDefine where Title='" + Vname + "'"); string name = ""; if (pmodel != null && pmodel.Name.value != null) { name = pmodel.Name.value.ToString(); } switch (name) { case "PRCS_Z_UserName": cu.LoadUserModel(false); returnstr = cu.UserModel.RealName.value.ToString(); break; case "PRCS_Z_UserDuty": cu.LoadDutyUser(); returnstr = cu.DutyUser.Name.value.ToString(); break; case "PRCS_Z_UserDept": cu.LoadUserModel(false); WX.Model.Department.MODEL dept = WX.Model.Department.GetCache(cu.UserModel.DepartmentID.ToInt32()); //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.EmployeeUser.DepartmentID.value.ToString()); returnstr = dept.Name.value.ToString(); break; case "PRCS_Z_UserSupDept": cu.LoadUserModel(false); WX.Model.Department.MODEL dept2 = WX.Model.Department.GetCache(cu.UserModel.DepartmentID.ToInt32()); //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.EmployeeUser.DepartmentID.value.ToString()); dept2 = WX.Model.Department.GetCache(dept2.ParentID.ToInt32()); //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + dept2.ParentID.value.ToString()); returnstr = dept2.Name.value.ToString(); break; case "PRCS_ID": returnstr = Request["id"]; break; case "Datetime_Now": returnstr = DateTime.Now.ToString("yyyy-MM-dd"); break; default: break; } return(returnstr); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Master.A_Edit) { Response.Write("你没有权限访问此功能!"); Response.End(); return; } if (!IsPostBack) { string userId = WX.Request.rUserId; if (!ULCode.Validation.IsGuid(userId)) { ULCode.Debug.we("你无权访问此页面!"); return; } WX.WXUser cu = WX.Request.rCurUser; cu.LoadUserModel(false); this.lblUserId.Text = cu.UserID; this.liUserName.Text = String.Format("员工:{0} 用户名:{1}", cu.UserModel.RealName, cu.UserName); this.lblUserName.Text = cu.UserName; this.lblEmail.Text = cu.AspNetUser.Email; this.lblCreateDate.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}", cu.AspNetUser.CreationDate); this.lblLoginDate.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}", cu.AspNetUser.LastLoginDate); this.lblLastUpdatePwd.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}", cu.AspNetUser.LastPasswordChangedDate); this.lblLastLock.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}", cu.AspNetUser.LastLockoutDate); string sSql = String.Format("Select * from TU_OnlineUsers where UserId='{0}'", userId); bool online = ULCode.QDA.XSql.IsHasRow(sSql); if (online) { this.lblOnlineState.ForeColor = System.Drawing.Color.Gold; this.lblOnlineState.Text = "在线"; } else { this.lblOnlineState.ForeColor = System.Drawing.Color.Gray; this.lblOnlineState.Text = "离线"; } if (cu.AspNetUser.IsLockedOut) { this.lblState.Text = "锁定"; this.lblState.ForeColor = System.Drawing.Color.Red; this.btnLock.Enabled = false; this.btnUnlock.Enabled = true; } else { this.lblState.Text = "正常使用"; this.lblState.ForeColor = System.Drawing.Color.Green; this.btnLock.Enabled = true; this.btnUnlock.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (WX.Main.CurUser.IsEmployeeUser) { this.spanEmployee.Visible = true; //Load UserName this.lblUserName.InnerText = WX.Authentication.GetUserName(); //Load Msg this.LoadPrivateMsg(true); //Load Private State WX.WXUser user = WX.Main.CurUser; WX.Model.Employee.MODEL employee = WX.Model.Employee.GetModelToID(user.UserID); user.LoadUserModel(true); if (employee.IDCard.ToString() == "" || employee.Email.ToString() == "") { Response.Redirect("Private/Priv_EditUser.aspx"); } user.LoadMyDepartment(true); user.LoadDutyDetailUser(true); user.LoadDutyUser(true); user.LoadMyGrade(false); //判断防止第一次进入错误 int grade = 0; if (user.MyGrade != null) { grade = user.DutyDetailUser.GradeID.ToInt32(); //grade = user.MyGrade.Sort.ToInt32(); } grade = user.UserModel.Grade.ToInt32(); string deptName = null; if (user.MyDepartMent != null) { deptName = user.MyDepartMent.Name.ToString(); } string dutyName = null; if (user.DutyUser != null) { dutyName = user.DutyUser.Name.ToString(); } this.lblPrivateState.Text = String.Format("{0},{1},{2}" , deptName, dutyName, WX.Model.Grade.GetModel(grade).Name.ToString() + "(" + grade + ")"); } else { this.lblUserName.InnerText = WX.Authentication.GetUserName(); this.spanEmployee.Visible = false; } } }
private void LoadName() { WX.WXUser user = WX.Main.CurUser; user.LoadUserModel(false); user.LoadEmployeeUser(false); if (user.EmployeeUser.Sex.ToBoolean()) { this.imgFace.ImageUrl = "/Images/User/man_icon.gif"; } else { this.imgFace.ImageUrl = "/Images/User/woman_icon.gif"; } this.lblName.Text = user.UserModel.RealName.ToString(); }
private void LoadDuty() { WX.WXUser user = WX.Main.CurUser; user.LoadUserModel(false); user.LoadMyDepartment(true); user.LoadDutyDetailUser(true); user.LoadDutyUser(true); user.LoadMyGrade(true); int grade = 0; if (user.MyGrade != null) { grade = user.DutyDetailUser.GradeID.ToInt32(); //grade = user.MyGrade.Sort.ToInt32(); } this.lblDutyState.Text = String.Format("等级:{2}级<br />职务:{1}<br />部门:{0}<br /><span><a>[查看][日志]</a></span>" , user.MyDepartMent.Name, user.DutyUser.Name, grade); }
/// <summary> /// 获取单个服务器变量 /// </summary> /// <param name="Vname"></param> /// <returns></returns> private string GetConditionSql_GetSysVariable(string name) { string returnstr = ""; WX.WXUser cu = WX.Public.CurUser; //WX.Flow.Model.Process.MODEL pmodel = WX.Flow.Model.Process.GetModel("select top 1 * from TE_VarDefine where Title='" + Vname + "'"); //string name = ""; //if (pmodel != null && pmodel.Name.value != null) //{ // name = pmodel.Name.value.ToString(); //} switch (name) { case "PRCS_Z_UserName": cu.LoadUserModel(false); returnstr = cu.UserModel.RealName.value.ToString(); break; case "PRCS_Z_UserDuty": cu.LoadDutyUser(); returnstr = cu.DutyUser.Name.value.ToString(); break; case "PRCS_Z_UserDept": cu.LoadEmployeeUser(); cu.LoadMyDepartment(); returnstr = cu.MyDepartMent.Name.ToString(); break; case "PRCS_Z_UserSupDept": cu.LoadEmployeeUser(); cu.LoadMyDepartment(); WX.Model.Department.MODEL dept2 = WX.Model.Department.GetCache(cu.MyDepartMent.ParentID.ToInt32()); //WX.Model.Department.GetModel("select * from TE_Departments where ID=" + cu.MyDepartMent.ParentID.ToString()); returnstr = dept2.Name.value.ToString(); break; case "PRCS_ID": returnstr = Convert.ToInt32(HttpContext.Current.Request.QueryString["Step_Id"]).ToString(); break; case "Datetime_Now": returnstr = DateTime.Now.ToString("yyyy-MM-dd"); break; default: break; } return(returnstr); }