/// <summary> /// 对于'不能编辑' 来说 如果返回为false 说明 不能编辑 反正 可以 /// 对于'查看所有' 来说 如果返回为false 说明 不能查看所有 反正 能查看所有 /// </summary> /// <param name="currentUserId"></param> /// <param name="displayName"></param> /// <param name="textName"></param> /// <returns></returns> protected bool NewShowAll_textName(string displayName, string textName) { string sql = ""; if (textName != "不能编辑" && textName != "禁止含税设置") { sql = string.Format(@"declare @result int; set @result=0; select @result=COUNT(*) from role_sys_form left join sys_Object on sys_Object.FormID=role_sys_form.sys_form_Id and sys_Object.roleId=role_sys_form.role_Id and textName='{2}' where role_Id in (select roleId from Role_User where userId={0}) and sys_form_Id in(select formID from sys_form where displayName='{1}') and sys_Object.AutoID is not null; select @result=COUNT(*)-@result from role_sys_form left join sys_Object on sys_Object.FormID=role_sys_form.sys_form_Id and sys_Object.roleId=role_sys_form.role_Id and textName='{2}' where role_Id in (select roleId from Role_User where userId={0}) and sys_form_Id in(select formID from sys_form where displayName='{1}') select @result; ", Session["currentUserId"], displayName, textName); } else { sql = string.Format(@"declare @result int; set @result=0; select @result=COUNT(*) from role_sys_form left join sys_Object on sys_Object.FormID=role_sys_form.sys_form_Id and sys_Object.roleId=role_sys_form.role_Id and textName='{2}' where role_Id in (select roleId from Role_User where userId={0}) and sys_form_Id in(select formID from sys_form where displayName='{1}') and sys_Object.AutoID is not null; select @result; ", Session["currentUserId"], displayName, textName); } if (Convert.ToInt32(DBHelp.ExeScalar(sql)) == 0) { return(false); } return(true); }
public bool FormCheck() { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from TB_AdminDelete where UserId='{0}'", this.ddlUser.SelectedItem.Value))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('该用户已经存在,请重新填写!');</script>"); this.ddlUser.Focus(); return(false); } return(true); }
public bool FormCheck() { if (this.txtRoleCode.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写角色编码!');</script>"); this.txtRoleCode.Focus(); return(false); } if (this.txtRoleName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写角色名称!');</script>"); this.txtRoleName.Focus(); return(false); } if (base.Request["RoleId"] != null) { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_Role where RoleCode='{0}' and RID<>{1}", this.txtRoleCode.Text.Trim(), base.Request["RoleId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('角色编码已经存在,请重新填写!');</script>"); this.txtRoleCode.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_Role where RoleName='{0}' and RID<>{1}", this.txtRoleName.Text.Trim(), base.Request["RoleId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('角色名称已经存在,请重新填写!');</script>"); this.txtRoleName.Focus(); return(false); } } else { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_Role where RoleCode='{0}'", this.txtRoleCode.Text.Trim()))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('角色编码已经存在,请重新填写!');</script>"); this.txtRoleCode.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_Role where RoleName='{0}'", this.txtRoleName.Text.Trim()))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('角色名称已经存在,请重新填写!');</script>"); this.txtRoleName.Focus(); return(false); } } return(true); }
/// <summary> /// 在权限中 有没有 存在没有打钩的权限 /// </summary> /// <param name="displayName">窗体名称</param> /// <param name="textName">权限名称</param> /// <returns></returns> protected bool QuanXian(string displayName, string textName) { string sql = string.Format(@"--存在没有打钩的权限 IF EXISTS(select sys_Object.AutoID from role_sys_form left join sys_Object on sys_Object.FormID=role_sys_form.sys_form_Id and sys_Object.roleId=role_sys_form.role_Id and textName='{2}' where role_Id in (select roleId from Role_User where userId={0}) and sys_form_Id in(select formID from sys_form where displayName='{1}') and sys_Object.AutoID is null) BEGIN SELECT 1 --有 END ELSE BEGIN SELECT 0 --没有 END", Session["currentUserId"], displayName, textName); if (Convert.ToInt32(DBHelp.ExeScalar(sql)) > 0) { return(true); } return(false); }
protected override void OnInit(EventArgs e) { string url = HttpContext.Current.Request.Url.AbsolutePath; if (Session["currentUserId"] != null) { string sql = string.Format(@"DECLARE @FROMID INT; SET @FROMID=0; SELECT @FROMID=FORMID FROM SYS_FORM WHERE ASSEMBLYPATH='{0}' IF(@FROMID<>0) BEGIN SELECT COUNT(*) AS COU FROM ROLE_SYS_FORM WHERE ROLE_ID IN ( SELECT ROLEID FROM ROLE_USER WHERE USERID={1}) AND SYS_FORM_ID=@FROMID END ELSE SELECT -1 AS COU ", url.Substring(1), Session["currentUserId"]); if ((int)DBHelp.ExeScalar(sql) == 0) { base.Response.Redirect("~/WFNull.aspx"); } } //base.OnLoad(e); }
private void GetTodoCount() { string sql = string.Format(" 1=1 and state='执行中'"); string UserId = Session["currentUserId"].ToString(); tb_EFormService eformSer = new tb_EFormService(); int allEForms = eformSer.GetListArray_ToDo_Count(sql, Convert.ToInt32(UserId)); if (allEForms > 0) { lblMessTodo.Text = string.Format("你有 {0} 个文件要审批", allEForms); lblMessTodoOld.Text = string.Format("(原)你有 {0} 个文件要审批", allEForms); imgMess.Visible = true; } else { lblMessTodoOld.Text = ""; lblMessTodo.Text = ""; imgMess.Visible = false; } //查询自己所有正在处理的单据 sql = string.Format("select count(*) from tb_EForm where state='执行中' and appPer={0}", UserId); int zhixingzhongCount = Convert.ToInt32(DBHelp.ExeScalar(sql)); lblDoing.Text = string.Format("你有{0}个申请正在执行中....", zhixingzhongCount); //查询今天 有多少单据审批成功 sql = string.Format(@"select count(*) from tb_EForm left join (select e_id,Max(doTime)AS MaxTime from tb_EForms group by e_id) as newTable on tb_EForm.id=newTable.e_id where state='通过' and appPer={0} and MaxTime between '{1} 00:00:00' and '{1} 23:59:59'", UserId, DateTime.Now.ToShortDateString()); int succsess = Convert.ToInt32(DBHelp.ExeScalar(sql)); lblSuccess.Text = string.Format("今天 你有{0}个申请审批 通过", succsess); //查询今天 有多少单据审批失败 sql = string.Format(@"select count(*) from tb_EForm left join (select e_id,Max(doTime)AS MaxTime from tb_EForms group by e_id) as newTable on tb_EForm.id=newTable.e_id where state='不通过' and appPer={0} and MaxTime between '{1} 00:00:00' and '{1} 23:59:59'", UserId, DateTime.Now.ToShortDateString()); lblFail.Text = string.Format("今天 你有{0}个申请审批 没有通过审核", DBHelp.ExeScalar(sql)); try { //查询今天在销售订单中采购人是我的 所有通过的单子 sql = string.Format(@"select count(*) from tb_EForm left join (select e_id,Max(doTime)AS MaxTime from tb_EForms group by e_id) as newTable on tb_EForm.id=newTable.e_id where state='通过' and MaxTime between '{1} 00:00:00' and '{1} 23:59:59' and tb_EForm.alle_id in (select id from TB_POOrder where caigou='{0}') and proid=(select pro_Id from A_ProInfo where pro_Type='订单报批表')", base.Session["LoginName"].ToString(), DateTime.Now.ToShortDateString()); int count = Convert.ToInt32(DBHelp.ExeScalar(sql)); if (count > 0) { lblCaiSuccess.Text = string.Format("今天 订单审批通过个数: {0} ", count); lblCaiSuccess.Visible = true; } else { lblCaiSuccess.Visible = false; } } catch (Exception) { } try { //查询合同是否要过期 sql = "select count(*) from HR_Person where ContractCloseTime=convert(varchar(50),getdate(),23)"; int count = Convert.ToInt32(DBHelp.ExeScalar(sql)); if (count > 0 && Session["LoginName"] == "李琍") { lblContract.Text = string.Format("今天 合同到期个数: {0} ", count); lblContract.Visible = true; } else { lblContract.Visible = false; } } catch (Exception) { } lbtnX.Text = string.Format("你有{0}条商品已入库需出库", new RuSellReportService().GetCountByAE(Session["LoginName"].ToString())); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (NewShowAll_textName("用户信息", "可记录权限")) { ViewState["ScanSpecGuests"] = true; } else { ViewState["ScanSpecGuests"] = false; } List <Role> roles1 = this.roleSer.getAllRoles(""); roles1.Insert(0, new Role { RoleName = "" }); this.ddlDeptment.DataTextField = "RoleName"; this.ddlDeptment.DataValueField = "RoleName"; this.ddlDeptment.DataSource = roles1; this.ddlDeptment.DataBind(); TB_CompanyService comSer = new TB_CompanyService(); var comList = comSer.GetListArray(""); comList.Insert(0, new VAN_OA.Model.BaseInfo.TB_Company() { ComCode = "", ComName = "" }); ddlCompany.DataSource = comList; ddlCompany.DataBind(); ddlSheBao.DataSource = comList; ddlSheBao.DataBind(); List <Role> roles = new List <Role>(); if (base.Request["UserId"] != null) { this.btnAdd.Visible = false; User user = this.UserSer.getUserByUserId(Convert.ToInt32(base.Request["UserId"])); this.txtNo.Text = user.LoginUserNO; //this.txtAddress.Text = user.LoginAddress; //this.txtCardNo.Text = user.LoginRemark; this.txtCreateTime.Text = user.LoginCreateTime.ToShortDateString(); this.ddlDeptment.Text = user.LoginIPosition; txtPwd.Attributes.Add("Value", user.LoginPwd); lblPwd.Text = user.LoginPwd; this.txtPwd.Text = user.LoginPwd; this.txtTel.Text = user.LoginPhone; this.txtUserid.Text = user.LoginId; this.txtUserName.Text = user.LoginName; this.ddlState.Text = user.LoginStatus; this.ddlSex.Text = user.LoginTmpPwd; ddlCompany.Text = user.CompanyCode; try { ddlSheBao.Text = user.SheBaoCode; } catch (Exception) { } txtZhiwu.Text = user.Zhiwu; cbIsSpecialUser.Checked = user.IsSpecialUser; txtEMail.Text = user.LoginMemo; if (user.ReportTo != 0) { ddlReportTo.Text = user.ReportTo.ToString(); } txtMobile.Text = user.Mobile; txtCardNO.Text = user.CardNO; txtCityNo.Text = user.CityNo; ddlEducation.Text = user.Education; txtSchool.Text = user.School; txtSchoolDate.Text = user.SchoolDate; txtTitle.Text = user.Title; ddlPolitical.Text = user.Political; txtHomeAdd.Text = user.HomeAdd; txtWorkDate.Text = user.WorkDate; roles = this.roleSer.getAllRolesByUseridExAdmin(user.Id); string checkRole = string.Format("select count(*) from Role_User where roleId=1 and UserId=" + Session["currentUserId"].ToString()); bool ifAdmin = Convert.ToInt32(DBHelp.ExeScalar(checkRole)) >= 1 ? true : false; if (ifAdmin) { txtPwd.Enabled = true; } else { txtPwd.Enabled = false; } } else { roles = this.roleSer.getAllRolesByUseridExAdmin(0); this.btnUpdate.Visible = false; } IniData(); this.gvList.DataSource = roles; this.gvList.DataBind(); } }
public bool FormCheck() { if (this.txtUserid.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户账号!');</script>"); this.txtUserid.Focus(); return(false); } if (this.txtUserName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户名称!');</script>"); this.txtUserName.Focus(); return(false); } if (txtPwd.Enabled != false && this.txtPwd.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户密码!');</script>"); this.txtPwd.Focus(); return(false); } if (this.txtZhiwu.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写职务!');</script>"); this.txtZhiwu.Focus(); return(false); } if (this.ddlReportTo.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写所属上级!');</script>"); this.ddlReportTo.Focus(); return(false); } if (this.txtTel.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写电话!');</script>"); this.txtTel.Focus(); return(false); } if (this.txtEMail.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写E-Mail!');</script>"); this.txtEMail.Focus(); return(false); } if (!string.IsNullOrEmpty(txtSchoolDate.Text)) { if (CommHelp.VerifesToDateTime_1(txtSchoolDate.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('毕业时间 格式错误!');</script>"); return(false); } } if (!string.IsNullOrEmpty(txtWorkDate.Text)) { if (CommHelp.VerifesToDateTime_1(txtWorkDate.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('参加工作时间 格式错误!');</script>"); return(false); } } if (!string.IsNullOrEmpty(txtCreateTime.Text)) { if (CommHelp.VerifesToDateTime_1(txtCreateTime.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('建档时间 格式错误!');</script>"); return(false); } } if (base.Request["UserId"] != null) { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginId='{0}' and id <>{1}", this.txtUserid.Text, base.Request["UserId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号" + this.txtUserid.Text + "已存在,请重新填写!');</script>"); this.txtUserid.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginName='{0}' and id <>{1}", this.txtUserName.Text, base.Request["UserId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户名" + this.txtUserName.Text + "已存在,请重新填写!');</script>"); this.txtUserName.Focus(); return(false); } } else { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginId='{0}'", this.txtUserid.Text))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号" + this.txtUserid.Text + "已存在,请重新填写!');</script>"); this.txtUserid.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginName='{0}'", this.txtUserName.Text))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户名" + this.txtUserName.Text + "已存在,请重新填写!');</script>"); this.txtUserName.Focus(); return(false); } } return(true); }