protected void AllZPrim(object sender, EventArgs e) { DayPrim.Visible = true; // ReportTitle.Text = "Cобытия по закрепленным лифтам"; using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'замечания по лифтам' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type=N'ПНР/РЭО' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); List.DataSource = data; List.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'замечания по лифтам' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type=N'ПНР/РЭО' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListNA.DataSource = data; ListNA.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'запчасти и расходные материалы' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type=N'запчасти и расходные материалы' and ui.Family=N'Саргамонов' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListZap.DataSource = data; ListZap.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'запчасти и расходные материалы' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type=N'запчасти и расходные материалы' and ui.Family=N'Саргамонов' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListZapNA.DataSource = data; ListZapNA.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'инструменты и оборудование' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type=N'инструменты и оборудование' and ui.Family=N'Саргамонов' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListInst.DataSource = data; ListInst.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); List <Data> data = new List <Data>(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> lift = db.GetLiftId(_user); foreach (string _lift in lift) { SqlCommand cmd = new SqlCommand(); if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type!=N'ПНР/РЭО' and wz.Type=N'инструменты и оборудование' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type=N'инструменты и оборудование' and ui.Family=N'Саргамонов' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListInstNA.DataSource = data; ListInstNA.DataBind(); } } }
protected void LiftZPrim(object sender, EventArgs e) { DayPrim.Visible = true; ReportTitle.Text = "События по запланированным лифтам"; using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); DateTime d2 = _date.AddDays(1); List <Data> data1 = new List <Data>(); List <string> data = new List <string>(); SqlCommand cmd = new SqlCommand(); cmd = new SqlCommand("select p.TpId, p.[Date], p.DateEnd, p.LiftId, t.Ttx, p.Id as PlanId, p.Done from [Plan] p " + "join Users u on u.UserId=p.UserId " + "join LiftsTtx lt on lt.LiftId=p.LiftId " + "join Ttx t on lt.TtxId=t.Id and t.TtxTitleId=1 " + "where u.UserName=@UserName and (p.[Date] between @d1 and @d2) " + "order by p.[Date], p.DateEnd", conn); cmd.Parameters.AddWithValue("UserName", _user); cmd.Parameters.AddWithValue("d1", _date); cmd.Parameters.AddWithValue("d2", d2); SqlDataReader dn = cmd.ExecuteReader(); while (dn.Read()) { data.Add(dn[3].ToString()); //Запланированные лифты } dn.Close(); foreach (string _lift in data) { if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type!=N'ПНР/РЭО' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=0 and wz.Type=N'ПНР/РЭО' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data1.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); List.DataSource = data1; List.DataBind(); } } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); DateTime d2 = _date.AddDays(1); List <Data> data1 = new List <Data>(); List <string> data = new List <string>(); SqlCommand cmd = new SqlCommand(); cmd = new SqlCommand("select p.TpId, p.[Date], p.DateEnd, p.LiftId, t.Ttx, p.Id as PlanId, p.Done from [Plan] p " + "join Users u on u.UserId=p.UserId " + "join LiftsTtx lt on lt.LiftId=p.LiftId " + "join Ttx t on lt.TtxId=t.Id and t.TtxTitleId=1 " + "where u.UserName=@UserName and (p.[Date] between @d1 and @d2) " + "order by p.[Date], p.DateEnd", conn); cmd.Parameters.AddWithValue("UserName", _user); cmd.Parameters.AddWithValue("d1", _date); cmd.Parameters.AddWithValue("d2", d2); SqlDataReader dn = cmd.ExecuteReader(); while (dn.Read()) { data.Add(dn[3].ToString()); //Запланированные лифты } dn.Close(); foreach (string _lift in data) { if (_user != "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type!=N'ПНР/РЭО' and wz.LiftId=@userlift"; } else if (_user == "Sargamonov") { s = "select wz.Id, wz.UserId, wz.[Date], ui.Family, ui.IO, e.Id, wz.Done, wz.[Text], wz.[LiftId], wz.Type, wz.Readed from WorkerZayavky wz " + // "join Events e on e.ZayavId=wz.Id " + "join UserInfo ui on ui.UserId=wz.UserId " + "join Events e on e.WZayavId=wz.Id " + "where wz.Done=0 and wz.Readed=1 and wz.Type=N'ПНР/РЭО' and wz.LiftId=@userlift"; } cmd = new SqlCommand(s, conn); cmd.Parameters.AddWithValue("userlift", _lift); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { data1.Add(new Data() { Title = " №" + " " + dr[5].ToString(), Url = "~/WZClose.aspx?wz=" + Int32.Parse(dr["Id"].ToString()), Text1 = dr["Text"].ToString(), Idi = dr["LiftId"].ToString() }); } dr.Close(); ListNA.DataSource = data1; ListNA.DataBind(); } } }