Beispiel #1
0
        protected void cmd_chamall_Click(object sender, EventArgs e)
        {
            HPCBusinessLogic.DAL.T_ButdanhDAL obj_BD_DAL = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            HPCBusinessLogic.ImageFilesDAL    obj        = new HPCBusinessLogic.ImageFilesDAL();
            int type = 1; try { type = int.Parse(Request["TypeID"].ToString()); }

            catch {; }
            if (checkCham.Checked)
            {
                int tien = 0;
                if (!string.IsNullOrEmpty(txt_tienNB.Text.Trim()))
                {
                    try { tien = int.Parse(txt_tienNB.Text.Trim().Replace(",", "")); }
                    catch { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alrt('Tiền phải nhập kiểu số nguyên');", true); return; }
                    foreach (DataGridItem item in dgr_anh.Items)
                    {
                        int   newid        = int.Parse(lbl_News_ID.Text);
                        Label lbl_Image_ID = (Label)item.FindControl("lbl_Image_ID");
                        int   ImageID      = int.Parse(lbl_Image_ID.Text);

                        HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL();
                        _Obj.Update_TiennhanbutAnh(type, newid, int.Parse(lbl_Image_ID.Text), tien, _user.UserID);

                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, " ",
                                                                       Request["Menu_ID"].ToString(), "Duyệt ảnh ", int.Parse(lbl_Image_ID.Text), ConstAction.BaoDT);
                    }
                }
            }
            else
            {
                foreach (DataGridItem item in dgr_anh.Items)
                {
                    TextBox txt_tiennhanbut = (TextBox)item.FindControl("txt_tiennhanbut");
                    if (!string.IsNullOrEmpty(txt_tiennhanbut.Text))
                    {
                        try { int.Parse(txt_tiennhanbut.Text.Replace(",", "")); }
                        catch { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alrt('Tiền phải nhập kiểu số nguyên');", true); return; }
                    }
                }
                foreach (DataGridItem item in dgr_anh.Items)
                {
                    TextBox txt_tiennhanbut = (TextBox)item.FindControl("txt_tiennhanbut");
                    int     newid           = int.Parse(lbl_News_ID.Text);
                    Label   lbl_Image_ID    = (Label)item.FindControl("lbl_Image_ID");
                    int     ImageID         = int.Parse(lbl_Image_ID.Text);
                    int     tien            = 0;
                    if (!string.IsNullOrEmpty(txt_tiennhanbut.Text))
                    {
                        tien = int.Parse(txt_tiennhanbut.Text.Replace(",", ""));
                    }

                    HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL();
                    _Obj.Update_TiennhanbutAnh(type, newid, ImageID, tien, _user.UserID);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, " ",
                                                                   Request["Menu_ID"].ToString(), "Duyệt ảnh ", int.Parse(lbl_Image_ID.Text), ConstAction.BaoDT);
                }
            }
            LoadImage();
        }
Beispiel #2
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(".", ",");
                }
            }
        }
Beispiel #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);
        }
Beispiel #4
0
        protected void dgr_anh_EditCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandArgument.ToString().ToLower() == "edittt")
            {
                Label        lbl_CL       = (Label)e.Item.FindControl("lblchatluong");
                Label        lbl_CLID     = (Label)e.Item.FindControl("lblchatluongID");
                DropDownList Drop_CL      = (DropDownList)e.Item.FindControl("ddlnews_chatluong");
                ImageButton  Image_Edit   = (ImageButton)e.Item.FindControl("btnEdit");
                ImageButton  Image_Update = (ImageButton)e.Item.FindControl("btnUpdate");
                ImageButton  Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel");

                if (lbl_CLID.Text.ToLower() != "null" && !string.IsNullOrEmpty(lbl_CLID.Text))
                {
                    Drop_CL.SelectedIndex = int.Parse(lbl_CLID.Text.Trim());
                }
                Image_Edit.Visible   = false;
                Image_Update.Visible = true;
                Image_Cancel.Visible = true;
                lbl_CL.Visible       = false;
                Drop_CL.Visible      = true;
            }
            else if (e.CommandArgument.ToString().ToLower() == "update")
            {
                Label        lbl_CL       = (Label)e.Item.FindControl("lblchatluong");
                Label        lbl_Nguonanh = (Label)e.Item.FindControl("lbl_Nguonanh");
                Label        lbl_CLID     = (Label)e.Item.FindControl("lblchatluongID");//
                DropDownList drop_heso    = (DropDownList)e.Item.FindControl("Drop_heso");
                DropDownList Drop_CL      = (DropDownList)e.Item.FindControl("ddlnews_chatluong");
                ImageButton  Image_Edit   = (ImageButton)e.Item.FindControl("btnEdit");
                ImageButton  Image_Update = (ImageButton)e.Item.FindControl("btnUpdate");
                ImageButton  Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel");
                int          ImageID      = int.Parse(dgr_anh.DataKeys[e.Item.ItemIndex].ToString());
                lbl_CL.Text          = Drop_CL.SelectedItem.Text;
                lbl_CLID.Text        = Drop_CL.SelectedIndex.ToString();
                Image_Edit.Visible   = true;
                Image_Update.Visible = false;
                Image_Cancel.Visible = false;
                lbl_CL.Visible       = true;
                Drop_CL.Visible      = false;
                if (!string.IsNullOrEmpty(lbl_CLID.Text.Trim()))
                {
                    drop_heso.Items.Clear();
                    int chatluong = 0; try { chatluong = int.Parse(lbl_CLID.Text.Trim()); }
                    catch {; }
                    UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT",
                                         " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT where LoaiTT_TLID=3 and LoaiTT_CLID = " + chatluong.ToString() + ")" +
                                         " and  Heso <= (select LoaiTT_Denheso from T_LoaihinhTT where LoaiTT_TLID=3 and LoaiTT_CLID = " + chatluong.ToString() + ") order by Heso", "0");

                    //if (lbl_CLID.Text.Trim() == "1")
                    //{
                    //    UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT where  LoaiTT_Type=2 )" +
                    //        " and  Heso <= (select LoaiTT_Denheso from T_LoaihinhTT where   LoaiTT_Type=2 ) order by Heso", "0");
                    //}
                    //else
                    //{
                    //    drop_heso.DataSource = null;
                    //    drop_heso.DataBind();
                    //}
                }
                int type = 0; try { type = int.Parse(Request["TypeID"].ToString()); }
                catch {; }
                HPCBusinessLogic.ImageFilesDAL obj = new HPCBusinessLogic.ImageFilesDAL();
                //obj.UpdateChatluongAnh(ImageID, Drop_CL.SelectedIndex, lbl_Nguonanh.Text.Trim(), 0, type);
            }
            else if (e.CommandArgument.ToString().ToLower() == "back")
            {
                Label        lbl_CL       = (Label)e.Item.FindControl("lblchatluong");
                DropDownList Drop_CL      = (DropDownList)e.Item.FindControl("ddlnews_chatluong");
                ImageButton  Image_Edit   = (ImageButton)e.Item.FindControl("btnEdit");
                ImageButton  Image_Update = (ImageButton)e.Item.FindControl("btnUpdate");
                ImageButton  Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel");
                Image_Edit.Visible   = true;
                Image_Update.Visible = false;
                Image_Cancel.Visible = false;
                lbl_CL.Visible       = true;
                Drop_CL.Visible      = false;
            }
        }