Ejemplo n.º 1
0
        /// <summary>
        /// 系统的存储状态,当前上传人数,用户姓名和等级显示
        /// </summary>
        public void ShowSystemStatus()
        {
            //上传人数显示
            Maticsoft.BLL.onlinenumber          onlines     = new Maticsoft.BLL.onlinenumber();
            List <Maticsoft.Model.onlinenumber> onlineList1 = onlines.GetModelList("onlinestatus=1");

            //username去重
            for (int i = 0; i < onlineList1.Count; i++)
            {
                for (int j = onlineList1.Count - 1; j > i; j--)
                {
                    if (onlineList1[i].username.Equals(onlineList1[j].username))
                    {
                        onlineList1.RemoveAt(j);
                    }
                }
            }
            labelUpload.Text = "当前有" + onlineList1.Count + "人正在上传数据";
            //系统存储状态显示
            Maticsoft.BLL.clutercapacity   bCluter1 = new Maticsoft.BLL.clutercapacity();
            Maticsoft.Model.clutercapacity mCluter1 = bCluter1.GetModelList("1=1 group by id desc limit 1")[0];
            String total    = mCluter1.totalCapacity;
            String used     = mCluter1.usedCapacity;
            float  totalNum = 1;
            float  usedNum  = 0;

            //将系统总量转换为GB表示,用于计算进度条
            if (total.Contains("TB"))
            {
                String temp = total.Split("TB".ToArray())[0];
                totalNum = float.Parse(temp) * 1024;
            }
            else if (total.Contains("GB"))
            {
                String temp = total.Split("GB".ToArray())[0];
                totalNum = float.Parse(temp);
            }
            //将已使用量转换为GB显示,用于计算进度条比例
            if (used.Contains("TB"))
            {
                String temp = used.Split("TB".ToArray())[0];
                usedNum = float.Parse(temp) * 1024;
            }
            else if (used.Contains("GB"))
            {
                String temp = used.Split("GB".ToArray())[0];
                usedNum = float.Parse(temp);
            }
            processBar_SystemStaus1.Text  = used + "/" + total;
            processBar_SystemStaus1.Value = (usedNum / totalNum) * 100;

            //用户姓名和等级显示
            labelUser.Text = UserInfo.username;
            String userRolle = UserInfo.userRolle;

            Maticsoft.BLL.role   roleB = new Maticsoft.BLL.role();
            Maticsoft.Model.role roleM = roleB.GetModel(Convert.ToInt32(UserInfo.userRolle));
            labelPost.Text = roleM.roleName;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update role set ");
            strSql.Append("roleName=@roleName,");
            strSql.Append("roleDescribe=@roleDescribe,");
            strSql.Append("organization=@organization,");
            strSql.Append("dataScope=@dataScope,");
            strSql.Append("roleMenu=@roleMenu,");
            strSql.Append("addMan=@addMan,");
            strSql.Append("addTime=@addTime,");
            strSql.Append("department=@department,");
            strSql.Append("section=@section,");
            strSql.Append("allParent=@allParent");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@roleName",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@roleDescribe", MySqlDbType.VarChar, 255),
                new MySqlParameter("@organization", MySqlDbType.VarChar, 255),
                new MySqlParameter("@dataScope",    MySqlDbType.VarChar, 255),
                new MySqlParameter("@roleMenu",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@addMan",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@addTime",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@department",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@section",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@allParent",    MySqlDbType.VarChar, 255),
                new MySqlParameter("@id",           MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.roleName;
            parameters[1].Value  = model.roleDescribe;
            parameters[2].Value  = model.organization;
            parameters[3].Value  = model.dataScope;
            parameters[4].Value  = model.roleMenu;
            parameters[5].Value  = model.addMan;
            parameters[6].Value  = model.addTime;
            parameters[7].Value  = model.department;
            parameters[8].Value  = model.section;
            parameters[9].Value  = model.allParent;
            parameters[10].Value = model.id;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.role DataRowToModel(DataRow row)
 {
     Maticsoft.Model.role model = new Maticsoft.Model.role();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["roleName"] != null)
         {
             model.roleName = row["roleName"].ToString();
         }
         if (row["roleDescribe"] != null)
         {
             model.roleDescribe = row["roleDescribe"].ToString();
         }
         if (row["organization"] != null)
         {
             model.organization = row["organization"].ToString();
         }
         if (row["dataScope"] != null)
         {
             model.dataScope = row["dataScope"].ToString();
         }
         if (row["roleMenu"] != null)
         {
             model.roleMenu = row["roleMenu"].ToString();
         }
         if (row["addMan"] != null)
         {
             model.addMan = row["addMan"].ToString();
         }
         if (row["addTime"] != null)
         {
             model.addTime = row["addTime"].ToString();
         }
         if (row["department"] != null)
         {
             model.department = row["department"].ToString();
         }
         if (row["section"] != null)
         {
             model.section = row["section"].ToString();
         }
         if (row["allParent"] != null)
         {
             model.allParent = row["allParent"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into role(");
            strSql.Append("roleName,roleDescribe,organization,dataScope,roleMenu,addMan,addTime,department,section,allParent)");
            strSql.Append(" values (");
            strSql.Append("@roleName,@roleDescribe,@organization,@dataScope,@roleMenu,@addMan,@addTime,@department,@section,@allParent)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@roleName",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@roleDescribe", MySqlDbType.VarChar, 255),
                new MySqlParameter("@organization", MySqlDbType.VarChar, 255),
                new MySqlParameter("@dataScope",    MySqlDbType.VarChar, 255),
                new MySqlParameter("@roleMenu",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@addMan",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@addTime",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@department",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@section",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@allParent",    MySqlDbType.VarChar, 255)
            };
            parameters[0].Value = model.roleName;
            parameters[1].Value = model.roleDescribe;
            parameters[2].Value = model.organization;
            parameters[3].Value = model.dataScope;
            parameters[4].Value = model.roleMenu;
            parameters[5].Value = model.addMan;
            parameters[6].Value = model.addTime;
            parameters[7].Value = model.department;
            parameters[8].Value = model.section;
            parameters[9].Value = model.allParent;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.role GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,roleName,roleDescribe,organization,dataScope,roleMenu,addMan,addTime,department,section,allParent from role ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            Maticsoft.Model.role model = new Maticsoft.Model.role();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }