Пример #1
0
    protected void grd_news_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "btn_Edit")
        {
            Session["update_add_id"] = e.CommandArgument.ToString();
            Response.Redirect("Form_add.aspx");
        }

        if (e.CommandName == "btn_Delete")
        {
            DataTable data      = BAL_News.get_add_data(Convert.ToInt32(e.CommandArgument), 2);
            string    file_name = data.Rows[0]["add_image"].ToString();
            string    path      = Server.MapPath("../Admin-cp/img/add_image/" + file_name);
            FileInfo  file      = new FileInfo(path);
            if (file.Exists)
            {
                file.Delete();
                int delete = BAL_News.add_delete_status(Convert.ToInt32(e.CommandArgument), 1);
                if (delete > 0)
                {
                    Response.Write("<script> alert('Delete Sucess..') </script>");
                    Bind_Data();
                }
            }
        }

        if (e.CommandName == "btn_Status")
        {
            int status = BAL_News.add_delete_status(Convert.ToInt32(e.CommandArgument), 2);
            if (status > 0)
            {
                Bind_Data();
            }
        }
    }
    protected void grd_views_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        var a = e.CommandArgument.ToString();

        foreach (GridViewRow gvr in grd_views.Rows)
        {
            RadioButtonList rdo = (RadioButtonList)gvr.FindControl("rdo_confirm");
            HiddenField     h1  = (HiddenField)gvr.FindControl("hid_id");
            TextBox         txt = (TextBox)gvr.FindControl("txt_views");
            Button          btn = (Button)gvr.FindControl("btn_save");

            if (btn.CommandArgument.ToString() == a)
            {
                if (rdo.SelectedValue.ToString() == "0")
                {
                    Response.Write("<script> alert('Select [Yes] for change views') </script>");
                }
                else
                {
                    DataTable update = BAL_News.Get_data_for_fakeview(2, Convert.ToInt32(h1.Value), Convert.ToInt32(txt.Text));
                    if (update.Rows.Count > 0)
                    {
                        Response.Write("<script> alert('Error to save data !!') </script>");
                    }
                    else
                    {
                        Response.Write("<script> alert('Data Saved Sucess') </script>");
                    }
                }
                Response.Redirect("Form_manage_views.aspx");
            }
        }
    }
    public void Bind_Data()
    {
        DataTable data = BAL_News.get_old_news_data(fromdate.Value, todate.Value);

        grd_old_news.DataSource = data;
        grd_old_news.DataBind();
        bind_ddl_number();
    }
Пример #4
0
    public static string GetNewsByID(int nm_ID)
    {
        string    outdata;
        DataTable dt_SingleNews = BAL_News.Get_NewsByID(nm_ID);

        outdata = JsonConvert.SerializeObject(dt_SingleNews);
        return(outdata);
    }
Пример #5
0
    public string GetNewsByCategory(int Cat_ID)
    {
        string    outdata;
        DataTable dt_BranchWise = BAL_News.GetNewsbyCategory(Cat_ID);

        outdata = JsonConvert.SerializeObject(dt_BranchWise);
        return(outdata);
    }
Пример #6
0
    public string firstPageData()
    {
        string  outdata;
        DataSet ds_firstData = BAL_News.GetFirstData();

        outdata = JsonConvert.SerializeObject(ds_firstData);
        return(outdata);
    }
Пример #7
0
    public static string update_views(int old_view, int id)
    {
        string outdata      = null;
        string user_ip      = HttpContext.Current.Request.UserHostAddress.ToString();
        int    update_views = BAL_News.update_user_views(id, old_view, user_ip);

        outdata = JsonConvert.SerializeObject(update_views);
        return(outdata);
    }
Пример #8
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        int data = BAL_News.Insert_add(txt_link.Text, Convert.ToInt32(Session["update_add_id"]), Convert.ToInt32(ddl_cat.SelectedValue));

        if (data > 0)
        {
            this.save_image(data);
            Response.Redirect("List_add.aspx");
        }
    }
    public void Bind_Data()
    {
        DataTable dt = BAL_News.get_news_data(0, 1);

        if (dt.Rows.Count > 0)
        {
            grd_news.DataSource = dt;
            grd_news.DataBind();
            this.bind_ddl_number();
        }
    }
    public void Bind_Data()
    {
        DataTable dt = BAL_News.Get_data_for_fakeview(1, 0, 0);

        if (dt.Rows.Count > 0)
        {
            grd_views.DataSource = dt;
            grd_views.DataBind();
            this.bind_ddl_number();
        }
    }
    // fill the grid view
    private void FillGrid()
    {
        int TotalCount;

        gvCategory.PageIndex = gvIndex;
        DataTable table = BAL_News.GetNewsDetails(string.Empty, gvCategory.PageIndex, gvCategory.PageSize, out TotalCount);

        gvCategory.VirtualItemCount = TotalCount;
        gvCategory.DataSource       = table;
        gvCategory.DataBind();
    }
Пример #12
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        String str   = txt_link.Text;
        String Links = str.Replace("watch?v=", "embed/");
        int    data  = BAL_News.Insert(Convert.ToInt32(ddl_cat.SelectedValue), txt_title.Text, txt_short_desc.Text, txt_long_desc.Text, Links, txt_city.Text, Convert.ToInt32(Session["update_news_id"]));

        if (data > 0)
        {
            this.save_image(data);
            Response.Redirect("List_News_Master.aspx");
        }
    }
Пример #13
0
    private void FillGrid(string Title, string NewsDate)
    {
        int TotalCount;

        gvAdminList.PageIndex = gvIndex;
        DataTable table = BAL_News.GetNewsListInfo(gvAdminList.PageIndex, gvAdminList.PageSize, gvAdminList.OrderBy, Title, NewsDate, out TotalCount);

        gvAdminList.VirtualItemCount = TotalCount;
        gvAdminList.DataSource       = table;
        gvAdminList.DataBind();
        HideDispControl();
    }
Пример #14
0
    public void data()
    {
        DataTable dt = BAL_News.Get_catagory_for_ddl();

        if (dt.Rows.Count > 0)
        {
            ddl_cat.DataSource     = dt;
            ddl_cat.DataTextField  = "name";
            ddl_cat.DataValueField = "id";
            ddl_cat.DataBind();
        }
    }
    private void GetRecords()
    {
        DataTable table = BAL_News.GetNewsEventsListForNewsId(Convert.ToInt32(lblMode.Text));

        if (table != null && table.Rows.Count > 0)
        {
            txtTitle.Text    = Convert.ToString(table.Rows[0]["Title"]);
            txtDesc.Value    = Convert.ToString(table.Rows[0]["Description"]);
            txtLink.Text     = Convert.ToString(table.Rows[0]["NewsLink"]);
            txtNewsDate.Text = Convert.ToString(table.Rows[0]["NewsDate"]);
        }
    }
Пример #16
0
 public void save_image(int id)
 {
     if (img_news.HasFile)
     {
         string str     = img_news.FileName;
         var    fileExt = System.IO.Path.GetExtension(img_news.FileName).Substring(1);
         if (fileExt == "jpeg" || fileExt == "jpg" || fileExt == "png")
         {
             img_news.PostedFile.SaveAs(Server.MapPath("../Admin-cp/img/news_image/" + id + "." + fileExt));
             int image_save = BAL_News.Image_Update(id, id + "." + fileExt);
         }
     }
 }
Пример #17
0
 public void save_image(int id)
 {
     if (img_add.HasFile)
     {
         string str     = img_add.FileName;
         var    fileExt = System.IO.Path.GetExtension(img_add.FileName).Substring(1);
         if (fileExt == "jpeg" || fileExt == "jpg" || fileExt == "gif")
         {
             img_add.PostedFile.SaveAs(Server.MapPath("../Admin-cp/img/add_image/" + id + "." + fileExt));
             int image_save = BAL_News.Add_Image_Update(id, id + "." + fileExt);
         }
         else
         {
             Response.Write("<script>alert('Image not support jpg or jpeg required. || update image latter')</script>");
         }
     }
 }
Пример #18
0
    protected void btnActive_Click(object sender, EventArgs e)
    {
        string str = UpdateDetails();

        if (!string.IsNullOrEmpty(str))
        {
            if (BAL_News.ActivateNews(str, true))
            {
                ShowMessage("Record Activeted Succefully.");
                FillGrid();
            }
            else
            {
                ShowMessage("Error in record updatation.");
            }
        }
    }
Пример #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["update_add_id"] != "" || Session["update_add_id"] != null)
         {
             DataTable dt = BAL_News.get_add_data(Convert.ToInt32(Session["update_add_id"]), 2);
             if (dt.Rows.Count > 0)
             {
                 ddl_cat.SelectedValue = dt.Rows[0]["add_cat_id"].ToString();
                 txt_link.Text         = dt.Rows[0]["add_link"].ToString();
                 imgshow.Src           = "img/add_image/" + dt.Rows[0]["add_image"].ToString();
                 add_container.Visible = true;
                 RFV_Img.Visible       = false;
             }
         }
         this.check_session();
     }
 }
Пример #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         data();
         if (Session["update_news_id"] != "" || Session["update_news_id"] != null)
         {
             DataTable dt = BAL_News.get_news_data(Convert.ToInt32(Session["update_news_id"]), 2);
             if (dt.Rows.Count > 0)
             {
                 ddl_cat.SelectedValue  = dt.Rows[0]["nm_cat_id"].ToString();
                 txt_title.Text         = dt.Rows[0]["nm_head_line"].ToString();
                 txt_short_desc.Text    = dt.Rows[0]["nm_short_desc"].ToString();
                 txt_long_desc.Text     = dt.Rows[0]["nm_full_desc"].ToString();
                 txt_link.Text          = dt.Rows[0]["nm_video_link"].ToString();
                 txt_city.Text          = dt.Rows[0]["nm_city"].ToString();
                 imgshow.Src            = "img/news_image/" + dt.Rows[0]["nm_image"].ToString();
                 news_container.Visible = true;
                 RFV_Img.Visible        = false;
             }
         }
         this.check_session();
     }
 }