示例#1
0
        private void loadSlideshow(int id)
        {
            Cooperative_Image_Info Info = new Cooperative_Image_Info(id);
            DataTable nTable            = Cooperative_Image_Data.GetListbyCoop(id);
            string    shead             = "";
            string    sbody             = "";

            for (int i = 0; i < nTable.Rows.Count; i++)
            {
                if (i > 0)
                {
                    shead += "<li data-target='#carousel-example-generic' data-slide-to='" + i + "'></li>";
                    sbody += @"<div class='item'><img class='img-responsive' style='max-height: 400px;' height = '400px' width = '1200px' src='" + urldomain + "/" + nTable.Rows[i]["Images"].ToString().Substring(3) + "'></div>";
                }
                else
                {
                    shead += "<li data-target='#carousel-example-generic' data-slide-to='" + i + "' class='active'></li>";
                    sbody += @"<div class='item active'><img class='img-responsive' style='max-height: 400px;' height = '400px' width = '1200px' src='" + urldomain + "/" + nTable.Rows[i]["Images"].ToString().Substring(3) + "'></div>";
                }
            }
            ltSlideshow.Text = @"<ol class='carousel-indicators'>" + shead + @"</ol> <div class='carousel-inner' role='listbox'>" + sbody + "</div>";
        }
示例#2
0
        protected void SaveInfo()
        {
            DateTime DateRange      = new DateTime();
            DateTime DateExpiration = new DateTime();

            if (txtDateRange.Text != "")
            {
                DateRange = DateTime.ParseExact(txtDateRange.Text, "dd/MM/yyyy", null);
            }
            if (txtDateExpiration.Text != "")
            {
                DateExpiration = DateTime.ParseExact(txtDateExpiration.Text, "dd/MM/yyyy", null);
            }
            Cooperative_Info cop = new Cooperative_Info();

            cop.Cooperative_Key    = Convert.ToInt32(lbkey.Text);
            cop.Cooperative_ID     = txtCooperative_ID.Text;
            cop.Cooperative_Name   = txtCooperative_Name.Text;
            cop.ProvincesCities_ID = ddProvincesCitiesID.SelectedValue;
            cop.Address            = txtAddress.Text;
            cop.VietGAPCode        = txtVietGAPCode.Text;
            cop.Phone                 = txtPhone.Text;
            cop.Members               = Convert.ToInt32(txtMembers.Text);
            cop.Area                  = Convert.ToInt32(txtArea.Text);
            cop.Quantity              = Convert.ToInt32(txtQuantity.Text);
            cop.TreeType              = txtTreeType.Text;
            cop.DateRange             = DateRange;
            cop.DateExpiration        = DateExpiration;
            cop.Owner                 = txtOwner.Text;
            cop.Description           = txtDescription.Text;
            cop.CertifiedOrganization = ddCertifiedOrganization.SelectedValue;
            string[] arrListStr = txtlat.Text.Split(',');
            cop.Lat    = arrListStr[0];
            cop.Lng    = arrListStr[1];
            cop.Images = ddImage.SelectedValue;
            if (FileUploadControl.HasFile)
            {
                try
                {
                    string filename = Path.GetFileName(FileUploadControl.FileName);
                    FileUploadControl.SaveAs(Server.MapPath("~/Img/Tree/") + filename);
                    cop.Images = filename;
                }
                catch (Exception ex) {}
            }
            cop.Save();
            Cooperative_Image_Info cooImg = new Cooperative_Image_Info();

            if (FileUpload1.HasFile)
            {
                try{
                    string Name = lbkey.Text + "_1";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img1.png";
                    FileUpload1.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }catch (Exception ex) { }
            }
            if (FileUpload2.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_2";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img2.png";
                    FileUpload2.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload3.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_3";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img3.png";
                    FileUpload3.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload4.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_4";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img4.png";
                    FileUpload4.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload5.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_5";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img5.png";
                    FileUpload5.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload6.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_6";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img6.png";
                    FileUpload6.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload7.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_7";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img7.png";
                    FileUpload7.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload8.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_8";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img8.png";
                    FileUpload8.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload9.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_9";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img9.png";
                    FileUpload9.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload10.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_10";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img10.png";
                    FileUpload10.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
        }