protected void btnSave_Click(object sender, System.EventArgs e)
        {
            bool errored = false;

            Invitee newInv = new Invitee();

            RegCode regCode = new RegCode();

            RegCodeRepository regRepos = new RegCodeRepository();

            newInv.Salutation = this.txtInvRank.Text;
            newInv.FirstName  = txtFirstName.Text;
            newInv.LastName   = txtLastName.Text;
            newInv.Address    = this.txtAddress.Text;
            // updatedInv.Clinic = this.txtClinic.Text;
            newInv.City        = this.txtCity.Text;
            newInv.Province    = new Province();
            newInv.Province.ID = Int32.Parse(this.ddProvince.SelectedValue);
            newInv.PostalCode  = this.txtPostal.Text;
            newInv.Phone       = this.txtTelephone.Text;
            // updatedInv.CellPhone = this.txtCellPhone.Text;
            newInv.Fax   = this.txtFax.Text;
            newInv.Email = this.txtEmail.Text;
            //newInv.Comments = "Manually Added" + Environment.NewLine + this.txtComments.Text;
            newInv.Comments = this.txtComments.Text;
            regCode         = regRepos.GetNewCode();

            newInv.RegistrationCode = regCode.Code;


            try
            {
                invRepos.AddInvitee(newInv);

                regRepos.UpdateRegCode(regCode.ID);
            }
            catch (Exception exc)
            {
                lblMsg.Text = exc.InnerException.Message;

                errored = true;

                //throw;
            }

            if (!errored)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
            }
            //else
            //    ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
        }
Ejemplo n.º 2
0
        protected void imgSubmit_clicked(object sender, System.EventArgs e)
        {
            bool              errored    = false;
            RegCode           regCode    = new RegCode();
            RegCodeRepository regRepos   = new RegCodeRepository();
            Invitee           newInvitee = new Invitee();

            try
            {
                newInvitee.FirstName        = txtFirstName.Text;
                newInvitee.LastName         = txtLastName.Text;
                newInvitee.PrimaryWorkplace = txtClinic.Text;
                newInvitee.Address          = txtAddress.Text;
                newInvitee.City             = txtCity.Text;
                newInvitee.ProvinceID       = Int32.Parse(ddProvince.SelectedValue.ToString());
                newInvitee.PostalCode       = txtPostalCode.Text;
                newInvitee.Phone            = txtPhone.Text;
                newInvitee.Fax        = txtFax.Text;
                newInvitee.OptInEmail = txtEmail.Text;
                newInvitee.Comments   = txtComments.Text;

                regCode = regRepos.GetNewCode();
                newInvitee.RegistrationCode = regCode.Code;

                invRepos.AddInvitee(newInvitee);
                regRepos.UpdateRegCode(regCode.ID);
            }
            catch (Exception exc)
            {
                errored = true;
            }

            if (!errored)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
            }
        }
Ejemplo n.º 3
0
        protected void imgSubmit_clicked(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.rdoType.SelectedValue))
            {
                lblTypeReq.Visible = true;
                return;
            }

            bool              errored    = false;
            RegCode           regCode    = new RegCode();
            RegCodeRepository regRepos   = new RegCodeRepository();
            Invitee           newInvitee = new Invitee();

            try
            {
                newInvitee.FirstName        = txtFirstName.Text;
                newInvitee.LastName         = txtLastName.Text;
                newInvitee.PrimaryWorkplace = txtClinic.Text;
                newInvitee.Address          = txtAddress.Text;
                newInvitee.City             = txtCity.Text;
                newInvitee.ProvinceID       = Int32.Parse(ddProvince.SelectedValue.ToString());
                newInvitee.PostalCode       = txtPostalCode.Text;
                newInvitee.Phone            = txtPhone.Text;
                newInvitee.Fax        = txtFax.Text;
                newInvitee.OptInEmail = txtEmail.Text;
                newInvitee.Comments   = txtComments.Text;

                newInvitee.YourFirstName = txtYourFirstName.Text;
                newInvitee.YourLastName  = txtYourLastName.Text;
                newInvitee.YourEmail     = txtYourEmail.Text;

                if (!string.IsNullOrEmpty(txtBI.Text))
                {
                    newInvitee.BITerritoryID = Int32.Parse(this.txtBI.Text);
                }

                newInvitee.LillyID = this.txtLilly.Text;


                if (this.rdoType.SelectedValue == "1")
                {
                    newInvitee.PhysicianType = Enums.PhysicianType.PCP;
                }
                else
                if (this.rdoType.SelectedValue == "2")
                {
                    newInvitee.PhysicianType = Enums.PhysicianType.CS;
                }

                regCode = regRepos.GetNewCode();
                newInvitee.RegistrationCode = regCode.Code;

                SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session);

                newInvitee.IsAdminApproved = user.IsAdmin;

                invRepos.AddInvitee(newInvitee);

                regRepos.UpdateRegCode(regCode.ID);
            }
            catch (Exception exc)
            {
                errored = true;
            }

            if (!errored)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true);
            }
        }
 public RegCode GetNewCode()
 {
     return(regRepos.GetNewCode());
 }