Ejemplo n.º 1
0
 protected void Update_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Data.GroupImages obj = new Data.GroupImages();
         obj.Id       = Id;
         obj.Name     = txtName.Text;
         obj.Level    = Level + "00000";
         obj.Language = ddlLanguage.SelectedValue;
         obj.Ord      = txtOrd.Text != "" ? txtOrd.Text : "1";
         obj.Active   = chkActive.Checked ? "1" : "0";
         if (Insert == true)
         {
             GroupImagesService.GroupImages_Insert(obj);
         }
         else
         {
             GroupImagesService.GroupImages_Update(obj);
         }
         BindGrid();
         pnView.Visible   = true;
         pnUpdate.Visible = false;
         Level            = "";
         Insert           = false;
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Page.RouteData.Values["GroupId"] != null)
         {
             GroupId = Page.RouteData.Values["GroupId"] as string;
         }
         if (Lang == "en")
         {
             Page.Title = "VietNam Association Of Social Psychology";
         }
         else
         {
             Page.Title = "Hội Tâm Lý Học Xã Hội Việt Nam";
         }
         if (!IsPostBack)
         {
             if (Request.Cookies["CurrentLanguage"] != null)
             {
                 Lang = Request.Cookies["CurrentLanguage"].Value;
             }
             List <GroupImages> listGrp = GroupImagesService.GroupImages_GetByTop("", "Active=1 AND Language='" + Lang + "'", "Ord");
             if (listGrp.Count > 0)
             {
                 if (string.IsNullOrEmpty(GroupId))
                 {
                     GroupId = listGrp[0].Id;
                 }
                 for (int i = 0; i < listGrp.Count; i++)
                 {
                     if (listGrp[i].Id == GroupId)
                     {
                         GroupName  = listGrp[i].Name;
                         Page.Title = GroupName;
                         break;
                     }
                 }
                 rptGroupImages.DataSource = listGrp;
                 rptGroupImages.DataBind();
                 List <Data.Images> listImages = ImagesService.Images_GetByTop("", "Active = 1 AND GroupId = '" + GroupId + "'", "Ord");
                 for (int i = 0; i < listImages.Count; i++)
                 {
                     //ltrImages.Text += "<a href=http://unitegallery.net>\n";
                     ltrImages.Text += "<img alt='" + GroupName + "'\n";
                     ltrImages.Text += "src='" + StringClass.ThumbImage(listImages[i].Image) + "'\n";
                     ltrImages.Text += "data-image='" + listImages[i].Image + "'\n";
                     ltrImages.Text += "style='display:none'>";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MailSender.SendMail("", "", "Error System", ex.Message);
     }
 }
Ejemplo n.º 3
0
 private void BindGrid()
 {
     grdGroupImages.DataSource = GroupImagesService.GroupImages_GetByAll();
     grdGroupImages.DataBind();
     if (grdGroupImages.PageCount <= 1)
     {
         grdGroupImages.PagerStyle.Visible = false;
     }
     else
     {
         grdGroupImages.PagerStyle.Visible = true;
     }
 }
Ejemplo n.º 4
0
		protected void DeleteButton_Click(object sender, EventArgs e)
		{
			DataGridItem item = default(DataGridItem);
			for (int i = 0; i < grdGroupImages.Items.Count; i++)
			{
				item = grdGroupImages.Items[i];
				if (item.ItemType == ListItemType.AlternatingItem | item.ItemType == ListItemType.Item)
				{
					if (((CheckBox)item.FindControl("ChkSelect")).Checked)
					{
						string strId = item.Cells[1].Text;
                        GroupImagesService.GroupImages_Delete(strId);
                        SqlDataProvider sql = new SqlDataProvider();
                        sql.ExecuteNonQuery("Delete From [Images] where GroupId='" + strId + "'");
					}
				}
			}
			grdGroupImages.CurrentPageIndex = 0;
			BindGrid();
		}
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Page.RouteData.Values["GroupId"] != null)
         {
             GroupId = Page.RouteData.Values["GroupId"] as string;
         }
         if (!IsPostBack)
         {
             List <GroupImages> listGrp;
             if (GroupId != null)
             {
                 listGrp = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Ord");
             }
             else
             {
                 listGrp = GroupImagesService.GroupImages_GetById(GroupId);
             }
             if (listGrp.Count > 0)
             {
                 groupName = listGrp[0].Name;
                 List <Data.Images> listImages = ImagesService.Images_GetByTop("", "Active = 1 AND GroupId = '" + listGrp[0].Id + "'", "Ord");
                 for (int i = 0; i < listImages.Count; i++)
                 {
                     ltrImages.Text += "<a href=#>\n";
                     ltrImages.Text += "<img alt='" + groupName + "'\n";
                     ltrImages.Text += "src='" + StringClass.ThumbImage(listImages[i].Image) + "'\n";
                     ltrImages.Text += "data-image='" + listImages[i].Image + "'\n";
                     ltrImages.Text += "style='display:none'></a>";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace);
     }
 }