Esempio n. 1
0
    protected void imgbtnsend_Click(object sender, EventArgs e)
    {
        bool Gcheck    = false;
        bool UpdateMsg = false;

        if (gridDraft.Rows.Count > 0)
        {
            foreach (GridViewRow GR in gridDraft.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                if (chk.Checked == true)
                {
                    Gcheck = true;
                    break;
                }
            }
            if (Gcheck == false)
            {
                lblmsg.Text    = "Please select atleast one Draft Message to send.";
                pnlmsg.Visible = true;
                return;
            }
            else
            {
                foreach (GridViewRow GR in gridDraft.Rows)
                {
                    CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                    if (chk.Checked == true)
                    {
                        Int32 MsgId           = Convert.ToInt32(gridDraft.DataKeys[GR.RowIndex].Value);
                        bool  UpdateMsgMaster = clsMessage.UpdateMsgMasterforDraftSend(MsgId);
                        UpdateMsg = clsMessage.UpdateMsgDetailusingMsgId(MsgId, 1);
                    }
                }
                if (UpdateMsg == true)
                {
                    pnlmsg.Visible = true;
                    lblmsg.Visible = true;
                    lblmsg.Text    = "Message Sent Successfully.";
                    SelectMsgforDraft();
                }
            }
        }
    }