Пример #1
0
        protected void cmd_Chamnhanbut_Click(object sender, EventArgs e)
        {
            bool checkall = true;

            foreach (DataGridItem item in dgr_tintuc.Items)
            {
                bool    check      = true;
                TextBox txt_tien   = (TextBox)item.FindControl("txt_tien");
                Label   lbl_NewsID = (Label)item.FindControl("lbl_ID");
                Label   lbl_loaiID = (Label)item.FindControl("lbl_loaiID");
                Label   lbl_title  = (Label)item.FindControl("lbl_title");
                //LinkButton linkTittle = (LinkButton)item.FindControl("linkTittle");
                int tien = 0;
                try
                {
                    if (!string.IsNullOrEmpty(txt_tien.Text))
                    {
                        check = true;
                        tien  = int.Parse(txt_tien.Text.Replace(",", "")); txt_tien.ForeColor = System.Drawing.Color.Black;
                    }
                }
                catch
                {
                    check = false; txt_tien.ForeColor = System.Drawing.Color.Red; checkall = false;
                }
                if (check)
                {
                    HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL();
                    if (tien > 0)
                    {
                        _Obj.Update_TiennhanbutTin(int.Parse(lbl_loaiID.Text), int.Parse(lbl_NewsID.Text), 0, tien, _user.UserID);
                    }
                    else
                    {
                        _Obj.Update_TiennhanbutTin(int.Parse(lbl_loaiID.Text), int.Parse(lbl_NewsID.Text), 0, 0, 0);
                    }
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, lbl_title.Text,
                                                                   Request["Menu_ID"].ToString(), "Chấm nhận bút tin ", int.Parse(lbl_NewsID.Text), type);
                }
            }
            if (checkall)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " alert('Chấm nhận bút thành công') ;", true);
            }
            else
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " alert('Hệ số nhận bút và tiền phải là kiểu số') ;", true);
            }
        }