示例#1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            string id_telephone = DropDownList7.SelectedValue.ToString();

            Telephone.ChangeStatus(id_telephone);
            Label2.Text = "Status: status updated successfully!";
        }
示例#2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            String numero     = TextBox8.Text;
            String nombre     = TextBox9.Text;
            String tipo       = DropDownList6.SelectedValue;
            bool   isNumeric1 = double.TryParse(numero, out _);

            if (Session["id_hospital_update"] != null)
            {
                int id_hospital = (int)Session["id_hospital_update"];
                if (!numero.Equals(""))
                {
                    if ((isNumeric1 && numero.Length == 10))
                    {
                        if (isNumeric1 && numero.Length == 10)
                        {
                            Telephone t = new Telephone(numero, nombre, tipo, id_hospital);
                            Label1.Text   = "Status: " + t.AddTelephone();
                            TextBox8.Text = "";
                            TextBox9.Text = "";
                        }
                    }
                    else
                    {
                        Label1.Text = "Status: Verify contact telephone is numeric and 10 digits long.";
                    }
                }
                else
                {
                    Label1.Text = "Status: No contact number was provided.";
                }
            }
            else
            {
                Label1.Text = "Status: Error retrieving hospital ID.";
            }
        }
示例#3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            String nombre         = TextBox1.Text;
            String dom            = TextBox2.Text;
            String moph           = TextBox13.Text;
            String numero_1       = TextBox3.Text;
            String numero_2       = TextBox6.Text;
            String numero_3       = TextBox8.Text;
            String nombre_1       = TextBox5.Text;
            String nombre_2       = TextBox7.Text;
            String nombre_3       = TextBox9.Text;
            String tipo_1         = DropDownList8.Text;
            String tipo_2         = DropDownList7.Text;
            String tipo_3         = DropDownList6.Text;
            String tipo_hospital  = DropDownList2.Text;
            int    district       = DropDownList3.SelectedIndex + 1;
            int    province       = DropDownList9.SelectedIndex + 1;
            bool   latitudeIsNum  = double.TryParse(TextBox10.Text, out double latitude);
            bool   longitudeIsNum = double.TryParse(TextBox11.Text, out double longitude);
            bool   isNumeric1     = double.TryParse(numero_1, out _);
            bool   isNumeric2     = double.TryParse(numero_2, out _);
            bool   isNumeric3     = double.TryParse(numero_3, out _);

            if (!numero_1.Equals("") || !numero_2.Equals("") || !numero_3.Equals(""))
            {
                if ((isNumeric1 && numero_1.Length == 10) || (isNumeric2 && numero_2.Length == 10) || (isNumeric3 && numero_3.Length == 10))
                {
                    if (!nombre.Equals("") && !dom.Equals("") && !moph.Equals(""))
                    {
                        Hospital c         = new Hospital(nombre, dom, latitude, longitude, district, province, tipo_hospital, moph);
                        bool     isSimilar = c.HospitalesSimilares(GridView1);
                        if (!isSimilar)
                        {
                            string resInsert   = c.AgregaHospital();
                            bool   wasInserted = int.TryParse(resInsert.Substring(28), out int id_hospital);
                            TextBox14.Text = resInsert;
                            Session["id_hospital_register"] = id_hospital;
                            Session["id_hospital_update"]   = id_hospital;
                            Session["logRH"] = ChangeLog();

                            //4. El MOPH es único
                            if (wasInserted)
                            {
                                if (isNumeric1 && numero_1.Length == 10)
                                {
                                    Telephone t = new Telephone(numero_1, nombre_1, tipo_1, id_hospital);
                                    TextBox14.Text += "\n" + t.AddTelephone();
                                }
                                if (isNumeric2 && numero_2.Length == 10)
                                {
                                    Telephone t = new Telephone(numero_2, nombre_2, tipo_2, id_hospital);
                                    TextBox14.Text += "\n" + t.AddTelephone();
                                }
                                if (isNumeric3 && numero_3.Length == 10)
                                {
                                    Telephone t = new Telephone(numero_3, nombre_3, tipo_3, id_hospital);
                                    TextBox14.Text += "\n" + t.AddTelephone();
                                }

                                TextBox1.Text  = "";
                                TextBox2.Text  = "";
                                TextBox13.Text = "";
                                TextBox3.Text  = "";
                                TextBox6.Text  = "";
                                TextBox8.Text  = "";
                                TextBox5.Text  = "";
                                TextBox7.Text  = "";
                                TextBox9.Text  = "";
                            }
                            else
                            {
                                TextBox14.Text = "\nVerify MOPH number is unique and hasn't been registered before.";
                            }
                        }
                        else
                        {
                            Button1.Visible   = false;
                            GridView1.Visible = true;
                            Label1.Visible    = true;
                            Button3.Visible   = true;
                            TextBox14.Text    = "";
                        }
                    }
                    else
                    {
                        TextBox14.Text = "\nHospital fields required: (NAME, ADDRESS, MOPH NUMBER).";
                    }
                }
                else
                {
                    TextBox14.Text = "\nVerify contact telephone is numeric and 10 digits long.";
                }
            }
            else
            {
                TextBox14.Text = "\n At least 1 contact telephone is required.";
            }
        }