Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <XHD.Model.crm_oa_boardrecord> DataTableToList(DataTable dt)
        {
            List <XHD.Model.crm_oa_boardrecord> modelList = new List <XHD.Model.crm_oa_boardrecord>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                XHD.Model.crm_oa_boardrecord model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new XHD.Model.crm_oa_boardrecord();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["factory_Id"] != null && dt.Rows[n]["factory_Id"].ToString() != "")
                    {
                        model.factory_Id = dt.Rows[n]["factory_Id"].ToString();
                    }
                    if (dt.Rows[n]["boardroom_id"] != null && dt.Rows[n]["boardroom_id"].ToString() != "")
                    {
                        model.boardroom_id = int.Parse(dt.Rows[n]["boardroom_id"].ToString());
                    }
                    if (dt.Rows[n]["boardroom_name"] != null && dt.Rows[n]["boardroom_name"].ToString() != "")
                    {
                        model.boardroom_name = dt.Rows[n]["boardroom_name"].ToString();
                    }
                    if (dt.Rows[n]["start_time"] != null && dt.Rows[n]["start_time"].ToString() != "")
                    {
                        model.start_time = DateTime.Parse(dt.Rows[n]["start_time"].ToString());
                    }
                    if (dt.Rows[n]["end_time"] != null && dt.Rows[n]["end_time"].ToString() != "")
                    {
                        model.end_time = DateTime.Parse(dt.Rows[n]["end_time"].ToString());
                    }
                    if (dt.Rows[n]["status"] != null && dt.Rows[n]["status"].ToString() != "")
                    {
                        model.status = dt.Rows[n]["status"].ToString();
                    }
                    if (dt.Rows[n]["theme"] != null && dt.Rows[n]["theme"].ToString() != "")
                    {
                        model.theme = dt.Rows[n]["theme"].ToString();
                    }
                    if (dt.Rows[n]["create_id"] != null && dt.Rows[n]["create_id"].ToString() != "")
                    {
                        model.create_id = int.Parse(dt.Rows[n]["create_id"].ToString());
                    }
                    if (dt.Rows[n]["create_name"] != null && dt.Rows[n]["create_name"].ToString() != "")
                    {
                        model.create_name = dt.Rows[n]["create_name"].ToString();
                    }
                    if (dt.Rows[n]["create_date"] != null && dt.Rows[n]["create_date"].ToString() != "")
                    {
                        model.create_date = DateTime.Parse(dt.Rows[n]["create_date"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.crm_oa_boardrecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update crm_oa_boardrecord set ");
            strSql.Append("factory_Id=@factory_Id,");
            strSql.Append("boardroom_id=@boardroom_id,");
            strSql.Append("boardroom_name=@boardroom_name,");
            strSql.Append("start_time=@start_time,");
            strSql.Append("end_time=@end_time,");
            strSql.Append("status=@status,");
            strSql.Append("theme=@theme,");
            strSql.Append("create_id=@create_id,");
            strSql.Append("create_name=@create_name,");
            strSql.Append("create_date=@create_date");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@factory_Id",     MySqlDbType.VarChar,   60),
                new MySqlParameter("@boardroom_id",   MySqlDbType.Int32,     11),
                new MySqlParameter("@boardroom_name", MySqlDbType.VarChar,   60),
                new MySqlParameter("@start_time",     MySqlDbType.DateTime),
                new MySqlParameter("@end_time",       MySqlDbType.DateTime),
                new MySqlParameter("@status",         MySqlDbType.VarChar,    1),
                new MySqlParameter("@theme",          MySqlDbType.VarChar,   60),
                new MySqlParameter("@create_id",      MySqlDbType.Int32,     11),
                new MySqlParameter("@create_name",    MySqlDbType.VarChar,   60),
                new MySqlParameter("@create_date",    MySqlDbType.DateTime),
                new MySqlParameter("@Id",             MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.factory_Id;
            parameters[1].Value  = model.boardroom_id;
            parameters[2].Value  = model.boardroom_name;
            parameters[3].Value  = model.start_time;
            parameters[4].Value  = model.end_time;
            parameters[5].Value  = model.status;
            parameters[6].Value  = model.theme;
            parameters[7].Value  = model.create_id;
            parameters[8].Value  = model.create_name;
            parameters[9].Value  = model.create_date;
            parameters[10].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XHD.Model.crm_oa_boardrecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into crm_oa_boardrecord(");
            strSql.Append("factory_Id,boardroom_id,boardroom_name,start_time,end_time,status,theme,create_id,create_name,create_date)");
            strSql.Append(" values (");
            strSql.Append("@factory_Id,@boardroom_id,@boardroom_name,@start_time,@end_time,@status,@theme,@create_id,@create_name,@create_date)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@factory_Id",     MySqlDbType.VarChar,   60),
                new MySqlParameter("@boardroom_id",   MySqlDbType.Int32,     11),
                new MySqlParameter("@boardroom_name", MySqlDbType.VarChar,   60),
                new MySqlParameter("@start_time",     MySqlDbType.DateTime),
                new MySqlParameter("@end_time",       MySqlDbType.DateTime),
                new MySqlParameter("@status",         MySqlDbType.VarChar,    1),
                new MySqlParameter("@theme",          MySqlDbType.VarChar,   60),
                new MySqlParameter("@create_id",      MySqlDbType.Int32,     11),
                new MySqlParameter("@create_name",    MySqlDbType.VarChar,   60),
                new MySqlParameter("@create_date",    MySqlDbType.DateTime)
            };
            parameters[0].Value = model.factory_Id;
            parameters[1].Value = model.boardroom_id;
            parameters[2].Value = model.boardroom_name;
            parameters[3].Value = model.start_time;
            parameters[4].Value = model.end_time;
            parameters[5].Value = model.status;
            parameters[6].Value = model.theme;
            parameters[7].Value = model.create_id;
            parameters[8].Value = model.create_name;
            parameters[9].Value = model.create_date;

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

            return(i);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.crm_oa_boardrecord GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,factory_Id,boardroom_id,boardroom_name,start_time,end_time,status,theme,create_id,create_name,create_date from crm_oa_boardrecord ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["factory_Id"] != null && ds.Tables[0].Rows[0]["factory_Id"].ToString() != "")
                {
                    model.factory_Id = ds.Tables[0].Rows[0]["factory_Id"].ToString();
                }
                if (ds.Tables[0].Rows[0]["boardroom_id"] != null && ds.Tables[0].Rows[0]["boardroom_id"].ToString() != "")
                {
                    model.boardroom_id = int.Parse(ds.Tables[0].Rows[0]["boardroom_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["boardroom_name"] != null && ds.Tables[0].Rows[0]["boardroom_name"].ToString() != "")
                {
                    model.boardroom_name = ds.Tables[0].Rows[0]["boardroom_name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["start_time"] != null && ds.Tables[0].Rows[0]["start_time"].ToString() != "")
                {
                    model.start_time = DateTime.Parse(ds.Tables[0].Rows[0]["start_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["end_time"] != null && ds.Tables[0].Rows[0]["end_time"].ToString() != "")
                {
                    model.end_time = DateTime.Parse(ds.Tables[0].Rows[0]["end_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = ds.Tables[0].Rows[0]["status"].ToString();
                }
                if (ds.Tables[0].Rows[0]["theme"] != null && ds.Tables[0].Rows[0]["theme"].ToString() != "")
                {
                    model.theme = ds.Tables[0].Rows[0]["theme"].ToString();
                }
                if (ds.Tables[0].Rows[0]["create_id"] != null && ds.Tables[0].Rows[0]["create_id"].ToString() != "")
                {
                    model.create_id = int.Parse(ds.Tables[0].Rows[0]["create_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["create_name"] != null && ds.Tables[0].Rows[0]["create_name"].ToString() != "")
                {
                    model.create_name = ds.Tables[0].Rows[0]["create_name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["create_date"] != null && ds.Tables[0].Rows[0]["create_date"].ToString() != "")
                {
                    model.create_date = DateTime.Parse(ds.Tables[0].Rows[0]["create_date"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XHD.Model.crm_oa_boardrecord model)
 {
     return(dal.Update(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(XHD.Model.crm_oa_boardrecord model)
 {
     return(dal.Add(model));
 }