Beispiel #1
0
        // MM1
        private void btnMM1(object sender, EventArgs e)
        {
            GraficoMM1 gmm1 = new GraficoMM1();

            gmm1.Visible = true;
            MM1 mm1 = new MM1();

            mm1.probabilidades();

            for (int i = 0; i < 10; i++)
            {
                mm1.tiempoentrellegadas[i]        = d.T_E_LL_MM1[i];
                mm1.tiempodeservicio[i]           = d.T_D_S_MM1[i];
                mm1.tiempodeservicioredondeado[i] = d.tiempo_servicioMM1(mm1.tiempodeservicio[i]);
                if (mm1.T_D_E(mm1.tiempodeservicioredondeado, mm1.tiempoentrellegadasredondeado) >= 6)
                {
                    mm1.cont_salidas6m = mm1.cont_salidas6m + 1;
                }
                else if (mm1.tiempodeservicioredondeado[i] >= 10)
                {
                    mm1.cont_salidas10m = mm1.cont_salidas10m + 1;
                }
                mm1.cont_salidasT = Math.Round(mm1.cont_salidas6m * 0.3) + (mm1.cont_salidas10m * ((0.7) * (0.9)));
            }
            mm1.T_D_E(mm1.tiempodeservicioredondeado, mm1.T_E_LLegadas());
            gmm1.TmaxCola1.Text  = "" + mm1.max_tiempo_cola;
            gmm1.TPromCola1.Text = "" + mm1.promedio_tiempo_cola;
            gmm1.TMinCola1.Text  = "" + mm1.min_tiempo_cola;
            gmm1.TMaxServ1.Text  = "" + mm1.tiempodeservicioredondeado.Max();
            gmm1.TMinServ1.Text  = "" + mm1.tiempodeservicioredondeado.Min();
            gmm1.TPromServ1.Text = "" + (mm1.tiempodeservicioredondeado.Sum() / Datos.rango);
            gmm1.Aband6M1.Text   = "" + Math.Round(mm1.cont_salidas6m * 0.3);
            gmm1.Aband10M1.Text  = "" + mm1.cont_salidas10m;
            gmm1.Label12.Text    = "" + mm1.cont_salidasT;
            gmm1.TextBox4.Text   = "" + mm1.tiempoentrellegadasredondeado[0];
            gmm1.TextBox5.Text   = "" + mm1.cont_EmpiezaCola;
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request["zId"]))
            {
                // if (!string.IsNullOrEmpty(Request["zId"]) && !IsPostBack)
                Response.Redirect("~/About.aspx");
            }
            _wz = Int32.Parse(Request["zId"]);
            if (User.Identity.Name != "ODS14")
            {
                Treg.Visible = false; Tzak.Visible = false;
            }
            if (!IsPostBack)
            {
                App_Code.Base db   = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
                DataTable     data = db.GetEvent(_wz);
                if (data.Rows.Count < 1)
                {
                    Response.Redirect("~/About.aspx");
                }
                Id.Text     = _wz.ToString();
                Sourse.Text = data.Rows[0]["Sourse"].ToString();
                Text1.Text  = data.Rows[0]["Sourse"].ToString();
                IO.Text     = data.Rows[0]["IO"].ToString();
                DataId.Text = data.Rows[0]["DataId"].ToString();
                dateReg     = ((DateTime)data.Rows[0]["DataId"]);
                if (!string.IsNullOrEmpty(data.Rows[0]["DataId"].ToString()))
                {
                    yyy  = ((DateTime)data.Rows[0]["DataId"]).Year.ToString();
                    ddd  = ((DateTime)data.Rows[0]["DataId"]).Day.ToString();
                    momo = ((DateTime)data.Rows[0]["DataId"]).Month.ToString();
                    hhh  = ((DateTime)data.Rows[0]["DataId"]).Hour.ToString();
                    mmm  = ((DateTime)data.Rows[0]["DataId"]).Minute.ToString();
                }
                RegistrId.Text = data.Rows[0]["RegistrId"].ToString();
                LiftId.Text    = data.Rows[0]["LiftId"].ToString();
                TextBox4.Text  = data.Rows[0]["LiftId"].ToString();
                TypeId.Text    = data.Rows[0]["TypeId"].ToString();
                EventId.Text   = data.Rows[0]["EventId"].ToString();
                Text.Text      = data.Rows[0]["EventId"].ToString();
                ToApp.Text     = data.Rows[0]["ToApp"].ToString();
                Text2.Text     = data.Rows[0]["ToApp"].ToString();
                DateToApp.Text = data.Rows[0]["DateToApp"].ToString();
                if (!string.IsNullOrEmpty(data.Rows[0]["DateToApp"].ToString()))
                {
                    yyy1  = ((DateTime)data.Rows[0]["DateToApp"]).Year.ToString();
                    ddd1  = ((DateTime)data.Rows[0]["DateToApp"]).Day.ToString();
                    momo1 = ((DateTime)data.Rows[0]["DateToApp"]).Month.ToString();
                    hhh1  = ((DateTime)data.Rows[0]["DateToApp"]).Hour.ToString();
                    mmm1  = ((DateTime)data.Rows[0]["DateToApp"]).Minute.ToString();
                }
                Who.Text     = data.Rows[0]["Who"].ToString();
                Comment.Text = data.Rows[0]["Comment"].ToString();
                Text5.Text   = data.Rows[0]["Prim"].ToString();
                Prim.Text    = data.Rows[0]["Prim"].ToString();
                DateWho.Text = data.Rows[0]["DateWho"].ToString();
                //   TextBox3.Text = data.Rows[0]["DateWho"].ToString();
                //   if (string.IsNullOrEmpty(TextBox3.Text))
                //   TextBox3.Text = Convert.ToString(DateTime.Now);
                string   d = string.Empty;
                string   d2 = string.Empty, t2 = string.Empty;
                TimeSpan pr = DateTime.Now - ((DateTime)data.Rows[0]["DataId"]);
                if (!(data.Rows[0]["DateWho"] is DBNull))
                {
                    d2 = ((DateTime)data.Rows[0]["DateWho"]).Date.ToString();
                    t2 = ((DateTime)data.Rows[0]["DateWho"]).TimeOfDay.ToString();
                    pr = ((DateTime)data.Rows[0]["DateWho"]) - ((DateTime)data.Rows[0]["DataId"]);
                }
                if (!(data.Rows[0]["DateToApp"] is DBNull))
                {
                    d = ((DateTime)data.Rows[0]["DateToApp"]).ToString();
                }
                string prostoy = ((int)pr.TotalDays).ToString() + " " + pr.Hours.ToString() + ":" +
                                 pr.Minutes.ToString();
                Timing.Text = prostoy;
                {
                    yyy2  = DateTime.Now.Year.ToString();
                    ddd2  = DateTime.Now.Day.ToString();
                    momo2 = DateTime.Now.Month.ToString();
                    hhh2  = DateTime.Now.Hour.ToString();
                    mmm2  = DateTime.Now.Minute.ToString();
                }
            }
            //Год/месяц/день
            List <string> yy = new List <string>()
            {
                yyy, "2016", "2017", "2018", "2019", "2020"
            };

            if (!IsPostBack)
            {
                YY.DataSource = yy;
                YY.DataBind();
                YY.SelectedIndex = 0;
            }
            List <string> yy1 = new List <string>()
            {
                yyy1, "2016", "2017", "2018", "2019", "2020"
            };

            if (!IsPostBack)
            {
                YY1.DataSource = yy1;
                YY1.DataBind();
                YY1.SelectedIndex = 0;
            }
            List <string> yy2 = new List <string>()
            {
                yyy2, "2016", "2017", "2018", "2019", "2020"
            };

            if (!IsPostBack)
            {
                YY2.DataSource = yy2;
                YY2.DataBind();
                YY2.SelectedIndex = 0;
            }
            List <string> mo = new List <string>()
            {
                momo, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
            };

            if (!IsPostBack)
            {
                MO.DataSource = mo;
                MO.DataBind();
                MO.SelectedIndex = 0;
            }
            List <string> mo1 = new List <string>()
            {
                momo1, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
            };

            if (!IsPostBack)
            {
                MO1.DataSource = mo1;
                MO1.DataBind();
                MO1.SelectedIndex = 0;
            }
            List <string> mo2 = new List <string>()
            {
                momo2, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
            };

            if (!IsPostBack)
            {
                MO2.DataSource = mo2;
                MO2.DataBind();
                MO2.SelectedIndex = 0;
            }
            List <string> dd = new List <string>()
            {
                ddd, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
            };

            if (!IsPostBack)
            {
                DD.DataSource = dd;
                DD.DataBind();
                DD.SelectedIndex = 0;
            }
            List <string> dd1 = new List <string>()
            {
                ddd1, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
            };

            if (!IsPostBack)
            {
                DD1.DataSource = dd1;
                DD1.DataBind();
                DD1.SelectedIndex = 0;
            }
            List <string> dd2 = new List <string>()
            {
                ddd2, "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
            };

            if (!IsPostBack)
            {
                DD2.DataSource = dd2;
                DD2.DataBind();
                DD2.SelectedIndex = 0;
            }

            //Часы/минуты
            List <string> hh = new List <string>()
            {
                hhh, "0", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"
            };

            if (!IsPostBack)
            {
                HH.DataSource = hh;
                HH.DataBind();
                HH.SelectedIndex = 0;
            }
            List <string> hh1 = new List <string>()
            {
                hhh1, "0", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"
            };

            if (!IsPostBack)
            {
                HH1.DataSource = hh1;
                HH1.DataBind();
                HH1.SelectedIndex = 0;
            }
            List <string> hh2 = new List <string>()
            {
                hhh2, "0", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"
            };

            if (!IsPostBack)
            {
                HH2.DataSource = hh2;
                HH2.DataBind();
                HH2.SelectedIndex = 0;
            }
            List <string> mm = new List <string>()
            {
                mmm, "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "00"
            };

            if (!IsPostBack)
            {
                MM.DataSource = mm;
                MM.DataBind();
                MM.SelectedIndex = 0;
            }
            List <string> mm1 = new List <string>()
            {
                mmm1, "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "00"
            };

            if (!IsPostBack)
            {
                MM1.DataSource = mm1;
                MM1.DataBind();
                MM1.SelectedIndex = 0;
            }
            List <string> mm2 = new List <string>()
            {
                mmm2, "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "00"
            };

            if (!IsPostBack)
            {
                MM2.DataSource = mm2;
                MM2.DataBind();
                MM2.SelectedIndex = 0;
            }

            //Диспетчер
            using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand("select p.surname, p.name, p.midlename from People p " +
                                                "where p.comments=@user and p.specialty=N'диспетчер'", conn);

                cmd.Parameters.AddWithValue("user", User.Identity.Name);

                List <string> iodisp = new List <string>()
                {
                    IO.Text
                };
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    iodisp.Add(dr[0].ToString() + " " + dr[1].ToString() + " " + dr[2].ToString());
                }
                dr.Close();
                if (!IsPostBack)
                {
                    FIO.DataSource = iodisp;
                    FIO.DataBind();
                    FIO.SelectedIndex = 0;
                    Fdr.Visible       = false;
                    TextBox5.Text     = IO.Text;
                }
            }
            //Механик
            List <string> worker = new List <string>()
            {
                ToApp.Text
            };

            if (!IsPostBack)
            {
                Workers.DataSource  = worker;
                Workers0.DataSource = worker;
                Workers.DataBind();
                Workers0.DataBind();
                Workers.SelectedIndex  = 0;
                Workers0.SelectedIndex = 0;
                Worker_TextChanged(this, EventArgs.Empty);
            }

            if (RegistrId.Text == "Эксплуатация лифтов")
            {
                Wrk.Visible   = true;
                Wrk0.Visible  = true;
                Text2.Visible = false;
                Text3.Visible = false;
            }
            else
            {
                Wrk.Visible   = false;
                Wrk0.Visible  = false;
                Text2.Visible = true;
                Text3.Visible = true;
            }
        }