Exemple #1
0
        public void LoadImage()
        {
            int NewsID = int.Parse(lbl_News_ID.Text);
            int type   = 0; try { type = int.Parse(Request["TypeID"].ToString()); }

            catch {; }
            HPCBusinessLogic.ImageFilesDAL image = new HPCBusinessLogic.ImageFilesDAL();
            DataSet ds = new DataSet();
            string  loaitinbaiID = "", loaianhID = "", loaivideoID = "";

            loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString();
            loaianhID    = ConfigurationManager.AppSettings["ImageType"].ToString();
            loaivideoID  = ConfigurationManager.AppSettings["VideoType"].ToString();
            if (type.ToString() == loaitinbaiID)
            {
                HPCBusinessLogic.DAL.T_NewsDAL objnews = new HPCBusinessLogic.DAL.T_NewsDAL();
                lbl_tieude.Text = objnews.GetOneFromT_NewsByID(NewsID).News_Tittle;
            }
            else if (type.ToString() == loaianhID)
            {
                HPCBusinessLogic.DAL.T_Album_CategoriesDAL objnews = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
                lbl_tieude.Text = objnews.load_T_Album_Categories(NewsID).Cat_Album_Name;
            }

            ds = image.ListAllImagesInNews(NewsID, type);
            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                dgr_anh.DataSource = dt.DefaultView;
                dgr_anh.DataBind();
                foreach (DataGridItem item in dgr_anh.Items)
                {
                    item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'");
                    item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor");
                    TextBox txt_tien = (TextBox)item.FindControl("txt_tien");
                    //txt_tien.Text = string.Format("{0:#,#}", txt_tien.Text).Replace(".", ",");
                    double _money = 0;
                    try
                    {
                        _money = double.Parse(txt_tien.Text);
                    }
                    catch
                    { _money = 0; }
                    txt_tien.Text = string.Format("{0:#,#}", _money).Replace(".", ",");
                }
            }
        }
 public void grdList_EditCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandArgument.ToString().ToLower() == "isunlock")
     {
         double _ID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
         bool check = _untilDAL.GetOneFromT_NewsByID(_ID).News_Lock;
         if (check)
         {
             _untilDAL.UpdateFromT_NewsDynamic(" News_Lock = 0 Where News_ID = " + _ID);
             string strLog = "[Update News_Lock T_News 0]-->[T_News :ID: " + _ID + " Tittle: " + _untilDAL.GetOneFromT_NewsByID(_ID).News_Tittle + "]";
             WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Un Lock]", Request["Menu_ID"].ToString(), strLog, _ID, ConstAction.BaoDT);
             this.LoadData();
         }
     }
     if (e.CommandArgument.ToString().ToLower() == "downloadalias")
     {
         int _ID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         LoadFileDoc(_ID);
     }
 }
Exemple #3
0
        public void LoadImage()
        {
            int NewsID = int.Parse(lbl_News_ID.Text);
            int type   = 1; try

            {
                if (Request["TypeID"] != null)
                {
                    type = int.Parse(Request["TypeID"].ToString());
                }
            }
            catch {; }
            string loaitinbaiID = string.Empty, loaianhID = string.Empty, loaivideoID = string.Empty;

            loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString();
            loaianhID    = ConfigurationManager.AppSettings["ImageType"].ToString();
            loaivideoID  = ConfigurationManager.AppSettings["VideoType"].ToString();
            if (type.ToString() == loaitinbaiID)
            {
                HPCBusinessLogic.DAL.T_NewsDAL objnews = new HPCBusinessLogic.DAL.T_NewsDAL();
                lbl_tieude.Text = objnews.GetOneFromT_NewsByID(NewsID).News_Tittle;
            }
            else if (type.ToString() == loaianhID)
            {
                HPCBusinessLogic.DAL.T_Album_CategoriesDAL objnews = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
                lbl_tieude.Text = objnews.load_T_Album_Categories(NewsID).Cat_Album_Name;
            }
            HPCBusinessLogic.ImageFilesDAL image = new HPCBusinessLogic.ImageFilesDAL();
            DataSet ds = new DataSet();

            ds = image.ListAllImagesInNews(NewsID, type);
            DataTable dt = ds.Tables[0];

            dgr_anh.DataSource = dt.DefaultView;
            dgr_anh.DataBind();
            //string _str_ID = "'";
            //string _strtextID = "'";
            //int i = 0;
            foreach (DataGridItem item in dgr_anh.Items)
            {
                item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'");
                item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor");

                TextBox txt_tienNB = (TextBox)item.FindControl("txt_tiennhanbut");
                //TextBox txt_tacgia = (TextBox)item.FindControl("txt_nguonanh");
                //TextBox txt_tacgiaID = (TextBox)item.FindControl("txt_tacgiaID");
                //if (i == 0)
                //{
                //    _str_ID = _str_ID + txt_tacgiaID.ClientID;
                //    _strtextID = _strtextID + txt_tacgia.ClientID;
                //}
                //else
                //{
                //    _str_ID = _str_ID + "," + txt_tacgiaID.ClientID;
                //    _strtextID = _strtextID + "," + txt_tacgia.ClientID;
                //}
                //i++;
                if (!string.IsNullOrEmpty(txt_tienNB.Text))
                {
                    txt_tienNB.Text = string.Format("{0:#,#}", double.Parse(txt_tienNB.Text.Replace(",", ""))).Replace(".", ",");
                }
            }
            //_str_ID = _str_ID + "'";
            //_strtextID = _strtextID + "'";
            //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " AutoCompleteSearch_Author(" + _strtextID + "," + _str_ID + ");", true);
        }