protected void Page_Load(object sender, EventArgs e) { CheckAccount(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); _workers = db.GetWorkers(); _hollidaysType = db.GetWorkTypes(); if (!IsPostBack) { SaveOrClear.DataSource = _soc; SaveOrClear.DataBind(); SaveOrClear.SelectedIndex = 0; HollidaysType.DataSource = _hollidaysType; HollidaysType.DataBind(); HollidaysType.SelectedIndex = 0; Base.UserInfo ui = db.GetUserInfo(_workers[0].UserName); From.Text = ui.HourBeg.ToString(); To.Text = ui.HourEnd.ToString(); Lunch.Text = ui.Lunch.ToString(); DataTable data = db.GetWorkTime(); List <Data> ls = new List <Data>(); foreach (DataRow dr in data.Rows) { ls.Add(new Data() { Name = dr["Family"].ToString() + " " + dr["IO"].ToString(), From = dr["HourBeg"].ToString(), To = dr["HourEnd"].ToString(), Lunch = dr["Lunch"].ToString() }); } Graf.DataSource = ls; Graf.DataBind(); WorkerName.DataSource = _workers; WorkerName.DataBind(); WorkerName.SelectedIndex = 0; List <string> s = db.GetIdU(); IdU.DataSource = s; IdU.DataBind(); if (s.Count > 0) { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); //Beg.SelectedDate = DateTime.Now.Date; //End.SelectedDate = DateTime.Now.Date.AddMonths(1); Calendar1.SelectedDate = DateTime.Now.Date; Calendar2.SelectedDate = DateTime.Now.Date.AddMonths(1); Calendar3.SelectedDate = DateTime.Now.Date; DHStart.SelectedDate = DateTime.Now.Date; DHEnd.SelectedDate = DateTime.Now.Date.AddMonths(1); Base.PersonData pd = _workers.Find(delegate(Base.PersonData i) { return(i.Title == WorkerName.SelectedValue); }); List <Base.UserLift> ul = db.GetUserLift(pd.Id); AllList.DataSource = ul; AllList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { CheckAccount(); if (!IsPostBack) { App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> s = db.GetIdU(); IdU.DataSource = s; IdU.DataBind(); if (s.Count > 0) { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); } if (!IsPostBack) { App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> areas = db.GetWZAreas(); Area.DataSource = areas; Area.DataBind(); Area.SelectedIndex = 0; List <string> nodes = db.GetWZNodes(Area.SelectedValue); Node.DataSource = nodes; Node.DataBind(); Node.SelectedIndex = 0; List <string> poz = db.GetWZPozition(Area.SelectedValue, Node.SelectedValue); Pozition.DataSource = poz; Pozition.DataBind(); Pozition.SelectedIndex = 0; } if (!IsPostBack) { using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); //выбор производителя и модели SqlCommand cmd; cmd = new SqlCommand("select Manufacturer, Model from PhisicalAddr " + "where LiftID=@lift", conn); cmd.Parameters.AddWithValue("lift", LiftId.SelectedValue); SqlDataReader dr = cmd.ExecuteReader(); // dr = cmd.ExecuteReader(); if (dr.Read()) { Disp.Text = dr[0].ToString() + "-" + dr[1].ToString() + ":"; } string mf = dr[0].ToString(); string md = dr[1].ToString(); dr.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { CheckAccount(); if (!string.IsNullOrEmpty(Request["lift"])) { _liftId = HttpUtility.HtmlDecode(Request["lift"]); } if (!string.IsNullOrEmpty(Request["ReturnUrl"])) { _url = HttpUtility.HtmlDecode(Request["ReturnUrl"]); } App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); _workers = db.GetWorkers(); if (!IsPostBack) { To.DataSource = _workers; To.DataBind(); To.SelectedIndex = 0; db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> list = db.GetIdU(); IdU.DataSource = list; IdU.DataBind(); if (!string.IsNullOrEmpty(_liftId)) { string[] s = _liftId.Split('/'); IdU.SelectedValue = s[0]; } else { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); if (!string.IsNullOrEmpty(_liftId)) { string[] s = _liftId.Split('/'); IdM.SelectedValue = s[1]; IdM_SelectedIndexChanged(sender, e); LiftId.SelectedValue = _liftId; LiftId_SelectedIndexChanged(sender, e); } string[] ss = { "1", "2" }; Category.DataSource = ss; Category.DataBind(); Category.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <string> du = new List <string>() { "1", "2", "3", "4" }; IdU.DataSource = du; IdU.DataBind(); IdU.SelectedIndex = 0; List <string> dm = new List <string>() { "1", "2", "3", "4", "5", "6" }; IdM.DataSource = dm; IdM.DataBind(); IdM.SelectedIndex = 0; List <string> dt = new List <string>() { "", "приказ о закреплении", "приказ о ТО", "план-график" }; Ndoc.DataSource = dt; Ndoc.DataBind(); Ndoc.SelectedIndex = 0; List <string> dn = new List <string>() { "", "не подписан", "не подписан заказчиком", "подписан", "отправлен", "получен" }; Sdoc.DataSource = dn; Sdoc.DataBind(); Sdoc.SelectedIndex = 0; TextBox5.Text = "0"; } DateTime date = DateTime.Now; Date.Text = DateTime.Now.ToLongDateString(); Mes1.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { CheckAccount(); App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); _workers = db.GetWorkers(); if (!IsPostBack) { Worker.DataSource = _workers; Worker.DataBind(); Worker.SelectedIndex = 0; List <string> ls = db.GetIdU(); IdU.DataSource = ls; IdU.DataBind(); if (ls.Count > 0) { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["y"]) && !string.IsNullOrEmpty(Request["m"])) { _year = Int32.Parse(Request["y"]); _month = Int32.Parse(Request["m"]); } else { _year = DateTime.Now.Year; _month = DateTime.Now.Month; } _role = CheckAccount(); if (!IsPostBack) { if (_role == "ODS") { Qst.Visible = false; Out.Visible = true; } else { App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> ls = db.GetIdU(); IdU.DataSource = ls; IdU.DataBind(); if (ls.Count > 0) { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); PeriodBeg.SelectedDate = DateTime.Now.AddMonths(-1); PeriodEnd.SelectedDate = DateTime.Now; Type.DataSource = LiftsReport._types; Type.DataBind(); Type.SelectedIndex = 0; } } }
protected void Page_Load(object sender, EventArgs e) { CheckAccount(); if (!string.IsNullOrEmpty(Request["lift"])) { _liftId = HttpUtility.HtmlDecode(Request["lift"]); } if (!string.IsNullOrEmpty(Request["ReturnUrl"])) { _url = HttpUtility.HtmlDecode(Request["ReturnUrl"]); } using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { conn.Open(); SqlCommand cmd = new SqlCommand("select ui.Family, ui.IO from UserInfo ui " + "join Users u on u.UserId=ui.UserId where u.UserName=@userName", conn); cmd.Parameters.AddWithValue("userName", User.Identity.Name); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { fam = dr[0].ToString(); } io = dr[1].ToString(); dr.Close(); } App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); _workers = db.GetWorkers(); if (!IsPostBack) { List <string> ls = db.GetIdU(); IdU.DataSource = ls; IdU.DataBind(); if (ls.Count > 0) { IdU.SelectedIndex = 0; } IdU_SelectedIndexChanged(sender, e); string[] ss = { "1", "2" }; Category.DataSource = ss; Category.DataBind(); Category.SelectedIndex = 0; db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); List <string> types = db.GetWZTypes(); Type.DataSource = types; Type.DataBind(); Type.SelectedIndex = 0; PrimLift_TextChanged(this, EventArgs.Empty); LiftId_SelectedIndexChanged(this, EventArgs.Empty); To.DataSource = _workers; To.DataBind(); To.SelectedIndex = 0; } List <string> typeakt = new List <string>() { "Акт дефектовки", "Акт повреждения оборудования" }; List <string> chel = new List <string>() { "", "Да", "Нет" }; List <string> chas = new List <string>() { "", "да", "Нет" }; if (!IsPostBack) { TypeAkt.DataSource = typeakt; TypeAkt.DataBind(); TypeAkt.SelectedIndex = 0; Chel.DataSource = chel; Chel.DataBind(); Chel.SelectedIndex = 0; Chas.DataSource = chas; Chas.DataBind(); Chas.SelectedIndex = 0; } }