protected void btnDeleteCurrentFile_Click(object sender, EventArgs e)
 {
     Announcement objData = new Announcement();
     objData = CurrentAnnouncement;
     objData.SetColumnNull(Announcement.ColumnNames.UploadedFile);
     objData.Save();
     txtCurrentFile.Text = "";
     txtCurrentFile.Visible = false;
     btnDeleteCurrentFile.Visible = false;
     lblCurrentFile.Visible = false;
 }
Пример #2
0
        private void LoadWidgets()
        {
            Announcement all = new Announcement();
            all.GetTopCirculars();

            uiRepeaterCirculars.DataSource = all.DefaultView;
            uiRepeaterCirculars.DataBind();

            Announcement Bulletins = new Announcement();
            Bulletins.GetTopBulletins();

            uiRepeaterBulletins.DataSource = Bulletins.DefaultView;
            uiRepeaterBulletins.DataBind();

            Announcement Blogs = new Announcement();
            Blogs.GetTopBlogs();

            uiRepeaterBlogs.DataSource = Blogs.DefaultView;
            uiRepeaterBlogs.DataBind();

            UsefulLink Links = new UsefulLink();
            Links.GetAllLinks();

            uiRepeaterLinks.DataSource = Links.DefaultView;
            uiRepeaterLinks.DataBind();
        }
Пример #3
0
 private void LoadCircularsPublic()
 {
     Announcement all = new Announcement();
     all.GetAllBlogsPublic();
     uiRadListViewCircularsPublic.DataSource = all.DefaultView;
     uiRadListViewCircularsPublic.DataBind();
 }
Пример #4
0
        private void LoadCircularsGroup()
        {
            UsersProfiles userProf = new UsersProfiles();
            userProf.getUserByGUID(new Guid(Membership.GetUser(Page.User.Identity.Name).ProviderUserKey.ToString()));

            Announcement all = new Announcement();
            all.GetAllBlogsGroups(userProf.GroupID);
            uiRadListViewCircularsGroup.DataSource = all.DefaultView;
            uiRadListViewCircularsGroup.DataBind();
        }
Пример #5
0
 private void LoadCurrent()
 {
     Announcement current = new Announcement();
     if (current.LoadByPrimaryKey(CurrentAnnouncement))
     {
         uiLabelTitle.Text = current.Title;
         uiLabelDate.Text = current.CreatedDate.ToString("dd MMM yyyy");
         if (!current.IsColumnNull(Announcement.ColumnNames.CreatedBy))
             uiLabelCreator.Text = Membership.GetUser(new Guid(current.CreatedBy.ToString())).UserName;
         uiLiteralContent.Text = Server.HtmlDecode(current.Content);
         uiImageMain.ImageUrl = string.IsNullOrEmpty(current.MainPic) ? "../img/announcement-icon.png" : current.MainPic;
         if (string.IsNullOrWhiteSpace(current.UploadedFile))
         {
             btnDownloadAttachment.Visible = false;
         }
         else
         {
             btnDownloadAttachment.HRef = current.UploadedFile;
             btnDownloadAttachment.Attributes.Add("download", current.UploadedFile.Substring(current.UploadedFile.LastIndexOf('/') + 1));
         }
     }
 }
        protected void uiButtonSave_Click(object sender, EventArgs e)
        {
            Announcement objdata = new Announcement();
            if (CurrentAnnouncement == null)
            {
                objdata.AddNew();
                objdata.CreatedBy = new Guid(Membership.GetUser().ProviderUserKey.ToString());
                objdata.CreatedDate = DateTime.Now;
            }
            else
            {
                objdata = CurrentAnnouncement;
                AnnouncementGroup AnnGroup = new AnnouncementGroup();
                AnnGroup.Where.AnnouncementID.Value = CurrentAnnouncement.AnnouncementID;
                AnnGroup.Where.AnnouncementID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                AnnGroup.Query.Load();
                AnnGroup.DeleteAll();
                AnnGroup.Save();
            }
            objdata.Title = uiTextBoxTitle.Text;
            objdata.Brief = uiTextBoxBrief.Text;
            objdata.IsBulletin = true;

            //objdata.CreatedBy = uiTextBoxCreatedBy.Text;

            if (uiFileUploadImg.HasFile)
            {
                string path = "/fileuploads/circulars/" + Guid.NewGuid() + "_" + uiFileUploadImg.FileName;
                uiFileUploadImg.SaveAs(Server.MapPath("~" + path));
                objdata.MainPic = path;
            }
            objdata.Content = Server.HtmlEncode(uiRadEditorContnet.Content);

            if (Session["CurrentUploadedFiles"] != null)
            {
                Hashtable Files;
                Files = (Hashtable)Session["CurrentUploadedFiles"];

                if (Files.Count > 0)
                {
                    foreach (DictionaryEntry item in Files)
                    {
                        objdata.UploadedFile = item.Value.ToString();
                    }

                    Session["CurrentUploadedFiles"] = null;
                }
            }

            //if (DropDownListGroups.SelectedValue =="0")
            //{
            //    objdata.SetColumnNull(Announcement.ColumnNames.GroupID);
            //}
            //else
            //{
            //    objdata.GroupID = int.Parse(DropDownListGroups.SelectedValue.ToString());
            //}

            objdata.Save();

            foreach (ListItem item in CheckBoxListGroups.Items)
            {
                if (item.Selected && item.Value != "0")
                {
                    AnnouncementGroup newAnnGroup = new AnnouncementGroup();
                    newAnnGroup.AddNew();
                    newAnnGroup.AnnouncementID = objdata.AnnouncementID;
                    newAnnGroup.GroupID = int.Parse(item.Value);
                    newAnnGroup.Save();
                }
            }

            BindData();
            CurrentAnnouncement = null;
            uiPanelViewAll.Visible = true;
            uiPanelEdit.Visible = false;
            ClearFields();

            SendingNotifications.sendNotif(2, null, null, null, null, null, null, null);
        }
 private void BindData()
 {
     Announcement objdata = new Announcement();
     objdata.GetAllBulletins();
     uiRadGridcirculars.DataSource = objdata.DefaultView;
     uiRadGridcirculars.DataBind();
 }
        protected void uiRadGridcirculars_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditCircular")
            {
                Announcement objData = new Announcement();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxTitle.Text = objData.Title;
                uiRadEditorContnet.Content = Server.HtmlDecode(objData.Content);
                //uiTextBoxCreatedBy.Text = objData.CreatedBy;
                if (!objData.IsColumnNull(Announcement.ColumnNames.MainPic))
                {
                    uiImageMain.ImageUrl = objData.MainPic;
                    uiImageMain.Visible = true;
                }
                else
                    uiImageMain.Visible = false;

                if (!objData.IsColumnNull(Announcement.ColumnNames.UploadedFile))
                {
                    txtCurrentFile.Visible = true;
                    btnDeleteCurrentFile.Visible = true;
                    lblCurrentFile.Visible = true;
                    txtCurrentFile.Text = objData.UploadedFile.Substring(objData.UploadedFile.LastIndexOf('/') + 1);
                }

                CheckBoxListGroups.ClearSelection();

                AnnouncementGroup objDataAnnouncement = new AnnouncementGroup();
                objDataAnnouncement.Where.AnnouncementID.Value = objData.AnnouncementID;
                objDataAnnouncement.Where.AnnouncementID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                objDataAnnouncement.Query.Load();

                foreach (ListItem item in CheckBoxListGroups.Items)
                {
                    for (int i = 0; i < objDataAnnouncement.RowCount; i++)
                    {
                        if (objDataAnnouncement.GroupID == int.Parse(item.Value.ToString()))
                        {
                            item.Selected = true;
                            break;
                        }
                        objDataAnnouncement.MoveNext();
                    }
                    objDataAnnouncement.Rewind();
                }

                uiTextBoxBrief.Text = objData.Brief;
                CurrentAnnouncement = objData;
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;
            }

            else if (e.CommandName == "DeleteCircular")
            {
                Announcement objData = new Announcement();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                AnnouncementGroup groups = new AnnouncementGroup();
                groups.GetGroupsByAnnouncementID(Convert.ToInt32(e.CommandArgument.ToString()));
                groups.DeleteAll();
                groups.Save();

                objData.MarkAsDeleted();
                objData.Save();
                BindData();
            }
        }
 protected void uiLinkButtonCancel_Click(object sender, EventArgs e)
 {
     CurrentAnnouncement = null;
     uiPanelViewAll.Visible = true;
     uiPanelEdit.Visible = false;
     ClearFields();
 }