コード例 #1
0
ファイル: UserSecurity.cs プロジェクト: weiliji/NFMT
 public UserSecurity()
 {
     corp = new Model.Corporation();
     dept = new Model.Department();
     assets = new List<Data.Model.Asset>();
     authValues = new Dictionary<Data.StyleEnum, Data.DetailCollection>();
     authGroups = new List<Model.AuthGroup>();
     roles = new List<Model.Role>();
     menus = new List<Model.Menu>();
     authOptions = new List<Model.AuthOption>();
     authOptionDetails = new List<Model.AuthOptionDetail>();
     refs = new List<Model.AuthOptionDetailEmpRef>();
 }
コード例 #2
0
ファイル: DepartmentDAL.cs プロジェクト: weiliji/NFMT
        public ResultModel Load(UserModel user, int empId)
        {
            ResultModel result = new ResultModel();

            try
            {
                string cmdText = "select d.* from dbo.Department d inner join dbo.DeptEmp de on de.EmpId= @empId";

                SqlParameter[] paras = new SqlParameter[1];
                paras[0] = new SqlParameter("@empId", empId);

                DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionStringUser, cmdText, paras, CommandType.Text);

                List<Department> departments = new List<Department>();

                foreach (DataRow dr in dt.Rows)
                {
                    Department department = new Department();
                    department.DeptId = Convert.ToInt32(dr["DeptId"]);

                    if (dr["CorpId"] != DBNull.Value)
                    {
                        department.CorpId = Convert.ToInt32(dr["CorpId"]);
                    }
                    if (dr["DeptCode"] != DBNull.Value)
                    {
                        department.DeptCode = Convert.ToString(dr["DeptCode"]);
                    }
                    if (dr["DeptName"] != DBNull.Value)
                    {
                        department.DeptName = Convert.ToString(dr["DeptName"]);
                    }
                    if (dr["DeptFullName"] != DBNull.Value)
                    {
                        department.DeptFullName = Convert.ToString(dr["DeptFullName"]);
                    }
                    if (dr["DeptShort"] != DBNull.Value)
                    {
                        department.DeptShort = Convert.ToString(dr["DeptShort"]);
                    }
                    if (dr["DeptType"] != DBNull.Value)
                    {
                        department.DeptType = Convert.ToInt32(dr["DeptType"]);
                    }
                    if (dr["ParentLeve"] != DBNull.Value)
                    {
                        department.ParentLeve = Convert.ToInt32(dr["ParentLeve"]);
                    }
                    if (dr["DeptStatus"] != DBNull.Value)
                    {
                        department.DeptStatus = (Common.StatusEnum)Enum.Parse(typeof(Common.StatusEnum), dr["DeptStatus"].ToString());
                    }
                    if (dr["DeptLevel"] != DBNull.Value)
                    {
                        department.DeptLevel = Convert.ToInt32(dr["DeptLevel"]);
                    }
                    if (dr["CreatorId"] != DBNull.Value)
                    {
                        department.CreatorId = Convert.ToInt32(dr["CreatorId"]);
                    }
                    if (dr["CreateTime"] != DBNull.Value)
                    {
                        department.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
                    }
                    if (dr["LastModifyId"] != DBNull.Value)
                    {
                        department.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
                    }
                    if (dr["LastModifyTime"] != DBNull.Value)
                    {
                        department.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
                    }
                    departments.Add(department);
                }
                result.AffectCount = dt.Rows.Count;
                result.Message = "获取列表成功";
                result.ResultStatus = 0;
                result.ReturnValue = departments;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return result;
        }
コード例 #3
0
ファイル: DepartmentDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(SqlDataReader dr)
        {
            Department department = new Department();

            int indexDeptId = dr.GetOrdinal("DeptId");
            department.DeptId = Convert.ToInt32(dr[indexDeptId]);

            int indexCorpId = dr.GetOrdinal("CorpId");
            department.CorpId = Convert.ToInt32(dr[indexCorpId]);

            int indexDeptCode = dr.GetOrdinal("DeptCode");
            if (dr["DeptCode"] != DBNull.Value)
            {
                department.DeptCode = Convert.ToString(dr[indexDeptCode]);
            }

            int indexDeptName = dr.GetOrdinal("DeptName");
            department.DeptName = Convert.ToString(dr[indexDeptName]);

            int indexDeptFullName = dr.GetOrdinal("DeptFullName");
            if (dr["DeptFullName"] != DBNull.Value)
            {
                department.DeptFullName = Convert.ToString(dr[indexDeptFullName]);
            }

            int indexDeptShort = dr.GetOrdinal("DeptShort");
            if (dr["DeptShort"] != DBNull.Value)
            {
                department.DeptShort = Convert.ToString(dr[indexDeptShort]);
            }

            int indexDeptType = dr.GetOrdinal("DeptType");
            if (dr["DeptType"] != DBNull.Value)
            {
                department.DeptType = Convert.ToInt32(dr[indexDeptType]);
            }

            int indexParentLeve = dr.GetOrdinal("ParentLeve");
            if (dr["ParentLeve"] != DBNull.Value)
            {
                department.ParentLeve = Convert.ToInt32(dr[indexParentLeve]);
            }

            int indexDeptStatus = dr.GetOrdinal("DeptStatus");
            department.DeptStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexDeptStatus]);

            int indexDeptLevel = dr.GetOrdinal("DeptLevel");
            if (dr["DeptLevel"] != DBNull.Value)
            {
                department.DeptLevel = Convert.ToInt32(dr[indexDeptLevel]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            department.CreatorId = Convert.ToInt32(dr[indexCreatorId]);

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            department.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                department.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                department.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            return department;
        }