Exemple #1
0
 public int SaveBanner(Banner banner)
 {
     //BannerDL bannerDL = new BannerDL();
     //return bannerDL.SaveBanner(banner);
     foreach(BannerItem item in banner.Banners)
     {
         if (item.BannerID > 0)
             new BannerDL().UpdateBannerItem(item, banner.BannerPositionID);
         else
             new BannerDL().SaveBannerItem(item, banner.BannerPositionID);
     }
     return 1;
 }
Exemple #2
0
 public int SaveBanner(Banner banner)
 {
     BannerDL bannerDL = new BannerDL();
     return bannerDL.SaveBanner(banner);
 }
Exemple #3
0
        private void save()
        {
            Banner banner = new Banner();
            banner.BannerPositionID = int.Parse(cmbPosition.SelectedValue);

            int index = 0;
            if (ViewState["images"] != null)
                foreach (GridViewRow row in dgvBanners.Rows)
                {
                    ((List<BannerItem>)ViewState["images"])[index].Url = ((TextBox)row.FindControl("txtLink")).Text;
                    index++;
                }

            banner.Banners = (List<BannerItem>)ViewState["images"];

            BannerBL bannerBL = new BannerBL();
            bannerBL.SaveBanner(banner);
        }
Exemple #4
0
        public int SaveBanner(Banner banner)
        {
            int status = 0;
            using (SqlConnection objConn = new SqlConnection(WebConfigurationManager.ConnectionStrings["eshopConnectionString"].ConnectionString))
            {
                using (SqlCommand objComm = new SqlCommand("saveBanner", objConn))
                {
                    objConn.Open();
                    objComm.CommandType = CommandType.StoredProcedure;

                    for (int i = 0; i < banner.Banners.Count; i++)
                    {
                        objComm.Parameters.Clear();
                        objComm.Parameters.Add("bannerPositionID", SqlDbType.Int).Value = banner.BannerPositionID;
                        objComm.Parameters.Add("@imageUrl", SqlDbType.NVarChar, 50).Value = banner.Banners[i].ImageUrl;
                        objComm.Parameters.Add("@url", SqlDbType.NVarChar, 100).Value = banner.Banners[i].Url;

                        status = objComm.ExecuteNonQuery();
                    }
                }

            }
            return status;
        }
Exemple #5
0
        private void save()
        {
            Banner banner = new Banner();
            banner.BannerPositionID = int.Parse(cmbPosition.SelectedValue);
            banner.Banners = (List<BannerItem>)ViewState["images"];

            BannerBL bannerBL = new BannerBL();
            bannerBL.SaveBanner(banner);
        }