コード例 #1
0
        //[WebMethod(EnableSession = false)]
        //public static  string ToggleInvitedCHRC(int physicianID, bool isChecked)
        //{

        //    bool errored = false;
        //    try
        //    {
        //        InviteeRepository invRepos = new InviteeRepository();
        //        invRepos.UpdateInvitedValue(physicianID, isChecked);
        //    }
        //    catch (Exception exc)
        //    {

        //        errored = true;
        //    }

        //    return errored ? "0" : "1";
        //}

        //OnCheckedChanged="chkCHRC_OnCheckedChanged"
        protected void chkCHRC_OnCheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (Request.Params["__EVENTTARGET"].ToString().ToLower() != (sender as ASPxCheckBox).UniqueID.ToLower())
                {
                    return;
                }


                // int physicianID = Int32.Parse((sender as ASPxCheckBox).Attributes["PhysicianID"].ToString());

                int physicianID = Int32.Parse(((sender as ASPxCheckBox).Parent.FindControl("dummyInv2") as Button).CommandName);

                string fn    = ((sender as ASPxCheckBox).Parent.FindControl("dummyFN") as Button).CommandName;
                string ln    = ((sender as ASPxCheckBox).Parent.FindControl("dummyLN") as Button).CommandName;
                string email = ((sender as ASPxCheckBox).Parent.FindControl("dummyEmail") as Button).CommandName;

                invRepos.Approve(physicianID);

                try
                {
                    Invitee inv = invRepos.GetDetail(physicianID);

                    string phy_fn = inv.FirstName;
                    string phy_ln = inv.LastName;

                    var mailMessage = new System.Net.Mail.MailMessage()
                    {
                        From    = new MailAddress(Constants.EMAILGENERAL),
                        Subject = "VISTA DM – New Physician Request Approved",
                        Body    = GetBody(fn, string.Empty, phy_fn, phy_ln)
                    };

                    mailMessage.To.Add(new MailAddress(email));

                    mailMessage.IsBodyHtml = true;

                    Utility.SendMail(mailMessage);
                }
                catch (Exception)
                {
                }



                if (provinceID == -1)
                {
                    LoadData(isPCP);
                }
                else
                {
                    LoadData(provinceID, isPCP);
                }
            }
            catch (Exception exc)
            {
                lblResult.Text = exc.Message;

                throw;
            }
        }