Exemplo n.º 1
0
        public int Inserts(GZS.Model.Areaimg model)
        {
            int count = 0;

            string[] num = model.ImageUrl.Trim('$').Split('$');
            for (int i = 0; i < num.Length; i++)
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into areaimg(");
                strSql.Append("areaid,ImageUrl,ImageName,imgageexplain)");
                strSql.Append(" values (");
                strSql.Append("@areaid,@ImageUrl,@ImageName,@imgageexplain)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@areaid",        SqlDbType.Int,   4),
                    new SqlParameter("@ImageUrl",      SqlDbType.Text),
                    new SqlParameter("@ImageName",     SqlDbType.Text),
                    new SqlParameter("@imgageexplain", SqlDbType.Text)
                };
                parameters[0].Value = model.areaid;
                parameters[1].Value = num[i].Trim();
                parameters[2].Value = model.ImageName;
                parameters[3].Value = model.imgageexplain;

                object obj = DBHelper.GetSingle(strSql.ToString(), parameters);
                if (obj != null)
                {
                    count++;
                }
            }
            return(count);
        }
Exemplo n.º 2
0
        public List <GZS.Model.Areaimg> GetAllModelByareId(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select areaimgid,areaid,ImageUrl,ImageName,imgageexplain from areaimg ");
            strSql.Append(" where areaid=@areaid order by areaimgid desc");
            SqlParameter[] parameters =
            {
                new SqlParameter("@areaid", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            List <GZS.Model.Areaimg> list = new List <GZS.Model.Areaimg>();
            DataSet ds = DBHelper.Query(strSql.ToString(), parameters);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                GZS.Model.Areaimg model = new GZS.Model.Areaimg();
                if (row["areaimgid"].ToString() != "")
                {
                    model.areaimgid = int.Parse(row["areaimgid"].ToString());
                }
                if (row["areaid"].ToString() != "")
                {
                    model.areaid = int.Parse(row["areaid"].ToString());
                }
                model.ImageUrl      = row["ImageUrl"].ToString();
                model.ImageName     = row["ImageName"].ToString();
                model.imgageexplain = row["imgageexplain"].ToString();
                list.Add(model);
            }
            return(list);
        }
Exemplo n.º 3
0
        public static int Insert(GZS.Model.Areaimg model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into areaimg(");
            strSql.Append("areaid,ImageUrl,ImageName,imgageexplain)");
            strSql.Append(" values (");
            strSql.Append("@areaid,@ImageUrl,@ImageName,@imgageexplain)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@areaid",        SqlDbType.Int,   4),
                new SqlParameter("@ImageUrl",      SqlDbType.Text),
                new SqlParameter("@ImageName",     SqlDbType.Text),
                new SqlParameter("@imgageexplain", SqlDbType.Text)
            };
            parameters[0].Value = model.areaid;
            parameters[1].Value = model.ImageUrl;
            parameters[2].Value = model.ImageName;
            parameters[3].Value = model.imgageexplain;

            object obj = DBHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        public int InsertAreaTab(GZS.Model.AreaTab model, GZS.Model.Areaimg areaing)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into areaTab(");
            strSql.Append("loginName,Chineseintroduced,Englishintroduction,createdates,Updatetimes,htmlurl)");
            strSql.Append(" values (");
            strSql.Append("@loginName,@Chineseintroduced,@Englishintroduction,@createdates,@Updatetimes,@htmlurl)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@loginName",           SqlDbType.NVarChar,  200),
                new SqlParameter("@Chineseintroduced",   SqlDbType.Text),
                new SqlParameter("@Englishintroduction", SqlDbType.Text),
                new SqlParameter("@createdates",         SqlDbType.DateTime),
                new SqlParameter("@Updatetimes",         SqlDbType.DateTime),
                new SqlParameter("@htmlurl",             SqlDbType.NVarChar, 200)
            };
            parameters[0].Value  = model.loginName;
            parameters[1].Value  = model.Chineseintroduced;
            parameters[2].Value  = model.Englishintroduction;
            parameters[3].Value  = model.createdates;
            parameters[4].Value  = model.Updatetimes;
            parameters [5].Value = model.Htmlurl;

            object obj = DBHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                int res = 0;
                if (areaing.ImageUrl.Trim() != "")
                {
                    string[] strImageurl = areaing.ImageUrl.TrimEnd('$').Split('$');
                    for (int i = 0; i < strImageurl.Length; i++)
                    {
                        GZS.Model.Areaimg ares = new GZS.Model.Areaimg();
                        ares.areaid        = Convert.ToInt32(obj);
                        ares.ImageName     = areaing.ImageName;
                        ares.ImageUrl      = strImageurl[i].ToString().Trim();
                        ares.imgageexplain = areaing.imgageexplain;
                        res = AreaimgDAL.Insert(ares);
                    }
                    res = 1;
                }
                else
                {
                    res = 1;
                }
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 5
0
 public int Inserts(GZS.Model.Areaimg model)
 {
     return(dal.Inserts(model));
 }
Exemplo n.º 6
0
 public int InsertAreaTab(GZS.Model.AreaTab areatab, GZS.Model.Areaimg areaing)
 {
     return(dal.InsertAreaTab(areatab, areaing));
 }