예제 #1
0
        protected void btnSubmit_Click1(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (this.rbtnYes.Checked == true && this.txtEmail.Text == "" && this.txtPhoneNumber.Text == "")
                {
                    this.lblMoreInfo.Text = "To be contacted please include a phone number or email address";
                }
                else
                {
                    if (this.txtIntersection.Text == "" && this.txtRoad.Text == "" && this.txtStreetNumber.Text == "")
                    {
                        lblMoreInfo.Text = "You need to include some sort of address or intersection.";
                    }

                    else
                    {
                        if ((this.chbxAnonymous.Checked == false) && (this.txtFirstName.Text == "" && this.txtLastName.Text == "" && this.txtPhoneNumber.Text == "" && this.txtEmail.Text == ""))
                        {
                            lblMoreInfo.Text = "Please include contact information or select anonymous.";
                        }
                        else
                        {
                            lblMoreInfo.Text = "";
                            Citizen citizen;
                            if (chbxAnonymous.Checked == true)
                            {
                                citizen = new Citizen("Anonymous", "Anonymous", "Anonymous", "Anonymous");
                            }
                            else
                            {
                                string cleanEmail       = CleanString.CleanInput(txtEmail.Text);
                                string cleanFirstName   = CleanString.CleanInput(txtFirstName.Text);
                                string cleanLastName    = CleanString.CleanInput(txtLastName.Text);
                                string cleanPhoneNumber = CleanString.CleanInput(txtPhoneNumber.Text);
                                citizen = new Citizen(cleanFirstName.ToUpper(), cleanLastName.ToUpper(), cleanPhoneNumber, cleanEmail);
                            }

                            int citizenId = citizen.InsertCitizen();
                            Session["Citizen"] = citizen;
                            int    contact       = 0;
                            int    problemTypeId = Category.GetCatagoryId(lblPropblem.Text);
                            string cleanDesc     = CleanString.CleanInput(this.txtProblemDetail.Text);

                            string insertedBy = User.Identity.Name;
                            if (rbtnYes.Checked == true)
                            {
                                contact = 1;
                            }
                            else if (rbtnNo.Checked == true)
                            {
                                contact = 0;
                            }
                            if (this.txtIntersection.Text == "")
                            {
                                string cleanNumber = CleanString.CleanInput(this.txtStreetNumber.Text);
                                string direction   = this.directionList.SelectedValue;
                                string cleanRoad   = CleanString.CleanInput(this.txtRoad.Text);
                                string address     = cleanNumber + " " + direction + " " + cleanRoad;

                                Incident incident = new Incident(address.ToUpper(), problemTypeId, cleanDesc.ToUpper(), citizenId, contact);


                                int id = incident.InsertIncident(insertedBy);
                                Session["Incident"]   = incident;
                                Session["IncidentId"] = id;

                                if (problemTypeId == 1)
                                {
                                    Server.Transfer("ConfirmationWithAssignment.aspx", false);
                                }
                                else
                                {
                                    Server.Transfer("Confirmation.aspx", false);
                                }
                                Server.Transfer("Confirmation.aspx", false);
                            }

                            else
                            {
                                string   cleanIntersection = CleanString.CleanInput(this.txtIntersection.Text);
                                Incident incident          = new Incident(cleanIntersection.ToUpper(), problemTypeId, cleanDesc.ToUpper(), citizenId, contact);

                                int id = incident.InsertIncident(insertedBy);
                                Session["Incident"]   = incident;
                                Session["IncidentId"] = id;

                                if (problemTypeId == 1)
                                {
                                    Server.Transfer("ConfirmationWithAssignment.aspx", false);
                                }
                                else
                                {
                                    Server.Transfer("Confirmation.aspx", false);
                                }
                                Server.Transfer("Confirmation.aspx", false);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void SetIncidentValues()
        {
            string cleanAddress = CleanString.CleanInput(txtAddress.Text);

            this._incident.Address = cleanAddress;

            string cleanDescription = CleanString.CleanInput(txtIncidentDescription.Text);

            this._incident.IncidentDisc = cleanDescription;

            string status = "";


            if (rbtnOpen.Checked == true)
            {
                status = "O";
            }
            else if (rbtnClosed.Checked == true)
            {
                status = "C";
            }
            this._incident.Openclose = status;

            int contact = 0;

            if (rbtnYes.Checked == true)
            {
                contact = 1;
            }
            else if (rbtnNo.Checked == true)
            {
                contact = 0;
            }
            this._incident.Contact = contact;

            int problemTypeint = Convert.ToInt32(problemTypeList.SelectedValue);

            this._incident.ProblemTypeId = problemTypeint;

            System.DateTime pendingDate;
            if (txtPendingDate.Text == "")
            {
                pendingDate = System.DateTime.MinValue;
            }
            else
            {
                pendingDate = Convert.ToDateTime(txtPendingDate.Text);
            }
            this._incident.PendingDate = pendingDate;

            bool citizenBeenContacted;
            bool requestClosure;

            if (this.rbtnCityContactedYes.Checked == true)
            {
                citizenBeenContacted = true;
            }
            else
            {
                citizenBeenContacted = false;
            }
            this._incident.HasCitizenBeenContacted = citizenBeenContacted;

            if (this.rbtnYesClose.Checked == true)
            {
                requestClosure = true;
            }
            else
            {
                requestClosure = false;
            }
            this._incident.RequstingClosure = requestClosure;


            System.DateTime courtDate;
            if (txtCourtDate.Text == "")
            {
                courtDate = System.DateTime.MinValue;
            }
            else
            {
                courtDate = Convert.ToDateTime(txtCourtDate.Text);
            }
            this._incident.CourtDate = courtDate;
            string councilDist = this.councilDistList.SelectedValue;

            this._incident.CouncilDist = councilDist;
        }
예제 #3
0
        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            addressList.Attributes.Add("OnChange", "GetAddressText()");
            DataSet addressSet = Utilites.Address.LocateAddressFromParcelTableUsingStreetNum(CleanString.CleanInput(txtAddress.Text));

            addressList.DataSource    = addressSet.Tables[0];
            addressList.DataTextField = addressSet.Tables[0].Columns[1].ToString();
            if (addressSet.Tables[0].Rows.Count > 4)
            {
                addressList.Rows = addressSet.Tables[0].Rows.Count;
            }
            addressList.DataBind();
        }
예제 #4
0
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            lblErrorMessage.Visible = false;

            string cleanAddress     = CleanString.CleanInput(txtAddress.Text);
            string cleanDescription = CleanString.CleanInput(txtIncidentDescription.Text);
            string status           = "";
            int    contact          = 0;

            if (rbtnOpen.Checked == true)
            {
                status = "O";
            }
            else if (rbtnClosed.Checked == true)
            {
                status = "C";
            }
            if (rbtnYes.Checked == true)
            {
                contact = 1;
            }
            else if (rbtnNo.Checked == true)
            {
                contact = 0;
            }

            int problemTypeint = Convert.ToInt32(problemTypeList.SelectedValue);

            System.DateTime pendingDate;
            if (txtPendingDate.Text == "")
            {
                pendingDate = System.DateTime.MinValue;
            }
            else
            {
                pendingDate = Convert.ToDateTime(txtPendingDate.Text);
            }

            bool citizenBeenContacted, requestClosure;

            if (this.rbtnCityContactedYes.Checked == true)
            {
                citizenBeenContacted = true;
            }
            else
            {
                citizenBeenContacted = false;
            }

            if (this.rbtnYesClose.Checked == true)
            {
                requestClosure = true;
            }
            else
            {
                requestClosure = false;
            }

            System.DateTime courtDate;
            if (txtCourtDate.Text == "")
            {
                courtDate = System.DateTime.MinValue;
            }
            else
            {
                courtDate = Convert.ToDateTime(txtCourtDate.Text);
            }

            Incident incident = new Incident(cleanAddress, problemTypeint, cleanDescription, councilDistList.SelectedValue, status, User.Identity.Name, pendingDate, incidentnumber, contact, courtDate, User.Identity.Name, requestClosure, citizenBeenContacted);

            if (incident.UpdateIncident())
            {
            }
            else
            {
            }
        }