Пример #1
0
        /// <summary>
        /// 查看是否有权限
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="XreqestStr">小类</param>
        /// <param name="BreqestStr">大类</param>
        /// <returns>true有权限</returns>
        public static bool IfHasPrimision(string userID, string XreqestStr, string BreqestStr, bool IfRead)
        {
            string tmpUid = string.Empty;
            string tmpBid = string.Empty;
            string tmpDid = string.Empty;
            string tmpJid = string.Empty;

            Tunnel.BLL.Tunnel_menber          tm     = new Tunnel_menber();
            Tunnel.Model.Tunnel_menber        tmm    = new Tunnel.Model.Tunnel_menber();
            List <Tunnel.Model.Tunnel_menber> tmlist = new List <Tunnel.Model.Tunnel_menber>();

            Tunnel.BLL.Tunnel_jiaose   tj  = new Tunnel_jiaose();
            Tunnel.Model.Tunnel_jiaose tjj = new Tunnel.Model.Tunnel_jiaose();


            Tunnel.BLL.Tunnel_quanxian          qx     = new Tunnel_quanxian();
            Tunnel.Model.Tunnel_quanxian        qxx    = new Tunnel.Model.Tunnel_quanxian();
            List <Tunnel.Model.Tunnel_quanxian> qxlist = new List <Tunnel.Model.Tunnel_quanxian>();

            Tunnel.BLL.Tunnel_yingshe          tyj     = new Tunnel_yingshe();
            Tunnel.Model.Tunnel_yingshe        tyjj    = new Tunnel.Model.Tunnel_yingshe();
            List <Tunnel.Model.Tunnel_yingshe> tyjlist = new List <Tunnel.Model.Tunnel_yingshe>();

            Tunnel.BLL.Tunnel_uyingshe          tyu     = new Tunnel_uyingshe();
            Tunnel.Model.Tunnel_uyingshe        tyuu    = new Tunnel.Model.Tunnel_uyingshe();
            List <Tunnel.Model.Tunnel_uyingshe> tyulist = new List <Tunnel.Model.Tunnel_uyingshe>();

            Tunnel.BLL.Tunnel_byingshe          tyb     = new Tunnel_byingshe();
            Tunnel.Model.Tunnel_byingshe        tybb    = new Tunnel.Model.Tunnel_byingshe();
            List <Tunnel.Model.Tunnel_byingshe> tyblist = new List <Tunnel.Model.Tunnel_byingshe>();

            Tunnel.BLL.Tunnel_dyingshe          tyd     = new Tunnel_dyingshe();
            Tunnel.Model.Tunnel_dyingshe        tydd    = new Tunnel.Model.Tunnel_dyingshe();
            List <Tunnel.Model.Tunnel_dyingshe> tydlist = new List <Tunnel.Model.Tunnel_dyingshe>();

            UserLogin ul    = new UserLogin();
            bool      b     = false;
            string    qxStr = string.Empty;

            tmm    = tm.GetModel(Convert.ToInt64(userID));
            tmpBid = tmm.m_bum.ToString();
            tmpJid = tmm.m_jiao.ToString();
            tmpDid = tmm.m_duty.ToString();
            tmpUid = userID;

            tyulist = tyu.GetModelList("uy_uid='" + tmpUid + "'");

            if (tyulist.Count > 0)
            {
                if (tyulist[0].uy_list.Length > 0)
                {
                    qxStr += tyulist[0].uy_list + "|";
                }
            }

            tyjlist = tyj.GetModelList("y_jsid=" + tmpJid + "");

            if (tyjlist.Count > 0)
            {
                if (tyjlist[0].y_qxlist.Length > 0)
                {
                    qxStr += tyjlist[0].y_qxlist + "|";
                }
            }

            tyblist = tyb.GetModelList("by_bid='" + tmpBid + "'");

            if (tyblist.Count > 0)
            {
                if (tyblist[0].by_list.Length > 0)
                {
                    qxStr += tyblist[0].by_list + "|";
                }
            }


            tydlist = tyd.GetModelList("dy_did='" + tmpDid + "'");
            if (tydlist.Count > 0)
            {
                if (tydlist[0].dy_list.Length > 0)
                {
                    qxStr += tydlist[0].dy_list + "|";
                }
            }


            if (qxStr.Length > 0)
            {
                qxStr = qxStr.Substring(0, qxStr.Length - 1);
            }
            if (userID != "1" && ul.JiaoSe(int.Parse(userID)) != "系统管理员")
            {
                if (IfRead)
                {
                    if (tmpJid != "0")
                    {
                        if (ul.JiaoSe(int.Parse(userID)) == "总经理")
                        {
                            b = true;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(qxStr))
                {
                    qxlist = qx.GetModelList("q_name='" + XreqestStr + "' and q_mark='" + BreqestStr + "'");
                    if (qxlist.Count > 0)
                    {
                        foreach (string item in qxStr.Split('|'))
                        {
                            if (qxlist[0].q_id.ToString().Equals(item.ToString()))
                            {
                                b = true;
                            }
                        }
                    }
                }
            }
            else
            {
                b = true;
            }
            return(b);
        }
Пример #2
0
        /// <summary>
        /// 智能表单宏控件单行输入框处理
        /// </summary>
        /// <param name="datafld">类型</param>
        /// <returns>结果</returns>
        private string getDataTag(string datafld)
        {
            string Tag_Content = string.Empty;

            if (datafld == string.Empty)
            {
                return("");
            }
            else
            {
                switch (datafld)
                {
                case "SYS_DATE":    //当前日期,形如 1999-01-01
                    Tag_Content = DateTime.Now.ToShortDateString();
                    break;

                case "SYS_DATE_CN":    //当前日期,形如 2009年1月1日

                    Tag_Content = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";
                    break;

                case "SYS_DATE_CN_SHORT3":    //当前日期,形如 2009年

                    Tag_Content = DateTime.Now.Year.ToString() + "年";
                    break;

                case "SYS_DATE_CN_SHORT4":    //当前年份,形如 2009
                    Tag_Content = DateTime.Now.Year.ToString();
                    break;

                case "SYS_DATE_CN_SHORT1":    //当前日期,形如 2009年1月

                    Tag_Content = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月";
                    break;

                case "SYS_DATE_CN_SHORT2":    //当前日期,形如 1月1日

                    Tag_Content = DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";
                    break;

                case "SYS_TIME":    //当前时间
                    Tag_Content = DateTime.Now.ToLongTimeString();
                    break;

                case "SYS_DATETIME":    //当前日期+时间
                    Tag_Content = DateTime.Now.ToString();
                    break;

                case "SYS_USERID":
                case "SYS_USERNAME":
                case "SYS_DEPTNAME":
                case "SYS_USERPRIV":
                    string _User_Fld = datafld;
                    _Tmm = _Tbm.GetModel(this._User_Id);
                    switch (_User_Fld)
                    {
                    case "SYS_USERID":        //当前用户ID
                        Tag_Content = _Tmm.m_id.ToString();
                        break;

                    case "SYS_USERNAME":        //当前用户姓名
                        Tag_Content = _Tmm.m_name;
                        break;

                    case "SYS_DEPTNAME":        //当前用户部门
                        Tag_Content = Tunnel.Common.GetValue.getDataValue("Tunnel_bum", "b_name", "b_id=" + _Tmm.m_bum);
                        break;

                    case "SYS_USERPRIV":        //当前用户角色
                        Tag_Content = Tunnel.Common.GetValue.getDataValue("Tunnel_jiaose", "j_name", "j_id=" + _Tmm.m_jiao);
                        break;

                    default:
                        Tag_Content = "";
                        break;
                    }
                    break;

                case "SYS_RUNID":    //流水号

                    Tag_Content = Tunnel.Common.GetValue.getDataValue("Tunnel_RunId", "run_currentid", "run_id=1");
                    break;

                case "SYS_IP":    //经办人IP地址
                    Tag_Content = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
                    break;

                default:
                    Tag_Content = "";
                    break;
                }
                return(Tag_Content);
            }
        }