예제 #1
0
        public List <SysOrgProvinceModel> DataTableToList(DataTable dt)
        {
            List <SysOrgProvinceModel> list = new List <SysOrgProvinceModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    SysOrgProvinceModel item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
예제 #2
0
        public SysOrgProvinceModel DataRowToModel(DataRow row)
        {
            SysOrgProvinceModel sysOrgProvinceModel = new SysOrgProvinceModel();

            if (row != null)
            {
                sysOrgProvinceModel.ID = int.Parse(row["ID"].ToString());
                if ((row["Code"] != null) && (row["Code"] != DBNull.Value))
                {
                    sysOrgProvinceModel.Code = row["Code"].ToString();
                }
                if ((row["Name"] != null) && (row["Name"] != DBNull.Value))
                {
                    sysOrgProvinceModel.Name = row["Name"].ToString();
                }
            }
            return(sysOrgProvinceModel);
        }
예제 #3
0
        public bool Add(SysOrgProvinceModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into SYS_ORG_PROVINCE(");
            builder.Append("ID,Code,Name)");
            builder.Append(" values (");
            builder.Append("@ID,@Code,@Name)");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@ID", MySqlDbType.Int32, 4),
                new MySqlParameter("@Code", MySqlDbType.String),
                new MySqlParameter("@Name", MySqlDbType.String)
            };
            cmdParms[0].Value = model.ID;
            cmdParms[1].Value = model.Code;
            cmdParms[2].Value = model.Name;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
예제 #4
0
        public bool Update(SysOrgProvinceModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update SYS_ORG_PROVINCE set ");
            builder.Append("ID=@ID,");
            builder.Append("Code=@Code,");
            builder.Append("Name=@Name");
            builder.Append(" where ");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@ID", MySqlDbType.Int32, 4),
                new MySqlParameter("@Code", MySqlDbType.String),
                new MySqlParameter("@Name", MySqlDbType.String)
            };
            cmdParms[0].Value = model.ID;
            cmdParms[1].Value = model.Code;
            cmdParms[2].Value = model.Name;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
예제 #5
0
 public bool Update(SysOrgProvinceModel model)
 {
     return(this.dal.Update(model));
 }
예제 #6
0
 public bool Add(SysOrgProvinceModel model)
 {
     return(this.dal.Add(model));
 }