示例#1
0
        /// <summary>
        /// 设置用户信息
        /// </summary>
        private void createUserInfo()
        {
            NameObjectList paramList = new NameObjectList();
            paramList["userid"] = this.UserAccounts;
            if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
            DataTable tab = this.userQuery.getTable("人员基本信息", paramList);
            if (tab.Rows.Count < 1)
            {
                this._userName = "******";
            }
            else
            {
                this._userName = (null == tab.Rows[0]["姓名"]) ? "" : tab.Rows[0]["姓名"].ToString();
                this._dept = (null == tab.Rows[0]["部门"]) ? "" : tab.Rows[0]["部门"].ToString();
                this._deptcode = (null == tab.Rows[0]["部门编号"]) ? "" : tab.Rows[0]["部门编号"].ToString();
                this._deptid = (null == tab.Rows[0]["部门ID"]) ? "" : tab.Rows[0]["部门ID"].ToString();
                this._deptsub = (null == tab.Rows[0]["分部门"]) ? "" : tab.Rows[0]["分部门"].ToString();
                this._deptsubcode = (null == tab.Rows[0]["分部门编号"]) ? "" : tab.Rows[0]["分部门编号"].ToString();
                this._deptsubid = (null == tab.Rows[0]["分部门ID"]) ? "" : tab.Rows[0]["分部门ID"].ToString();
                this._unitName = (null == tab.Rows[0]["单位"]) ? "" : tab.Rows[0]["单位"].ToString();
                this._unitcode = (null == tab.Rows[0]["单位编号"]) ? "" : tab.Rows[0]["单位编号"].ToString();
                this._unitID = (null == tab.Rows[0]["单位ID"]) ? "" : tab.Rows[0]["单位ID"].ToString();
                this._roleName = (null == tab.Rows[0]["角色"]) ? "" : tab.Rows[0]["角色"].ToString();
                if (null == tab.Rows[0]["限制天数"] || DBNull.Value == tab.Rows[0]["限制天数"])
                    this._limitDays = 0;
                else
                    this._limitDays = Convert.ToInt16(tab.Rows[0]["限制天数"]);
                if (null == tab.Rows[0]["公网访问"] || DBNull.Value == tab.Rows[0]["公网访问"])
                    this._visitOut = false;
                else
                    this._visitOut = Convert.ToBoolean(tab.Rows[0]["公网访问"]);
            }
            string fileName = "";
            if (tab.Rows.Count > 0 && null != tab.Rows[0]["分部门独立管理"]
                    && (tab.Rows[0]["分部门独立管理"].Equals(true) || "true" == tab.Rows[0]["分部门独立管理"].ToString().ToLower()))
                fileName = (null == tab.Rows[0]["分部门编号"]) ? "" : tab.Rows[0]["分部门编号"].ToString();
            else if (tab.Rows.Count > 0 && null != tab.Rows[0]["部门独立管理"]
                    && (tab.Rows[0]["部门独立管理"].Equals(true) || "true" == tab.Rows[0]["部门独立管理"].ToString().ToLower()))
                fileName = (null == tab.Rows[0]["部门编号"]) ? "" : tab.Rows[0]["部门编号"].ToString();
            else if (tab.Rows.Count > 0)
                fileName = (null == tab.Rows[0]["单位编号"]) ? "" : tab.Rows[0]["单位编号"].ToString();
            this._OPTUnitID = fileName;

            //根据this._OPTUnitID查出权限数据
            if ("" != fileName)
            {
                //打开权限数据,条件:角色,部门,所在单位(this._OPTUnitID),得出所属节点的操作集
                paramList.Clear();
                paramList["deptcode"] = this.DeptmentCode;
                paramList["role"] = this.RoleName;
                this.userQuery.FillDataSet("rightsql", paramList, this.dsDeptRight);
            }
            paramList.Clear();
            paramList["DeptCode"] = this.DeptmentCode;
            paramList["OPTUnitID"] = this.UnitID;
            if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
            tab = this.userQuery.getTable("上级部门", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["名称"])
                this._deptParent = tab.Rows[0]["名称"].ToString();
            tab = this.userQuery.getTable("销售部门", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["名称"])
                this._deptSaleName = tab.Rows[0]["名称"].ToString();

            tab = this.userQuery.getTable("上级单位", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["名称"])
                this._unitParent = tab.Rows[0]["名称"].ToString();

        }
示例#2
0
        public User(string userID)
        {
            this._userId = userID;
            this._workRight = new WorkUnitRight();
            NameObjectList paramList = new NameObjectList();
            if (null == User.tabUser)
            {
                if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
                User.tabUser = this.userQuery.getTable("�û���¼������Ϣ�ṹ", paramList);
            }
            DataRow drUser = null;
            for (int i = User.tabUser.Rows.Count - 1; i > -1; i--)
            {
                DataRow dr = User.tabUser.Rows[i];
                DateTime dStart = Convert.ToDateTime(dr["��¼ʱ��"]);
                DateTime dEnd = Convert.ToDateTime(dr["����ʱ��"]);
                //��ʱ10����
                if (dStart.Add(new TimeSpan(0, 10, 0)) < dEnd)
                {
                    NameObjectList param = new NameObjectList();
                    param["�ʺ�"] = dr["�ʺ�"];
                    param["��¼ʱ��"] = dr["��¼ʱ��"];
                    param["����ʱ��"] = dr["����ʱ��"];
                    param["��¼IP"] = dr["��¼IP"];
                    paramList[paramList.Count.ToString()] = param;
                    User.tabUser.Rows.Remove(dr);
                    continue;
                }
                string userAddress = Dns.GetHostName();
                if (null != HttpContext.Current && null != HttpContext.Current.Request)
                    userAddress = HttpContext.Current.Request.UserHostAddress;
                if (this.UserAccounts == dr["�ʺ�"].ToString() && dr["��¼IP"].ToString() == userAddress)
                {
                    drUser = dr;
                    dr["����ʱ��"] = DateTime.Now;
                }
            }
            User.tabUser.AcceptChanges();
            NameObjectList[] paramListArry = new NameObjectList[paramList.Count];
            for (int i = 0; i < paramListArry.Length; i++)
                paramListArry[i] = paramList[i] as NameObjectList;
            if (paramListArry.Length > 0)
            {
                if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
                this.userQuery.ExecuteInsert("�û���¼��־", paramListArry);
            }
            if (null == drUser)
            {
                this.createUserInfo();
                drUser = User.tabUser.NewRow();
                drUser["�ʺ�"] = this.UserAccounts;
                drUser["��¼ʱ��"] = DateTime.Now;
                drUser["����ʱ��"] = DateTime.Now;
                drUser["��¼IP"] = Dns.GetHostName();
                if (null != HttpContext.Current && null != HttpContext.Current.Request)
                    drUser["��¼IP"] = HttpContext.Current.Request.UserHostAddress;

                drUser["����"] = this._userName;
                drUser["����"] = this._dept;
                drUser["���ű��"] = this._deptcode;
                drUser["����ID"] = this._deptid;
                drUser["���۲���"] = this._deptSaleName;
                drUser["�ֲ���"] = this._deptsub;
                drUser["�ֲ��ű��"] = this._deptsubcode;
                drUser["�ֲ���ID"] = this._deptsubid;
                drUser["��˾"] = this._company;
                drUser["��λ"] = this._unitName;
                drUser["����"] = this._unitcode;
                drUser["��λID"] = this._unitID;
                drUser["��ɫ"] = this._roleName;
                drUser["Ȩ�����"] = this._rights;
                drUser["��������"] = this._limitDays;
                drUser["�ϼ���λ"] = this._unitParent;
                drUser["�ϼ�����"] = this._deptParent;
                drUser["Ȩ���ļ�"] = this._OPTUnitID;
                drUser["��������"] = this._visitOut;
                User.tabUser.Rows.Add(drUser);

            }
            else
            {
                this._userName = (null == drUser["����"]) ? "" : drUser["����"].ToString();
                this._dept = (null == drUser["����"]) ? "" : drUser["����"].ToString();
                this._deptcode = (null == drUser["���ű��"]) ? "" : drUser["���ű��"].ToString();
                this._deptid = (null == drUser["����ID"]) ? "" : drUser["����ID"].ToString();
                this._deptSaleName = (null == drUser["���۲���"]) ? "" : drUser["���۲���"].ToString();
                this._deptsub = (null == drUser["�ֲ���"]) ? "" : drUser["�ֲ���"].ToString();
                this._deptsubcode = (null == drUser["�ֲ��ű��"]) ? "" : drUser["�ֲ��ű��"].ToString();
                this._deptsubid = (null == drUser["�ֲ���ID"]) ? "" : drUser["�ֲ���ID"].ToString();
                this._company = (null == drUser["��˾"]) ? "" : drUser["��˾"].ToString();
                this._unitName = (null == drUser["��λ"]) ? "" : drUser["��λ"].ToString();
                this._unitcode = (null == drUser["����"]) ? "" : drUser["����"].ToString();
                this._unitID = (null == drUser["��λID"]) ? "" : drUser["��λID"].ToString();
                this._unitParent = (null == drUser["�ϼ���λ"]) ? "" : drUser["�ϼ���λ"].ToString();
                this._deptParent = (null == drUser["�ϼ�����"]) ? "" : drUser["�ϼ�����"].ToString();
                this._roleName = (null == drUser["��ɫ"]) ? "" : drUser["��ɫ"].ToString();
                this._rights = (null == drUser["Ȩ�����"]) ? "" : drUser["Ȩ�����"].ToString();
                this._OPTUnitID = (null == drUser["Ȩ���ļ�"]) ? "" : drUser["Ȩ���ļ�"].ToString();
                if (null == drUser["��������"])
                    this._limitDays = 0;
                else
                    this._limitDays = Convert.ToInt16(drUser["��������"]);
                if (null == drUser["��������"])
                    this._visitOut = false;
                else
                    this._visitOut = Convert.ToBoolean(drUser["��������"]);

                //������Ȩ���ļ���Ϊ����Ȩ�����ݣ������ڱ�mnu_rights,
                string fileName = this._OPTUnitID; //ȡ����Ա���ϼ�������λ��ID��ΪȨ���ļ���(+.xml)
                if ("" != fileName)
                {
                    paramList.Clear();
                    paramList["deptcode"] = this._deptcode;
                    paramList["role"] = this._roleName;
                    this.userQuery = QueryDataRes.CreateQuerySys();
                    this.userQuery.FillDataSet("rightsql", paramList, this.dsDeptRight);
                }

            }
        }
示例#3
0
        public User(string userID, Boolean reset, ref Boolean blBad)
        {
            this._userId = userID;
            this._workRight = new WorkUnitRight();
            NameObjectList paramList = new NameObjectList();
            if (null == User.tabUser || reset == true)
            {
                if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
                User.tabUser = this.userQuery.getTable("用户登录基本信息结构", paramList);
            }
            DataRow drUser = null;
            if (User.tabUser == null) { blBad = true; return; }
            for (int i = User.tabUser.Rows.Count - 1; i > -1; i--)
            {
                DataRow dr = User.tabUser.Rows[i];
                DateTime dStart = Convert.ToDateTime(dr["登录时间"]);
                DateTime dEnd = Convert.ToDateTime(dr["离线时间"]);
                //超时10分钟
                if (dStart.Add(new TimeSpan(0, 10, 0)) < dEnd)
                {
                    NameObjectList param = new NameObjectList();
                    param["帐号"] = dr["帐号"];
                    param["登录时间"] = dr["登录时间"];
                    param["离线时间"] = dr["离线时间"];
                    param["登录IP"] = dr["登录IP"];
                    paramList[paramList.Count.ToString()] = param;
                    User.tabUser.Rows.Remove(dr);
                    continue;
                }
                string userAddress = Dns.GetHostName();
                if (null != HttpContext.Current && null != HttpContext.Current.Request)
                    userAddress = HttpContext.Current.Request.UserHostAddress;
                if (this.UserAccounts == dr["帐号"].ToString() && dr["登录IP"].ToString() == userAddress)
                {
                    drUser = dr;
                    dr["离线时间"] = DateTime.Now;
                }
            }
            User.tabUser.AcceptChanges();
            NameObjectList[] paramListArry = new NameObjectList[paramList.Count];
            for (int i = 0; i < paramListArry.Length; i++)
                paramListArry[i] = paramList[i] as NameObjectList;
            if (paramListArry.Length > 0)
            {
                if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
                this.userQuery.ExecuteInsert("用户登录日志", paramListArry);
            }
            if (null == drUser)
            {
                this.createUserInfo();
                drUser = User.tabUser.NewRow();
                drUser["帐号"] = this.UserAccounts;
                drUser["登录时间"] = DateTime.Now;
                drUser["离线时间"] = DateTime.Now;
                drUser["登录IP"] = Dns.GetHostName();
                if (null != HttpContext.Current && null != HttpContext.Current.Request)
                    drUser["登录IP"] = HttpContext.Current.Request.UserHostAddress;

                drUser["姓名"] = this._userName;
                drUser["部门"] = this._dept;
                drUser["部门编号"] = this._deptcode;
                drUser["部门ID"] = this._deptid;
                drUser["销售部门"] = this._deptSaleName;
                drUser["分部门"] = this._deptsub;
                drUser["分部门编号"] = this._deptsubcode;
                drUser["分部门ID"] = this._deptsubid;
                drUser["公司"] = this._company;
                drUser["单位"] = this._unitName;
                drUser["单位编号"] = this._unitcode;
                drUser["单位ID"] = this._unitID;
                drUser["角色"] = this._roleName;
                drUser["权限类别"] = this._rights;
                drUser["限制天数"] = this._limitDays;
                drUser["上级单位"] = this._unitParent;
                drUser["上级部门"] = this._deptParent;
                drUser["权限文件"] = this._OPTUnitID;
                drUser["公网访问"] = this._visitOut;
                User.tabUser.Rows.Add(drUser);
            }
            else
            {
                this._userName = (null == drUser["姓名"]) ? "" : drUser["姓名"].ToString();
                this._dept = (null == drUser["部门"]) ? "" : drUser["部门"].ToString();
                this._deptcode = (null == drUser["部门编号"]) ? "" : drUser["部门编号"].ToString();
                this._deptid = (null == drUser["部门ID"]) ? "" : drUser["部门ID"].ToString();
                this._deptSaleName = (null == drUser["销售部门"]) ? "" : drUser["销售部门"].ToString();
                this._deptsub = (null == drUser["分部门"]) ? "" : drUser["分部门"].ToString();
                this._deptsubcode = (null == drUser["分部门编号"]) ? "" : drUser["分部门编号"].ToString();
                this._deptsubid = (null == drUser["分部门ID"]) ? "" : drUser["分部门ID"].ToString();
                this._company = (null == drUser["公司"]) ? "" : drUser["公司"].ToString();
                this._unitName = (null == drUser["单位"]) ? "" : drUser["单位"].ToString();
                this._unitcode = (null == drUser["单位编号"]) ? "" : drUser["单位编号"].ToString();
                this._unitID = (null == drUser["单位ID"]) ? "" : drUser["单位ID"].ToString();
                this._unitParent = (null == drUser["上级单位"]) ? "" : drUser["上级单位"].ToString();
                this._deptParent = (null == drUser["上级部门"]) ? "" : drUser["上级部门"].ToString();
                this._roleName = (null == drUser["角色"]) ? "" : drUser["角色"].ToString();
                this._rights = (null == drUser["权限类别"]) ? "" : drUser["权限类别"].ToString();
                this._OPTUnitID = (null == drUser["权限文件"]) ? "" : drUser["权限文件"].ToString();
                if (null == drUser["限制天数"])
                    this._limitDays = 0;
                else
                    this._limitDays = Convert.ToInt16(drUser["限制天数"]);
                if (null == drUser["公网访问"])
                    this._visitOut = false;
                else
                    this._visitOut = Convert.ToBoolean(drUser["公网访问"]);

                //将加入权限文件收为加入权限数据,来自于表mnu_rights,
                string fileName = this._OPTUnitID; //取操作员的上级独立单位的ID做为权限文件名(+.xml)
                if ("" != fileName)
                {
                    paramList.Clear();
                    paramList["deptcode"] = this._deptcode;
                    paramList["role"] = this._roleName;
                }
            }

        }
示例#4
0
        /// <summary>
        /// �����û���Ϣ
        /// </summary>
        private void createUserInfo()
        {
            NameObjectList paramList = new NameObjectList();
            paramList["userid"] = this.UserAccounts;
            if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
            DataTable tab = this.userQuery.getTable("��Ա������Ϣ", paramList);
            if (tab.Rows.Count < 1)
            {
                this._userName = "******";
            }
            else
            {
                this._userName = (null == tab.Rows[0]["����"]) ? "" : tab.Rows[0]["����"].ToString();
                this._dept = (null == tab.Rows[0]["����"]) ? "" : tab.Rows[0]["����"].ToString();
                this._deptcode = (null == tab.Rows[0]["���ű��"]) ? "" : tab.Rows[0]["���ű��"].ToString();
                this._deptid = (null == tab.Rows[0]["����ID"]) ? "" : tab.Rows[0]["����ID"].ToString();
                this._deptsub = (null == tab.Rows[0]["�ֲ���"]) ? "" : tab.Rows[0]["�ֲ���"].ToString();
                this._deptsubcode = (null == tab.Rows[0]["�ֲ��ű��"]) ? "" : tab.Rows[0]["�ֲ��ű��"].ToString();
                this._deptsubid = (null == tab.Rows[0]["�ֲ���ID"]) ? "" : tab.Rows[0]["�ֲ���ID"].ToString();
                this._unitName = (null == tab.Rows[0]["��λ"]) ? "" : tab.Rows[0]["��λ"].ToString();
                this._unitcode = (null == tab.Rows[0]["����"]) ? "" : tab.Rows[0]["����"].ToString();
                this._unitID = (null == tab.Rows[0]["��λID"]) ? "" : tab.Rows[0]["��λID"].ToString();
                this._roleName = (null == tab.Rows[0]["��ɫ"]) ? "" : tab.Rows[0]["��ɫ"].ToString();
                if (null == tab.Rows[0]["��������"] || DBNull.Value == tab.Rows[0]["��������"])
                    this._limitDays = 0;
                else
                    this._limitDays = Convert.ToInt16(tab.Rows[0]["��������"]);
                if (null == tab.Rows[0]["��������"] || DBNull.Value == tab.Rows[0]["��������"])
                    this._visitOut = false;
                else
                    this._visitOut = Convert.ToBoolean(tab.Rows[0]["��������"]);
            }
            string fileName = "";
            if (tab.Rows.Count > 0 && null != tab.Rows[0]["�ֲ��Ŷ�������"]
                    && (tab.Rows[0]["�ֲ��Ŷ�������"].Equals(true) || "true" == tab.Rows[0]["�ֲ��Ŷ�������"].ToString().ToLower()))
                fileName = (null == tab.Rows[0]["�ֲ��ű��"]) ? "" : tab.Rows[0]["�ֲ��ű��"].ToString();
            else if (tab.Rows.Count > 0 && null != tab.Rows[0]["���Ŷ�������"]
                    && (tab.Rows[0]["���Ŷ�������"].Equals(true) || "true" == tab.Rows[0]["���Ŷ�������"].ToString().ToLower()))
                fileName = (null == tab.Rows[0]["���ű��"]) ? "" : tab.Rows[0]["���ű��"].ToString();
            else if (tab.Rows.Count > 0)
                fileName = (null == tab.Rows[0]["����"]) ? "" : tab.Rows[0]["����"].ToString();
            this._OPTUnitID = fileName;

            //����this._OPTUnitID���Ȩ������
            if ("" != fileName)
            {
                //��Ȩ������,��������ɫ,����,���ڵ�λ(this._OPTUnitID),�ó�����ڵ�IJ�����
                paramList.Clear();
                paramList["deptcode"] = this.DeptmentCode;
                paramList["role"] = this.RoleName;
                this.userQuery.FillDataSet("rightsql", paramList, this.dsDeptRight);
            }
            paramList.Clear();
            paramList["DeptCode"] = this.DeptmentCode;
            paramList["OPTUnitID"] = this.UnitID;
            if (null == this.userQuery) this.userQuery = QueryDataRes.CreateQuerySys();
            tab = this.userQuery.getTable("�ϼ�����", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["����"])
                this._deptParent = tab.Rows[0]["����"].ToString();
            tab = this.userQuery.getTable("���۲���", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["����"])
                this._deptSaleName = tab.Rows[0]["����"].ToString();

            tab = this.userQuery.getTable("�ϼ���λ", paramList);
            if (null != tab && tab.Rows.Count > 0 && null != tab.Rows[0]["����"])
                this._unitParent = tab.Rows[0]["����"].ToString();
        }