Пример #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();
        }