Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TextBox5.Visible     = false;
                ImageButton4.Visible = false;
                Calendar1.Visible    = false;
                Calendar4.Visible    = false;
            }

            if (Page.PreviousPage != null)
            {
                var queryStrings = (Request.QueryString.ToString());
                var a            = queryStrings.Split('&');

                DropDownList7.ClearSelection();
                DropDownList8.ClearSelection();
            }
        }
Exemplo n.º 2
0
    protected void  Button1_Click(object sender, EventArgs e)
    {
        string dt1 = DropDownList1 + "/" + DropDownList2 + "/" + DropDownList3;
        string dt2 = DropDownList4 + "/" + DropDownList5 + "/" + DropDownList6;

        cmd.CommandText = "insert into Hotel_tb values(" + TextBox1.Text + ",'" + Session["id"] + "','" + DropDownList10.Text + "','" + DropDownList11.Text + "',,'" + dt1 + "','" + dt2 + "','" + DropDownList7.Text + "','" + DropDownList8.Text + "','" + DropDownList9 + "','" + TextBox4.Text + "')";
        db.execute(cmd);
        Response.Write("<script>alert('Submitted')</script>");
        cmd.CommandText = "select max (ID) from Hotel_tb";
        TextBox1.Text   = db.max_id(cmd).ToString();

        TextBox4.Text = "";
        DropDownList1.ClearSelection();
        DropDownList2.ClearSelection();
        DropDownList3.ClearSelection();
        DropDownList4.ClearSelection();
        DropDownList5.ClearSelection();
        DropDownList6.ClearSelection();
        DropDownList7.ClearSelection();
        DropDownList8.ClearSelection();
        DropDownList9.ClearSelection();
    }
    protected override void OnPreRender(EventArgs e)
    {
        //MessageBox.Show(Request.QueryString.Get("facilityid"));
        TList <CustomerSite> customersites = DataRepository.CustomerSiteProvider.GetAll();

        if (DropDownList8.SelectedIndex <= 0)
        {
            DropDownList8.Items.Clear();
            DropDownList8.Items.Add("Select Location");
            DropDownList8.Items[0].Value = "0";
        }
        if (DropDownList8.SelectedIndex <= 0)
        {
            if (facilityid.Equals(-1))
            {
                DropDownList8.Items[0].Selected = true;
            }
            else
            {
                DropDownList8.Items[0].Selected = false;
                DropDownList8.ClearSelection();
            }
        }
        x = 0;
        //MessageBox.Show(DropDownList2.SelectedIndex.ToString());
        if (DropDownList8.SelectedIndex <= 0)
        {
            foreach (CustomerSite cs in customersites)
            {
                x++;
                DropDownList8.Items.Add(cs.SiteName);
                DropDownList8.Items[x].Value = cs.CustomerSiteId.ToString();
                if (DropDownList8.SelectedIndex.Equals(x))
                {
                    DropDownList8.Items[x].Selected = true;
                }
                else
                {
                    if (facilityid.Equals(cs.CustomerSiteId))
                    {
                        DropDownList8.ClearSelection();
                        DropDownList8.Items[x].Selected = true;
                        DropDownList8_SelectedIndexChanged(this, null);
                        //MessageBox.Show(DropDownList2.SelectedIndex.ToString());
                    }
                }
            }
        }

        if (DropDownList8.SelectedIndex.Equals(0))
        {
            TList <TeacherSite> teachersatsite = DataRepository.TeacherSiteProvider.GetBySiteId(Convert.ToInt16(DropDownList8.SelectedValue));
            DropDownList9.Items.Clear();
            DropDownList9.Items.Add("Select Teacher");
            DropDownList9.Items[0].Value    = "0";
            DropDownList9.Items[0].Selected = true;
        }

        if (TextBox2.Text.Equals("") || TextBox2.Text.Equals(null))
        {
            Label9.Text    = "Please Select A Beginning Date";
            Label9.Visible = true;
        }
        else
        {
            Label9.Visible = false;
        }

        if (TextBox3.Text.Equals("") || TextBox3.Text.Equals(null))
        {
            Label10.Text    = "Please Select An Ending Date";
            Label10.Visible = true;
        }
        else
        {
            Label10.Visible = false;
        }

        if (!TextBox3.Text.Equals("") && !TextBox3.Text.Equals(null) && TextBox2.Text.Equals("") && TextBox2.Text.Equals(null))
        {
            if (DateTime.Parse(TextBox3.Text) < DateTime.Parse(TextBox2.Text))
            {
                Label10.Text    = "Date Cannot Be Earlier Than Beginning Date";
                Label10.Visible = true;
            }
        }

        if (TextBox5.Text.Equals("") || TextBox5.Text.Equals(null))
        {
            Label12.Visible = true;
        }
        else
        {
            Label12.Visible = false;
        }

        if (TextBox4.Text.Equals("") || TextBox4.Text.Equals(null))
        {
            Label13.Visible = true;
        }
        else
        {
            Label13.Visible = false;
        }

        base.OnPreRender(e);
    }
Exemplo n.º 4
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            string Pri          = null;
            int    EstimatedMin = 0;

            if (DropDownList11.Text == "0 minutes")
            {
                EstimatedMin = 0;
            }
            else if (DropDownList11.Text == "5 minutes")
            {
                EstimatedMin = 5;
            }
            else if (DropDownList11.Text == "10 minutes")
            {
                EstimatedMin = 10;
            }
            else if (DropDownList11.Text == "15 minutes")
            {
                EstimatedMin = 15;
            }
            else if (DropDownList11.Text == "20 minutes")
            {
                EstimatedMin = 20;
            }
            else if (DropDownList11.Text == "25 minutes")
            {
                EstimatedMin = 25;
            }
            else if (DropDownList11.Text == "30 minutes")
            {
                EstimatedMin = 30;
            }
            else if (DropDownList11.Text == "35 minutes")
            {
                EstimatedMin = 35;
            }
            else if (DropDownList11.Text == "40 minutes")
            {
                EstimatedMin = 40;
            }
            else if (DropDownList11.Text == "45 minutes")
            {
                EstimatedMin = 45;
            }
            else if (DropDownList11.Text == "50 minutes")
            {
                EstimatedMin = 50;
            }
            else if (DropDownList11.Text == "55 minutes")
            {
                EstimatedMin = 55;
            }

            int EstimatedTime = (int)Char.GetNumericValue(DropDownList10.Text.ElementAt(0)) * 60 + EstimatedMin;

            if (DropDownList2.Text.Contains("1 - task requires <= 1 hour"))
            {
                Pri = "1";
            }
            else if (DropDownList2.Text.Contains("2 - task requires <= 2 hours"))
            {
                Pri = "2";
            }
            else if (DropDownList2.Text.Contains("3 - task requires <= 3 hours"))
            {
                Pri = "3";
            }
            else if (DropDownList2.Text.Contains("4 - task requires <= 4 hours"))
            {
                Pri = "4";
            }
            else if (DropDownList2.Text.Contains("5 - task requires <= 6 hours"))
            {
                Pri = "5";
            }

            string Dif = DropDownList3.SelectedValue;
            string skill1;
            string skill2;
            string skill3;

            if (DropDownList7.SelectedValue == "Assembly")
            {
                skill1 = "ASSEMBLY";
            }
            else if (DropDownList7.SelectedValue == "C++")
            {
                skill1 = "CPP";
            }
            else if (DropDownList7.SelectedValue == "C#")
            {
                skill1 = "CSHARP";
            }
            else if (DropDownList7.SelectedValue == "Java")
            {
                skill1 = "JAVA";
            }
            else if (DropDownList7.SelectedValue == "JavaScript")
            {
                skill1 = "JAVASCRIPT";
            }
            else if (DropDownList7.SelectedValue == "Python")
            {
                skill1 = "PYTHON";
            }
            else if (DropDownList7.SelectedValue == "SQL")
            {
                skill1 = "DB";
            }
            else
            {
                skill1 = DropDownList7.SelectedValue;
            }

            if (DropDownList8.SelectedValue == "Assembly")
            {
                skill2 = "ASSEMBLY";
            }
            else if (DropDownList8.SelectedValue == "C++")
            {
                skill2 = "CPP";
            }
            else if (DropDownList8.SelectedValue == "C#")
            {
                skill2 = "CSHARP";
            }
            else if (DropDownList8.SelectedValue == "Java")
            {
                skill2 = "JAVA";
            }
            else if (DropDownList8.SelectedValue == "JavaScript")
            {
                skill2 = "JAVASCRIPT";
            }
            else if (DropDownList8.SelectedValue == "Python")
            {
                skill2 = "PYTHON";
            }
            else if (DropDownList8.SelectedValue == "SQL")
            {
                skill2 = "DB";
            }
            else
            {
                skill2 = DropDownList8.SelectedValue;
            }

            if (DropDownList9.SelectedValue == "Assembly")
            {
                skill3 = "ASSEMBLY";
            }
            else if (DropDownList9.SelectedValue == "C++")
            {
                skill3 = "CPP";
            }
            else if (DropDownList9.SelectedValue == "C#")
            {
                skill3 = "CSHARP";
            }
            else if (DropDownList9.SelectedValue == "Java")
            {
                skill3 = "JAVA";
            }
            else if (DropDownList9.SelectedValue == "JavaScript")
            {
                skill3 = "JAVASCRIPT";
            }
            else if (DropDownList9.SelectedValue == "Python")
            {
                skill3 = "PYTHON";
            }
            else if (DropDownList9.SelectedValue == "SQL")
            {
                skill3 = "DB";
            }
            else
            {
                skill3 = DropDownList9.SelectedValue;
            }

            string skillr1 = DropDownList4.SelectedValue;
            string skillr2 = DropDownList5.SelectedValue;
            string skillr3 = DropDownList6.SelectedValue;

            if (DropDownList1.SelectedValue == " " || TextBox2.Text == "" || TextBox3.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Please fill all the textboxes with the right data.');", true);
            }
            else if (skill1.Contains("-") && skill2.Contains("-") && skill3.Contains("-"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Please fill all the textboxes with the right data.');", true);
            }
            else if ((Pri == "1" && EstimatedTime >= 60) || (Pri == "2" && EstimatedTime >= 120) || (Pri == "3" && EstimatedTime >= 180) || (Pri == "4" && EstimatedTime >= 240) || (Pri == "5" && EstimatedTime >= 360))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Estimated Time must corespond to Priority Level.');", true);
            }
            else
            {
                string mesage = "4" + DropDownList1.Text + "|" + TextBox2.Text + "|" + TextBox3.Text + "|" + Pri + "|" + Dif + "|" + EstimatedTime;
                int    prim   = 0;
                if (!skill1.Contains("-"))
                {
                    if (skillr1 == "10")
                    {
                        skillr1 = "9";
                    }
                    mesage += "|" + skill1 + ":" + skillr1 + ";";
                    prim++;
                }
                if (!skill2.Contains("-"))
                {
                    if (skillr2 == "10")
                    {
                        skillr2 = "9";
                    }
                    if (prim != 0)
                    {
                        mesage += skill2 + ":" + skillr2 + ";";
                    }
                    if (prim == 0)
                    {
                        mesage += "|" + skill2 + ":" + skillr2 + ";";
                        prim++;
                    }
                }
                if (!skill3.Contains("-"))
                {
                    if (skillr3 == "10")
                    {
                        skillr3 = "9";
                    }
                    if (prim != 0)
                    {
                        mesage += skill3 + ":" + skillr3 + ";";
                    }
                    if (prim == 0)
                    {
                        mesage += "|" + skill3 + ":" + skillr3 + ";";
                    }
                }



                send_msg(tc, ns, mesage);

                string recv_mess = recv_msg(ns);

                string[] pop = recv_mess.Split(new Char[] { ':', ';' });

                if (pop[0][0] == '1')
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Task sent');", true);
                    DropDownList1.ClearSelection();
                    TextBox2.Text = "";
                    TextBox3.Text = "";
                    DropDownList2.ClearSelection();
                    DropDownList3.ClearSelection();
                    DropDownList4.ClearSelection();
                    DropDownList5.ClearSelection();
                    DropDownList6.ClearSelection();
                    DropDownList7.ClearSelection();
                    DropDownList8.ClearSelection();
                    DropDownList9.ClearSelection();
                    DropDownList10.ClearSelection();
                    DropDownList11.ClearSelection();
                    //Response.Redirect("SendATask.aspx");
                    Response.AppendHeader("Refresh", "1");
                }
                else
                {
                    string aux = pop[0];
                    aux    = aux.Remove(0, 1);
                    pop[0] = aux;
                    string mesaj = "";

                    for (int i = 0; i < pop.Length; i++)
                    {
                        string s = pop[i];

                        if (s.Trim() != "")
                        {
                            if (s.Contains("0") || s.Contains("1") || s.Contains("2") || s.Contains("3") || s.Contains("4") || s.Contains("5") || s.Contains("6") || s.Contains("7") || s.Contains("8") || s.Contains("9") || s.Contains("10"))
                            {
                                mesaj += ": " + s + "; ";
                            }
                            else if (s.Contains("ASSEMBLY"))
                            {
                                mesaj += "Assembly";
                            }
                            else if (s.Contains("CPP"))
                            {
                                mesaj += "C++";
                            }
                            else if (s.Contains("CSHARP"))
                            {
                                mesaj += "C#";
                            }
                            else if (s.Contains("JAVA"))
                            {
                                mesaj += "Java";
                            }
                            else if (s.Contains("JAVASCRIPT"))
                            {
                                mesaj += "JavaScript";
                            }
                            else if (s.Contains("PYTHON"))
                            {
                                mesaj += "Python";
                            }
                            else if (s.Contains("DB"))
                            {
                                mesaj += "SQL";
                            }
                            else
                            {
                                mesaj += s;
                            }
                        }
                    }
                    string popup = "alert(' Closest skills are: " + mesaj + "');";

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", popup, true); //printez siru
                }
            }
        }