示例#1
0
        protected void getThongTin(out int banner, out int slogan, out int logo, out string gioithieu)
        {
            gioithieu = "";
            banner    = slogan = logo = -1;
            TRAVEL_WEBDataContext context = new TRAVEL_WEBDataContext();
            var thongtincongtys           = from t in context.THONG_TIN_CONG_Ties select t;
            var thongtincongty            = new THONG_TIN_CONG_TY();

            if (thongtincongtys.Count() > 0)
            {
                thongtincongty = thongtincongtys.First();
            }

            if (thongtincongty.Banner != null)
            {
                banner = (int)thongtincongty.Banner;
            }
            if (thongtincongty.Slogan != null)
            {
                slogan = (int)thongtincongty.Slogan;
            }
            if (thongtincongty.Logo != null)
            {
                logo = (int)thongtincongty.Logo;
            }
            if (thongtincongty.TinTucGioiThieu != null)
            {
                gioithieu = thongtincongty.TinTucGioiThieu;
            }
        }
示例#2
0
        public bool suaThongTin(int id, String[] thongtin)
        {
            THONG_TIN_CONG_TY congty = da.searchCongTy(id);

            if (congty != null)
            {
                congty.TEN_CONG_TY = thongtin[0];
                congty.DIA_CHI     = thongtin[1];
                congty.DIEN_THOAI  = thongtin[2];
                congty.FAX         = thongtin[3];
                congty.WEBSITE     = thongtin[4];
                congty.EMAIL       = thongtin[5];
                congty.MA_SO_THUE  = thongtin[6];
                congty.LINH_VUC    = thongtin[7];
                congty.MO_TA       = thongtin[8];
                return(da.update());
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            //if (IsPostBack)
            {
                // Postback : được hiểu là khi user click vào Upload hoặc Submit
                // Vấn đề là button Submit : có handler là javascript (bắt buộc) nên không gọi vào sự kiện Click ở Server được => cần gom lại vào xử lý trong PageLoad luôn
                string strGioiThieu = rteGioiThieu.Text;
                Binary banner, slogan, logo;
                bool   bInsertNew = true;
                banner = getUploadImage(uploadBanner, sttBanner);
                slogan = getUploadImage(uploadSlogan, sttSlogan);
                logo   = getUploadImage(uploadLogo, sttLogo);
                // Tương tự cho các hình khác
                TRAVEL_WEBDataContext context = new TRAVEL_WEBDataContext();
                var thongtincongtys           = from t in context.THONG_TIN_CONG_Ties select t;
                var thongtincongty            = new THONG_TIN_CONG_TY();
                if (thongtincongtys.Count() > 0)
                {
                    bInsertNew     = false;
                    thongtincongty = thongtincongtys.First();
                }


                if (banner != null)
                {
                    if (thongtincongty.Banner == null)
                    {
                        thongtincongty.Banner = insertImage(banner);
                    }
                    else
                    {
                        updateImage(banner, (int)thongtincongty.Banner);
                    }
                }
                if (slogan != null)
                {
                    if (thongtincongty.Slogan == null)
                    {
                        thongtincongty.Slogan = insertImage(slogan);
                    }
                    else
                    {
                        updateImage(slogan, (int)thongtincongty.Slogan);
                    }
                }
                if (logo != null)
                {
                    if (thongtincongty.Logo == null)
                    {
                        thongtincongty.Logo = insertImage(logo);
                    }
                    else
                    {
                        updateImage(logo, (int)thongtincongty.Logo);
                    }
                }

                if (strGioiThieu != null)
                {
                    thongtincongty.TinTucGioiThieu = strGioiThieu;
                }

                if (bInsertNew == true)
                {
                    context.THONG_TIN_CONG_Ties.InsertOnSubmit(thongtincongty);
                }

                context.SubmitChanges();
            }


            int    bannerId, sloganId, logoId;
            string gioithieuHTML;

            getThongTin(out bannerId, out sloganId, out logoId, out gioithieuHTML);
            //imgBanner.ImageUrl = getImageURL(bannerId);
            //imgSlogan.ImageUrl = getImageURL(sloganId);
            //imgLogo.ImageUrl = getImageURL(logoId);
            rteGioiThieu.Text = gioithieuHTML;
        }