Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.department DataRowToModel(DataRow row)
 {
     Maticsoft.Model.department model = new Maticsoft.Model.department();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["departmentNum"] != null)
         {
             model.departmentNum = row["departmentNum"].ToString();
         }
         if (row["departmentName"] != null)
         {
             model.departmentName = row["departmentName"].ToString();
         }
         if (row["remarks"] != null)
         {
             model.remarks = row["remarks"].ToString();
         }
         if (row["foundtime"] != null)
         {
             model.foundtime = row["foundtime"].ToString();
         }
         if (row["found"] != null)
         {
             model.found = row["found"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.department model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into department(");
            strSql.Append("departmentNum,departmentName,remarks,foundtime,found)");
            strSql.Append(" values (");
            strSql.Append("@departmentNum,@departmentName,@remarks,@foundtime,@found)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@departmentNum",  MySqlDbType.VarChar, 100),
                new MySqlParameter("@departmentName", MySqlDbType.VarChar, 255),
                new MySqlParameter("@remarks",        MySqlDbType.VarChar, 255),
                new MySqlParameter("@foundtime",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@found",          MySqlDbType.VarChar, 255)
            };
            parameters[0].Value = model.departmentNum;
            parameters[1].Value = model.departmentName;
            parameters[2].Value = model.remarks;
            parameters[3].Value = model.foundtime;
            parameters[4].Value = model.found;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 给自定义控件赋值
 /// </summary>
 /// <param name="usercontrol"></param>
 /// <param name="evi"></param>
 private void setClueControlValue(CluePanel.UserControl1 usercontrol, Maticsoft.Model.caseinfo cainfo1)
 {
     usercontrol.Controls["lblClueNum"].Text = "" + cainfo1.caseNum;
     usercontrol.Controls["label3"].Text     = cainfo1.caseName;
     usercontrol.Controls["label4"].Text     = "" + cainfo1.threadType;
     Maticsoft.Model.department depart1 = new Maticsoft.Model.department();
     Maticsoft.BLL.department   depart2 = new Maticsoft.BLL.department();
     if (cainfo1.userPartment != null && !"".Equals(cainfo1.userPartment))
     {
         depart1 = depart2.GetModel(Convert.ToInt32(cainfo1.userPartment));
     }
     usercontrol.Controls["label5"].Text = depart1.departmentName;
     usercontrol.Controls["label6"].Text = cainfo1.userName;
     usercontrol.Controls["panel1"].Controls["label7"].Text = "" + cainfo1.id;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.department model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update department set ");
            strSql.Append("departmentNum=@departmentNum,");
            strSql.Append("departmentName=@departmentName,");
            strSql.Append("remarks=@remarks,");
            strSql.Append("foundtime=@foundtime,");
            strSql.Append("found=@found");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@departmentNum",  MySqlDbType.VarChar, 100),
                new MySqlParameter("@departmentName", MySqlDbType.VarChar, 255),
                new MySqlParameter("@remarks",        MySqlDbType.VarChar, 255),
                new MySqlParameter("@foundtime",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@found",          MySqlDbType.VarChar, 255),
                new MySqlParameter("@id",             MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.departmentNum;
            parameters[1].Value = model.departmentName;
            parameters[2].Value = model.remarks;
            parameters[3].Value = model.foundtime;
            parameters[4].Value = model.found;
            parameters[5].Value = model.id;

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

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

            strSql.Append("select id,departmentNum,departmentName,remarks,foundtime,found from department ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

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