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);
        }
        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();
            }
        }