Пример #1
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 (!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();
                IO.Text        = data.Rows[0]["IO"].ToString();
                DataId.Text    = data.Rows[0]["DataId"].ToString();
                RegistrId.Text = data.Rows[0]["RegistrId"].ToString();
                LiftId.Text    = data.Rows[0]["LiftId"].ToString();
                TypeId.Text    = data.Rows[0]["TypeId"].ToString();
                EventId.Text   = data.Rows[0]["EventId"].ToString();
                ToApp.Text     = data.Rows[0]["ToApp"].ToString();
                DateToApp.Text = data.Rows[0]["DateToApp"].ToString();
                Who.Text       = data.Rows[0]["Who"].ToString();
                Comment.Text   = data.Rows[0]["Comment"].ToString();
                DateWho.Text   = data.Rows[0]["DateWho"].ToString();
                Text.Text      = data.Rows[0]["Prim"].ToString();
                Prim.Text      = data.Rows[0]["Prim"].ToString();
                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;
            }

            PIN.Visible = false;
        }
Пример #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 (!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();
         EventId.Text = data.Rows[0]["EventId"].ToString();
         DataId.Text  = data.Rows[0]["DataId"].ToString();
         //  IdU.Text = data.Rows[0]["IdU"].ToString();
         //  IdM.Text = data.Rows[0]["IdM"].ToString();
         LiftId.Text = data.Rows[0]["LiftId"].ToString();
         //   Sourse.Text = data.Rows[0]["Sourse"].ToString();
         //   ToApp.Text = data.Rows[0]["ToApp"].ToString();
         TypeId.Text = data.Rows[0]["TypeId"].ToString();
         // DateToApp.Text = data.Rows[0]["DateToApp"].ToString();
         DateWho.Text = data.Rows[0]["DateWho"].ToString();
         Who.Text     = data.Rows[0]["Who"].ToString();
         Comment.Text = data.Rows[0]["Comment"].ToString();
         Prim.Text    = data.Rows[0]["Prim"].ToString();
         //   ZayavId.Text = data.Rows[0]["ZayavId"].ToString();
         Idw.Text      = data.Rows[0]["WZayavId"].ToString();
         NameFoto.Text = data.Rows[0]["namefoto"].ToString();
         Name.Text     = data.Rows[0]["Name"].ToString();
         NumID.Text    = data.Rows[0]["NumID"].ToString();
         //тайминг
         TimeSpan pr = DateTime.Now - ((DateTime)data.Rows[0]["DataId"]);
         if (!(data.Rows[0]["DateWho"] is DBNull))
         {
             pr = ((DateTime)data.Rows[0]["DateWho"]) - ((DateTime)data.Rows[0]["DataId"]);
         }
         string prostoy = ((int)pr.TotalDays).ToString() + " " + pr.Hours.ToString() + ":" +
                          pr.Minutes.ToString();
         Timing.Text = prostoy;
         //   DocBase.Text = "Click";
         Sklad.Text = "подр.";
         Spis.Text  = "подр.";
         //   DopZap.Text = "Click";
         //   Status.Text = "подр.";
     }
 }
Пример #3
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 (!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();
         EventId.Text   = data.Rows[0]["EventId"].ToString(); ZaprosMng.Checked = Boolean.Parse(data.Rows[0]["ZaprosMng"].ToString());
         DataId.Text    = data.Rows[0]["DataId"].ToString();   ZaprosKP.Checked = Boolean.Parse(data.Rows[0]["ZaprosKP"].ToString());
         KP.Checked     = Boolean.Parse(data.Rows[0]["KP"].ToString());
         Comment.Text   = data.Rows[0]["Comment"].ToString(); ZapBill.Checked = Boolean.Parse(data.Rows[0]["ZapBill"].ToString());
         Prim.Text      = data.Rows[0]["Prim"].ToString();       Bill.Checked = Boolean.Parse(data.Rows[0]["Bill"].ToString());
         Idz.Text       = data.Rows[0]["ZayavId"].ToString();     Payment.Checked = Boolean.Parse(data.Rows[0]["Payment"].ToString());
         Idwz.Text      = data.Rows[0]["WZayavId"].ToString();   Dostavka.Checked = Boolean.Parse(data.Rows[0]["Dostavka"].ToString());
         LiftId.Text    = data.Rows[0]["LiftId"].ToString();   Prihod.Checked = Boolean.Parse(data.Rows[0]["Prihod"].ToString());
         Sourse.Text    = data.Rows[0]["Sourse"].ToString();   Peremeshenie.Checked = Boolean.Parse(data.Rows[0]["Peremeshenie"].ToString());
         Family.Text    = data.Rows[0]["Family"].ToString();   AktVR.Checked = Boolean.Parse(data.Rows[0]["AktVR"].ToString());
         TypeId.Text    = data.Rows[0]["TypeId"].ToString();   Spisanie.Checked = Boolean.Parse(data.Rows[0]["Spisanie"].ToString());
         ToApp.Text     = data.Rows[0]["ToApp"].ToString();     Cansel.Checked = Boolean.Parse(data.Rows[0]["Cansel"].ToString());
         DateToApp.Text = data.Rows[0]["DateToApp"].ToString();
         Who.Text       = data.Rows[0]["Who"].ToString();
         DateWho.Text   = data.Rows[0]["DateWho"].ToString();
         TimeSpan pr = DateTime.Now - ((DateTime)data.Rows[0]["DataId"]);
         if (!(data.Rows[0]["DateWho"] is DBNull))
         {
             pr = ((DateTime)data.Rows[0]["DateWho"]) - ((DateTime)data.Rows[0]["DataId"]);
         }
         string prostoy = ((int)pr.TotalDays).ToString() + " " + pr.Hours.ToString() + ":" +
                          pr.Minutes.ToString();
         Timing.Text = prostoy;
     }
 }
Пример #4
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"]);
                ZayavId.Text   = data.Rows[0]["ZayavId"].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();

                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();
                // clos = ((DateTime)data.Rows[0]["DateWho"]);
                Date.Text = DateTime.Now.ToLongDateString();
                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;
                DocName.Text = "документ";
                //Год/месяц/день

                /*    List<string> xx = new List<string>() {  "Акт неисправности", "Акт внеплановых работ", "Платежное поручение", "Счет" };
                 *  if (!IsPostBack)
                 *  {
                 *      DocName.DataSource = xx;
                 *      DocName.DataBind();
                 *      DocName.SelectedIndex = 0;
                 *  } */
                using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("select count(d.Id) from Documents d" +
                                                    " where d.NumEvent=@id and d.Usr=@usr", conn);
                    cmd.Parameters.AddWithValue("id", _wz);
                    cmd.Parameters.AddWithValue("usr", User.Identity.Name);
                    UsrDoc.Text = cmd.ExecuteScalar().ToString();
                }
                List <Data> datadoc = GetData();
                Out.DataSource = datadoc;
                Out.DataBind();

                List <Data> datdoc = GetData1();
                Out1.DataSource = datdoc;
                Out1.DataBind();
                //  DocPodp.Visible = true;
            }
        }
Пример #5
0
        protected void Akt_Click(object sender, EventArgs e)
        {
            //блок формирования акта
            if (Label1.Text == "")
            {
                Msg.Text = "Для формирования актов требуется ПИН-код!"; return;
            }
            string PodpEmic = Spec + " " + WorkPin;

            using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("select t.Ttx from Ttx t " +
                                                "join LiftsTtx l on l.TtxId=t.Id " +
                                                //   "join Ttx tt on tt.Id=t.Id " +
                                                "where t.TtxTitleId=1 and l.LiftId=@t", conn);
                cmd.Parameters.AddWithValue("t", LiftId.SelectedValue);
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    adrs = dr[0].ToString();
                }
                dr.Close();
                cmd = new SqlCommand("select PlantNum from PhisicalAddr where LiftId=@lift", conn);
                cmd.Parameters.AddWithValue("lift", LiftId.Text);
                SqlDataReader dn = cmd.ExecuteReader();
                if (dn.Read())
                {
                    numlift = dn[0].ToString();
                }
                dn.Close();
                int    _wz = 0;
                string dat = DateTime.Now.Date.ToLongDateString();
                string dd  = DateTime.Now.Day.ToString();
                string mm  = DateTime.Now.Month.ToString();
                string yy  = DateTime.Now.Year.ToString();
                string hh  = DateTime.Now.Hour.ToString() + "час." + DateTime.Now.Minute.ToString() + "мин.";
                _wz = Int32.Parse(NumEvent.Text);
                App_Code.Base db       = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
                DataTable     data     = db.GetEvent(_wz);
                string        worker   = data.Rows[0]["Family"].ToString() + " " + data.Rows[0]["IO"].ToString();
                BaseFont      baseFont = BaseFont.CreateFont(@"C:\Windows\Fonts\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
                if (TypeAkt.SelectedValue == "Акт дефектовки")
                {
                    PdfReader  template = new PdfReader(@"C:\temp\aktDef.pdf"); // файл шаблона
                    PdfStamper stamper  = new PdfStamper(template, new FileStream(@"C:\temp\akt.pdf", FileMode.Create));
                    AcroFields fields   = stamper.AcroFields;
                    fields.AddSubstitutionFont(baseFont);
                    fields.SetField("NaktDef", NumEvent.Text + "-А1.1"); //номер акта
                    fields.SetField("adr", adrs);
                    fields.SetField("Nlift", LiftId.SelectedValue + " № " + numlift);
                    fields.SetField("opis1", Text.Text);
                    fields.SetField("lift", LiftId.SelectedValue);
                    fields.SetField("opis1", data.Rows[0]["EventId"].ToString());
                    fields.SetField("fill_6", Chel.SelectedValue);
                    fields.SetField("fill_7", Chas.SelectedValue);
                    fields.SetField("dateS", dd + "." + mm + "." + yy + "г.");
                    fields.SetField("dateP", dd + "." + mm + "." + yy + "г.");
                    fields.SetField("Podt", FamZak.Text);
                    fields.SetField("Sost", Label1.Text);
                    fields.SetField("name1", Name1.Text);
                    if (Name1.Text != "")
                    {
                        fields.SetField("npp1", " 1.");
                    }
                    fields.SetField("name2", Name2.Text);
                    if (Name2.Text != "")
                    {
                        fields.SetField("npp2", " 2.");
                    }
                    fields.SetField("name3", Name3.Text);
                    if (Name3.Text != "")
                    {
                        fields.SetField("npp3", " 3.");
                    }
                    fields.SetField("name4", Name4.Text);
                    if (Name4.Text != "")
                    {
                        fields.SetField("npp4", " 4.");
                    }
                    fields.SetField("name5", Name5.Text);
                    if (Name5.Text != "")
                    {
                        fields.SetField("npp5", " 5.");
                    }
                    fields.SetField("obz1", Obz1.Text);
                    fields.SetField("obz2", Obz2.Text);
                    fields.SetField("obz3", Obz3.Text);
                    fields.SetField("obz4", Obz4.Text);
                    fields.SetField("obz5", Obz5.Text);
                    fields.SetField("ID1", ID1.Text);
                    fields.SetField("ID2", ID2.Text);
                    fields.SetField("ID3", ID3.Text);
                    fields.SetField("ID4", ID4.Text);
                    fields.SetField("ID5", ID5.Text);
                    fields.SetField("kol1", Kol1.Text);
                    fields.SetField("kol2", Kol2.Text);
                    fields.SetField("kol3", Kol3.Text);
                    fields.SetField("kol4", Kol4.Text);
                    fields.SetField("kol5", Kol5.Text);
                    stamper.FormFlattening = false;// ложь - открыт для записи, истина - закрыт
                    stamper.Close();
                    // запись в БД
                    FileStream fs  = new FileStream(@"C:\temp\akt.pdf", FileMode.Open);
                    Byte[]     pdf = new byte[fs.Length];
                    fs.Read(pdf, 0, pdf.Length);
                    cmd = new SqlCommand("insert into Documents (Name, NumEvent, Image, NameFile, Status, Usr) values (@name, @nev, @img, @namefile, @st, @usr )", conn);
                    cmd.Parameters.AddWithValue("name", "акт дефектовки");
                    cmd.Parameters.AddWithValue("nev", NumEvent.Text);
                    cmd.Parameters.AddWithValue("usr", Label1.Text);
                    cmd.Parameters.Add("img", SqlDbType.Image).Value         = pdf;
                    cmd.Parameters.Add("namefile", SqlDbType.NVarChar).Value = NumEvent.Text + "-A1_1.pdf";
                    cmd.Parameters.AddWithValue("st", "не подписан заказчиком");
                    cmd.ExecuteNonQuery();
                    fs.Close();

                    /*     string commandText = @"C:\temp\akt.pdf";
                     *   var proc = new System.Diagnostics.Process();
                     *   proc.StartInfo.FileName = commandText;
                     *   proc.StartInfo.UseShellExecute = true;
                     *   proc.Start();
                     */
                    Response.ContentType = "image"; //image/Jpeg
                    Response.BinaryWrite(pdf);
                }
                else if (TypeAkt.SelectedValue == "Акт повреждения оборудования")
                {
                    PdfReader  template = new PdfReader(@"C:\temp\aktPovr.pdf"); // файл шаблона
                    PdfStamper stamper  = new PdfStamper(template, new FileStream(@"C:\temp\akt.pdf", FileMode.Create));
                    AcroFields fields   = stamper.AcroFields;
                    fields.AddSubstitutionFont(baseFont);
                    fields.SetField("NaktPovr", NumEvent.Text + "-А3.1"); //номер акта
                    fields.SetField("adr", adrs);
                    fields.SetField("Nlift", LiftId.SelectedValue + " № " + numlift);
                    fields.SetField("opis1", Text.Text);
                    fields.SetField("lift", LiftId.SelectedValue);
                    fields.SetField("opis1", data.Rows[0]["EventId"].ToString());
                    fields.SetField("fill_6", Chel.SelectedValue);
                    fields.SetField("fill_7", Chas.SelectedValue);
                    fields.SetField("dateS", dd + "." + mm + "." + yy + "г.");
                    fields.SetField("dateP", dd + "." + mm + "." + yy + "г.");
                    fields.SetField("Podt", FamZak.Text);
                    fields.SetField("Sost", Label1.Text);
                    fields.SetField("name1", Name1.Text);
                    if (Name1.Text != "")
                    {
                        fields.SetField("npp1", " 1.");
                    }
                    fields.SetField("name2", Name2.Text);
                    if (Name2.Text != "")
                    {
                        fields.SetField("npp2", " 2.");
                    }
                    fields.SetField("name3", Name3.Text);
                    if (Name3.Text != "")
                    {
                        fields.SetField("npp3", " 3.");
                    }
                    fields.SetField("name4", Name4.Text);
                    if (Name4.Text != "")
                    {
                        fields.SetField("npp4", " 4.");
                    }
                    fields.SetField("name5", Name5.Text);
                    if (Name5.Text != "")
                    {
                        fields.SetField("npp5", " 5.");
                    }
                    fields.SetField("obz1", Obz1.Text);
                    fields.SetField("obz2", Obz2.Text);
                    fields.SetField("obz3", Obz3.Text);
                    fields.SetField("obz4", Obz4.Text);
                    fields.SetField("obz5", Obz5.Text);
                    fields.SetField("ID1", ID1.Text);
                    fields.SetField("ID2", ID2.Text);
                    fields.SetField("ID3", ID3.Text);
                    fields.SetField("ID4", ID4.Text);
                    fields.SetField("ID5", ID5.Text);
                    fields.SetField("kol1", Kol1.Text);
                    fields.SetField("kol2", Kol2.Text);
                    fields.SetField("kol3", Kol3.Text);
                    fields.SetField("kol4", Kol4.Text);
                    fields.SetField("kol5", Kol5.Text);
                    stamper.FormFlattening = false;
                    stamper.Close();
                    // запись в БД
                    FileStream fs  = new FileStream(@"C:\temp\akt.pdf", FileMode.Open);
                    Byte[]     pdf = new byte[fs.Length];
                    fs.Read(pdf, 0, pdf.Length);
                    cmd = new SqlCommand("insert into Documents (Name, NumEvent, Image, NameFile, Status, Usr) values (@name, @nev, @img, @namefile, @st, @usr )", conn);
                    cmd.Parameters.AddWithValue("name", "акт повреждения оборудования");
                    cmd.Parameters.AddWithValue("nev", NumEvent.Text);
                    cmd.Parameters.AddWithValue("usr", Label1.Text);
                    cmd.Parameters.Add("img", SqlDbType.Image).Value         = pdf;
                    cmd.Parameters.Add("namefile", SqlDbType.NVarChar).Value = NumEvent.Text + "-A3_1.pdf";
                    cmd.Parameters.AddWithValue("st", "не подписан заказчиком");
                    cmd.ExecuteNonQuery();
                    fs.Close();

                    /*   string commandText = @"C:\temp\akt.pdf";
                     *  var proc = new System.Diagnostics.Process();
                     *  proc.StartInfo.FileName = commandText;
                     *  proc.StartInfo.UseShellExecute = true;
                     *  proc.Start();
                     */
                    Response.ContentType = "image"; //image/Jpeg
                    Response.BinaryWrite(pdf);
                }
            }
        }
Пример #6
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;
            }
        }