protected void grvPresets_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                bizPreset biz = new bizPreset();
                if (biz.DeletePreset(Convert.ToInt32(this.grvPresets.DataKeys[e.RowIndex].Value)) == true)
                {
                    this.ucMessanger1.ProcessMessage("Preset has been succesfully deleted.", Utilities.enMsgType.OK, "", null, true);
                    this.ucMessanger1.ProcessMessage("If there is existing link to this Preset, it will be broken.", Utilities.enMsgType.Warn, "", null, false);
                }
                else
                {
                    this.ucMessanger1.ProcessMessage("An error has happened, please see the log.", Utilities.enMsgType.Err, "", null, true);
                }

                e.Cancel = true;
                this.grvPresets.EditIndex = -1;
                this.grvPresets.DataBind();
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
        protected void btnAddPreset_Click(object sender, EventArgs e)
        {
            try
            {
                HttpPostedFile pf;
                pf = this.fulAddTemplate.PostedFile;

                if (pf.FileName == "")
                {
                    this.ucMessanger1.ProcessMessage("No Template file has been selected.", Utilities.enMsgType.Err, "", null, true);
                    return;
                }

                if (pf.ContentType != "application/pdf")
                {
                    this.ucMessanger1.ProcessMessage("You have to select PDF file as a template.", Utilities.enMsgType.Err, "", null, true);
                    return;
                }

                string fileName = Path.GetFileName(pf.FileName);

                int    len      = this.fulAddTemplate.PostedFile.ContentLength;
                byte[] template = new byte[len];
                this.fulAddTemplate.PostedFile.InputStream.Read(template, 0, len);

                bizPreset biz = new bizPreset();

                if (biz.ValidatePreset(Convert.ToInt32(Request.QueryString["aid"]),
                                       fileName,
                                       this.ddlAddDocumentType.SelectedValue) == false)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, false);
                    return;
                }

                if (biz.InsertPreset(Convert.ToInt32(Request.QueryString["aid"]),
                                     fileName,
                                     template,
                                     this.ddlAddDocumentType.SelectedValue) == true)
                {
                    this.ucMessanger1.ProcessMessage("Preset has been succesfully inserted.", Utilities.enMsgType.OK, "", null, false);
                    this.grvPresets.DataBind();
                }
                else
                {
                    this.ucMessanger1.ProcessMessage("An error has happened, please see the log.", Utilities.enMsgType.Err, "", null, true);
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    if (this.Request.QueryString["pid"] == null)
                    {
                        this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                        return;
                    }

                    this.btnBack.PostBackUrl = this.Request.UrlReferrer.AbsolutePath + this.Request.UrlReferrer.Query;

                    DataSet   ds;
                    bizPreset biz = new bizPreset();
                    ds = biz.GetPreset(Convert.ToInt32(this.Request.QueryString["pid"]));
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);

                    if (ds == null)
                    {
                        return;
                    }

                    DataRow dr = ds.Tables[0].Rows[0];
                    this.lblPresetID.Text     = dr["PresetID"].ToString();
                    this.lblTemplateName.Text = dr["TemplateName"].ToString();
                    ShowThumbnail((byte[])dr["Template"]);
                    this.lblDocumentType.Text = dr["DocumentType"].ToString();

                    DataSet        ads;
                    bizAssociation bizA = new bizAssociation();
                    ads = bizA.GetAssociation(Convert.ToInt32(dr["AssociationId"]));
                    this.ucMessanger1.ProcessMessages(bizA.MSGS, true);

                    if (ads == null)
                    {
                        return;
                    }

                    if (ads.Tables[0].Rows.Count > 0)
                    {
                        this.lblAssociation.Text = ads.Tables[0].Rows[0]["AssociationName"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 4
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (UIValidation() == false)
            {
                return;
            }

            bizPreset biz = new bizPreset();

            if (biz.ValidatePreset(Convert.ToInt32(this.ddlAssociations.SelectedValue),
                                   this.lblTemplateName.Text,
                                   this.ddlDocumentType.SelectedValue) == false)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                return;
            }

            if (Session["pdf"] != null)
            {
                if (biz.UpdatePreset(Convert.ToInt32(this.Request.QueryString["pid"]),
                                     Convert.ToInt32(this.ddlAssociations.SelectedValue),
                                     this.lblTemplateName.Text,
                                     (byte[])Session["pdf"],
                                     this.ddlDocumentType.SelectedValue) == true)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                }
                else
                {
                    this.ucMessanger1.ProcessMessage("An error has happened, please see the log.", Utilities.enMsgType.Err, "", null, true);
                }
            }
            else
            {
                if (biz.UpdatePreset(Convert.ToInt32(this.Request.QueryString["pid"]),
                                     Convert.ToInt32(this.ddlAssociations.SelectedValue),
                                     this.lblTemplateName.Text,
                                     new byte[0],
                                     this.ddlDocumentType.SelectedValue) == true)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                }
                else
                {
                    this.ucMessanger1.ProcessMessage("An error has happened, please see the log.", Utilities.enMsgType.Err, "", null, true);
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    if (this.Request.QueryString["pid"] == null)
                    {
                        this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                        this.btnEdit.Visible = false;
                        return;
                    }

                    DataSet   ds;
                    bizPreset biz = new bizPreset();
                    ds = biz.GetPreset(Convert.ToInt32(this.Request.QueryString["pid"]));

                    if (ds == null)
                    {
                        return;
                    }

                    DataRow dr = ds.Tables[0].Rows[0];
                    this.ddlAssociations.SelectedValue = dr["AssociationID"].ToString();
                    this.ddlDocumentType.SelectedValue = dr["DocumentType"].ToString();
                    this.lblTemplateName.Text          = dr["TemplateName"].ToString();
                    ShowThumbnail((byte[])dr["Template"]);

                    this.btnBack.PostBackUrl = "~/AssociationPresets.aspx?aid=" + dr["AssociationID"].ToString();
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack || true == true)
                {
                    if (this.Request.QueryString["pid"] == null)
                    {
                        this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                        this.btnSubmit.Visible = false;
                        this.btnClear.Visible  = false;
                        return;
                    }

                    bizPreset bizP = new bizPreset();

                    DataSet ds;
                    ds = bizP.GetPreset(Convert.ToInt32(this.Request.QueryString["pid"]));
                    this.ucMessanger1.ProcessMessages(bizP.MSGS, true);

                    if (ds == null)
                    {
                        return;
                    }

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        this.btnSubmit.Visible = false;
                        this.btnClear.Visible  = false;
                        this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                        return;
                    }

                    DataRow drOriginalPreset = ds.Tables[0].Rows[0];

                    string actualDocumentType = drOriginalPreset["DocumentType"].ToString();
                    if (rblInterestedParty.SelectedValue != null)
                    {
                        actualDocumentType = rblInterestedParty.SelectedValue;
                    }


                    int     aid = Convert.ToInt32(drOriginalPreset["AssociationID"].ToString());
                    DataSet dsAssociationPresets;
                    dsAssociationPresets = bizP.ListPresetsByAssociation(aid);
                    var interestedPartyPresets = dsAssociationPresets.Tables[0].AsEnumerable().Select(r => new {
                        PresetID        = r.Field <int>("PresetID"),
                        AssociationName = r.Field <string>("AssociationName"),
                        TemplateName    = r.Field <string>("TemplateName"),
                        DocumentType    = r.Field <string>("DocumentType")
                    })
                                                 .Where(r => r.DocumentType == actualDocumentType)
                                                 .OrderByDescending(r => r.PresetID)
                                                 .GetEnumerator();

                    if (!interestedPartyPresets.MoveNext())
                    {
                        this.ucMessanger1.ProcessMessage("Invalid selection", Utilities.enMsgType.Err, "", null, true);
                        this.btnSubmit.Visible = false;
                        this.btnClear.Visible  = false;
                        hidActualPreset.Value  = this.Request.QueryString["pid"];
                    }
                    else
                    {
                        var thisPreset = interestedPartyPresets.Current;
                        hidActualPreset.Value = thisPreset.PresetID.ToString();
                    }

                    if (this.Request.QueryString["debug"] != null)
                    {
                        Response.Write("Actual Document type: " + actualDocumentType);
                        Response.Write("Actual preset: " + hidActualPreset.Value);
                    }


                    this.lblFormTitle.Text           = "Request for " + actualDocumentType;
                    this.imgAssociationLogo.ImageUrl = "ImageHandler.ashx?aid=" + drOriginalPreset["AssociationID"].ToString();

                    DataSet        ads;
                    bizAssociation bizA = new bizAssociation();
                    ads = bizA.GetAssociation(aid);

                    if (ads == null)
                    {
                        return;
                    }

                    DataRow adr = ads.Tables[0].Rows[0];
                    this.lblHeaderTitle.Text = adr["AssociationName"].ToString();

                    DataSet    ids;
                    bizInsured bizI = new bizInsured();
                    ids = bizI.ListInsuredsByAssociation(Convert.ToInt32(drOriginalPreset["AssociationID"]));
                    this.ucMessanger1.ProcessMessages(bizP.MSGS, false);

                    if (ids == null)
                    {
                        return;
                    }

                    if (ids.Tables[0].Rows.Count == 0)
                    {
                        this.btnSubmit.Visible = false;
                        this.btnClear.Visible  = false;
                        this.ucMessanger1.ProcessMessage("There are no Insureds for " + adr["AssociationName"].ToString() + ".", Utilities.enMsgType.Err, "", null, true);
                        return;
                    }

                    //this.ddlInsured.Items.Add(new ListItem(" -- please select -- ", ""));
                    foreach (DataRow idr in ids.Tables[0].Rows)
                    {
                        this.lstInsured.Items.Add(new ListItem(idr["InsuredName"].ToString(), idr["InsuredID"].ToString()));
                        this.ddlInsured.Items.Add(new ListItem(idr["InsuredName"].ToString(), idr["InsuredID"].ToString()));
                    }
                    this.lstInsured.Width = new Unit("356px");
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
Esempio n. 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (UIValidation() == false)
                {
                    return;
                }

                DataSet   pds;
                bizPreset bizP = new bizPreset();
                //pds = bizP.GetPreset(Convert.ToInt32(this.Request.QueryString["pid"]));
                pds = bizP.GetPreset(Convert.ToInt32(hidActualPreset.Value));

                if (pds == null)
                {
                    return;
                }

                DataRow pdr = pds.Tables[0].Rows[0];

                DataSet    ds;
                bizInsured bizI = new bizInsured();
                ds = bizI.GetInsured(Convert.ToInt32(this.lstInsured.SelectedValue));
                this.ucMessanger1.ProcessMessages(bizI.MSGS, true);

                if (ds == null)
                {
                    return;
                }

                DataRow drSubmitPreset = ds.Tables[0].Rows[0];

                bizDocument biz = new bizDocument();

                if (biz.ValidateRequest(this.rblInterestedParty.SelectedValue == "Certificate of Currency 3rd Party" ? true : false,
                                        this.txtInterestedPartyName.Text,
                                        this.txtRequestedBy.Text,
                                        this.txtEmail.Text,
                                        this.txtPositionAtInsured.Text) == false)
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                    return;
                }

                if (biz.ProcessRequest(this.lblHeaderTitle.Text,
                                       this.rblInterestedParty.SelectedValue == "Certificate of Currency 3rd Party" ? true : false,
                                       this.txtInterestedPartyName.Text,
                                       this.txtRequestedBy.Text,
                                       this.txtEmail.Text,
                                       this.txtPositionAtInsured.Text,
                                       pdr["TemplateName"].ToString(),
                                       (byte[])pdr["Template"],
                                       pdr["DocumentType"].ToString(),
                                       this.lstInsured.SelectedItem.Text,
                                       drSubmitPreset["AccountExecutive"].ToString(),
                                       drSubmitPreset["Insurer"].ToString(),
                                       Convert.ToDateTime(drSubmitPreset["InsurancePeriodStart"]),
                                       Convert.ToDateTime(drSubmitPreset["InsurancePeriodEnd"]),
                                       drSubmitPreset["TimeZone"].ToString(),
                                       drSubmitPreset["Class"].ToString(),
                                       drSubmitPreset["PolicyNumber"].ToString(),
                                       Convert.ToDecimal(drSubmitPreset["IndemnityLimit"]),
                                       drSubmitPreset["OAMPSEmail"].ToString(),
                                       drSubmitPreset["BusinessDescription"].ToString()) == true)
                {
                    ClearData();
                    if (this.rblInterestedParty.SelectedValue == "Certificate of Currency 3rd Party")
                    {
                        this.ucMessanger1.ProcessMessage("Request has been succesfully submitted. Requested document has to be approved by Arthur J. Gallagher & Co. when an interested party is involved.", Utilities.enMsgType.OK, "", null, true);
                    }
                    else
                    {
                        this.ucMessanger1.ProcessMessage("Request has been succesfully submited. You will get the requested document in your e-mail shortly.", Utilities.enMsgType.OK, "", null, true);
                    }
                }
                else
                {
                    this.ucMessanger1.ProcessMessage(string.Format("27 {0}", bizEmail.GetEmailValue("ErrorMessage")), Utilities.enMsgType.Err, "", null, true);
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }