Esempio n. 1
0
        public NewsLetterDom ReadNewsLetterById(int topicId)
        {
            NewsLetterDom newsdom = new NewsLetterDom();

            newsdom = newsDAL.ReadNewsLetterById(topicId);
            return(newsdom);
        }
Esempio n. 2
0
        public void SetControlName(NewsLetterDom newsdom)
        {
            Literal lit = new Literal();

            lit.Mode = LiteralMode.PassThrough;
            string TopicName = newsdom.TopicName.ToString();

            lit.Text      = HttpUtility.HtmlDecode(TopicName);
            literal2.Text = lit.Text;


            // added by divaker..
            var date = newsdom.NewsDate;

            lit.Text      = HttpUtility.HtmlDecode(date);
            literal3.Text = lit.Text;
            var description = newsdom.Description;

            lit.Text      = HttpUtility.HtmlDecode(description);
            literal4.Text = lit.Text;

            var docName = Convert.ToString(newsdom.ImageName);

            lit.Text          = HttpUtility.HtmlDecode(docName);
            VisaFormLink.Text = HttpUtility.HtmlDecode(docName);
            string atag = "/AddVisaForm/" + newsdom.ImageName;

            VisaFormLink.NavigateUrl = atag;
            //literal5.Text = lit.Text;
        }
Esempio n. 3
0
        protected void btnUpload1_Click(object sender, EventArgs e)
        {
            Int64 fileSize = uploadimage.PostedFile.ContentLength;

            if (!string.IsNullOrEmpty(uploadimage.FileName))
            {
                if ((uploadimage.HasFile) && (fileSize < 2097151000000))
                {
                    string fileExtension = Path.GetExtension(uploadimage.FileName);
                    fileExtension = fileExtension.ToLower();
                    string[] acceptedFileTypes = new string[8];
                    acceptedFileTypes[0] = ".pdf";
                    acceptedFileTypes[1] = ".doc";
                    acceptedFileTypes[2] = ".docx";
                    acceptedFileTypes[3] = ".jpg";
                    acceptedFileTypes[5] = ".xls";
                    acceptedFileTypes[6] = ".zip";
                    acceptedFileTypes[7] = ".txt";
                    bool acceptFile = false;

                    for (int i = 0; i <= 7; i++)
                    {
                        if (fileExtension == acceptedFileTypes[i])
                        {
                            acceptFile = true;
                        }
                    }

                    if (!acceptFile)
                    {
                        lblfile.Visible = true;
                        lblfile.Text    = "only .pdf, .doc, .docx, .jpg, .xls, .zip types are allowed";
                        return;
                    }
                    NewsLetterDom newsdom = new NewsLetterDom();
                    newsdom.ImageName = uploadimage.FileName;
                    string filename1 = Path.GetFileName(uploadimage.PostedFile.FileName);
                    uploadimage.SaveAs(Server.MapPath("~/AddVisaForm/" + filename1));
                    lnkbtn1.Text         = filename1;
                    Session["ImageName"] = filename1;
                    List <NewsLetterDom> lstnews = new List <NewsLetterDom>();
                    lstnews.Add(newsdom);
                    grvw_image.DataSource = lstnews;
                    grvw_image.DataBind();
                    grvw_image.Visible = true;
                    ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('File uploaded successfully')", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('File Size is too large')", true);
                }
            }


            else
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('Please Choose The File Name ')", true);
            }
        }
Esempio n. 4
0
 public void SetControlName(NewsLetterDom newsdom)
 {
     txtTopic.Text = newsdom.TopicName;
     txtdes.Text   = newsdom.Description;
     literal2.Text = newsdom.TopicName;
     literal1.Text = newsdom.Description;
     lnkbtn1.Text  = newsdom.ImageName;
 }
Esempio n. 5
0
        protected void btnUpdate_Click1(object sender, EventArgs e)
        {
            List <NewsLetterDom> lstdom = new List <NewsLetterDom>();

            lstdom = (List <NewsLetterDom>)Session["f"];
            int out1 = 0;

            if (Session["ImageName"] != null)
            {
                NewsLetterDom newdom = new NewsLetterDom();
                newdom.TopicId       = this.TopicId;
                newdom.TopicName     = txtTopic.Text;
                newdom.Description   = txtdes.Text;
                newdom.ImageName     = Session["ImageName"].ToString();
                newdom.Modified_By   = "Admin";
                newdom.Modified_Date = DateTime.Now;
                out1 = newsbal.UpdateNewsLetter(newdom);
            }
            else
            {
                if (lstdom != null)
                {
                    List <NewsLetterDom> lstdomNew = new List <NewsLetterDom>();
                    NewsLetterDom        newdom    = new NewsLetterDom();
                    newdom.TopicId       = this.TopicId;
                    newdom.TopicName     = txtTopic.Text;
                    newdom.Description   = txtdes.Text;
                    newdom.ImageName     = lstdom[0].ImageName;
                    newdom.Modified_By   = "Admin";
                    newdom.Modified_Date = DateTime.Now;
                    out1 = newsbal.UpdateNewsLetter(newdom);
                }
                else
                {
                    NewsLetterDom newdom = new NewsLetterDom();
                    newdom.TopicId       = this.TopicId;
                    newdom.TopicName     = txtTopic.Text;
                    newdom.Description   = txtdes.Text;
                    newdom.Modified_By   = "Admin";
                    newdom.Modified_Date = DateTime.Now;
                    out1 = newsbal.UpdateNewsLetter(newdom);
                }
            }
            if (out1 > 0)
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('NewsLetter Updated Successfully')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('NewsLetter Not Updated')", true);
            }
            BindNewsLetter();
            Cancel();
            btnSave.Visible   = true;
            btnUpdate.Visible = false;
            // Session.Remove("FileName");
        }
Esempio n. 6
0
        protected void gvwNews_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int topicId = 0;

            topicId = Convert.ToInt32(e.CommandArgument);
            var id = topicId;

            this.TopicId = id;
            List <NewsLetterDom> lstNews = new List <NewsLetterDom>();

            if (e.CommandName == "cmdEdit")
            {
                NewsLetterDom newsDom = new NewsLetterDom();
                SetControlName(GetNewById(topicId));
                string imageName = newsDom.ImageName;
                newsDom = newsbal.ReadNewsLetterByImage(topicId, imageName);
                lstNews.Add(newsDom);
                string Name = lstNews[0].ImageName;
                if (lstNews.Count > 0 && Name != null)
                {
                    grvw_image.DataSource = lstNews;
                    grvw_image.DataBind();
                }
                else
                {
                    grvw_image.DataSource = null;
                    grvw_image.DataBind();
                }
                // grvw_image.Visible = true;
                TabContainer1.ActiveTabIndex = 0;
                btnUpdate.Visible            = true;
                btnSave.Visible = false;
                Session["f"]    = lstNews;
            }
            if (e.CommandName == "cmdelete")
            {
                newsbal.DeleteNewsLetter(topicId, "Admin", DateTime.Now);
                BindNewsLetter();
                Cancel();
            }
            if (e.CommandName == "cmdDetails")
            {
                SetControlName(GetNewById(topicId));
                ModalPopupExtender2.Show();
                Cancel();
            }
        }
Esempio n. 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int out1 = 0;

            if (Session["ImageName"] != null)
            {
                NewsLetterDom newsdom = new NewsLetterDom();
                newsdom.TopicName   = txtTopic.Text;
                newsdom.Description = txtdes.Text;
                newsdom.Created_By  = "Admin";
                newsdom.ImageName   = Session["ImageName"].ToString();
                out1 = newsbal.CreateNewsLetter(newsdom);
            }
            else
            {
                NewsLetterDom newsdom = new NewsLetterDom();
                newsdom.TopicName   = txtTopic.Text;
                newsdom.Description = txtdes.Text;
                newsdom.Created_By  = "Admin";
                out1 = newsbal.CreateNewsLetter(newsdom);
            }


            if (out1 > 0)
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('NewsLetter Created Successfully')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, GetType(), "test", "alert('NewsLetter Not Created ')", true);
            }

            BindNewsLetter();
            Cancel();
            // grvw_image.Visible = false;
            Session.Remove("ImageName");
        }
Esempio n. 8
0
        public int CreateNewsLetter(NewsLetterDom newsdom)
        {
            int topicId = newsDAL.CreateNewsLetter(newsdom);

            return(topicId);
        }