コード例 #1
0
        protected void grvAssociation_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                this.ucMessanger1.UnmarkControls();

                bizAssociation biz = new bizAssociation();
                if (biz.DeleteAssociation(Convert.ToInt32(this.grvAssociation.DataKeys[e.RowIndex].Value)) == true)
                {
                    this.ucMessanger1.ProcessMessage("Association has been succesfully deleted.", Utilities.enMsgType.OK, "", null, true);
                }
                else
                {
                    this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                }

                e.Cancel = true;
                this.grvAssociation.EditIndex = -1;
                this.grvAssociation.DataBind();
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    if (this.Request.QueryString["aid"] == null)
                    {
                        this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                        this.btnEdit.Visible = false;
                        return;
                    }

                    DataSet        ds;
                    bizAssociation biz = new bizAssociation();
                    ds = biz.GetAssociation(Convert.ToInt32(this.Request.QueryString["aid"]));

                    if (ds == null)
                    {
                        return;
                    }

                    DataRow dr = ds.Tables[0].Rows[0];
                    this.txtAssociationName.Text = dr["AssociationName"].ToString();
                    this.imgLogo.ImageUrl        = "ImageHandler.ashx?aid=" + this.Request.QueryString["aid"];
                }
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["aid"] == null)
                {
                    this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                    return;
                }

                this.btnAdd.PostBackUrl = "~/InsuredAdd.aspx?aid=" + Request.QueryString["aid"];

                bizAssociation biz = new bizAssociation();
                DataSet        ds;
                ds = biz.GetAssociation(Convert.ToInt32(Request.QueryString["aid"]));

                if (ds == null)
                {
                    return;
                }

                this.lblAssociation.Text = ds.Tables[0].Rows[0]["AssociationName"].ToString();
            }
            catch (Exception ex)
            {
                bizLog.InsertExceptionLog(ex.Message, ex.StackTrace);
                Response.Redirect("~/ErrorPage.aspx", false);
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (this.Request.QueryString["iid"] == null)
                {
                    this.ucMessanger1.ProcessMessage("Invalid link.", Utilities.enMsgType.Err, "", null, true);
                    return;
                }

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

                bizInsured bizI = new bizInsured();
                DataSet    ds;
                ds = bizI.GetInsured(Convert.ToInt32(this.Request.QueryString["iid"]));
                this.ucMessanger1.ProcessMessages(bizI.MSGS, true);

                if (ds == null)
                {
                    return;
                }

                DataRow dr = ds.Tables[0].Rows[0];
                this.lblInsuredName.Text          = dr["InsuredName"].ToString();
                this.lblAccountExecutive.Text     = dr["AccountExecutive"].ToString();
                this.lblOAMPSEmail.Text           = dr["OAMPSEmail"].ToString();
                this.lblInsurer.Text              = dr["Insurer"].ToString();
                this.lblInsurancePeriodStart.Text = String.Format("{0:dd/MM/yyyy hh tt}", dr["InsurancePeriodStart"]);
                this.lblInsurancePeriodEnd.Text   = String.Format("{0:dd/MM/yyyy hh tt}", dr["InsurancePeriodEnd"]);
                this.lblTimeZoneStart.Text        = dr["TimeZone"].ToString();
                this.lblTimeZoneEnd.Text          = dr["TimeZone"].ToString();
                this.lblClass.Text               = dr["Class"].ToString();
                this.lblPolicyNumber.Text        = dr["PolicyNumber"].ToString();
                this.lblIndemnityLimit.Text      = String.Format("{0:C}", dr["IndemnityLimit"]);
                this.lblBusinessDescription.Text = dr["BusinessDescription"].ToString().Replace("\n", "<br />");

                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);
            }
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            bizAssociation biz = new bizAssociation();

            context.Response.ContentType = "image/jpeg";
            byte[] logo = biz.GetAssociationLogo(Convert.ToInt32(context.Request.QueryString["aid"]));
            context.Response.Clear();
            context.Response.Buffer = true;
            context.Response.OutputStream.Write(logo, 0, logo.GetLength(0));
            context.Response.End();
        }
コード例 #6
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);
            }
        }
コード例 #7
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (UIValidation() == false)
                {
                    return;
                }

                bizAssociation biz = new bizAssociation();

                if (this.fulAssociationLogo.PostedFile.FileName == "")
                {
                    if (biz.UpdateAssociation(Convert.ToInt32(this.Request.QueryString["aid"]),
                                              this.txtAssociationName.Text,
                                              new byte[0]) == 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.UpdateAssociation(Convert.ToInt32(this.Request.QueryString["aid"]),
                                              this.txtAssociationName.Text,
                                              this.fulAssociationLogo.FileBytes) == true)
                    {
                        this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                    }
                    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);
            }
        }
コード例 #8
0
        protected void btnAddAssociation_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucMessanger1.UnmarkControls();
                if (this.txtAddAssociation.Text == "")
                {
                    this.ucMessanger1.ProcessMessage("You have to enter Association Name.", Utilities.enMsgType.Err, "AddAssociation", typeof(TextBox), true);
                    return;
                }

                if (this.fulAddLogo.PostedFile.FileName == "")
                {
                    this.ucMessanger1.ProcessMessage("You have to select Association Logo.", Utilities.enMsgType.Err, "", null, true);
                    return;
                }

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

                bizAssociation biz = new bizAssociation();
                if (biz.InsertAssociation(this.txtAddAssociation.Text, pic) == true)
                {
                    this.txtAddAssociation.Text = "";
                    this.ucMessanger1.ProcessMessage("Association has been succesfully inserted.", Utilities.enMsgType.OK, "", null, true);
                    this.grvAssociation.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);
            }
        }
コード例 #9
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);
            }
        }