protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["LoginInfo"]; if (cookie == null) { Response.Redirect("~/Default.aspx"); } else if (cookie["IsStudent"] == "1") { Response.Redirect("~/TaskGeneration.aspx"); } else { if (cookie["IsStudent"] == "0" && ViewState["FirstTime"] == null) { MenuItem item = new MenuItem(); item.Value = "Редактирование"; item.NavigateUrl = "~/CheckYourselfEdit.aspx"; MainMenu0.Items[0].ChildItems[0].ChildItems.Add(item); ViewState["FirstTime"] = 1; } List <Student> students = model.Student.ToList(); ResultGridView.DataSource = students; ResultGridView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["ReqId"] != null) { if (Request["ReqId"] != "") { string req_id = Request["ReqId"].ToString(); ItemDal dal = new ItemDal(); DataSet ds = dal.GetRequestStockById(req_id); if (ds != null && ds.Tables[0].Rows.Count > 0) { lbReqId.Text = req_id; ResultGridView.DataSource = ds.Tables[0]; ResultGridView.DataBind(); } } } } else { } }
protected void btnLinQ_Click(object sender, EventArgs e) { RequestDAL dal = new RequestDAL(); string dt = txtDt.Text; DataSet ds = dal.GetRequest(dt, null); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dataTB = ds.Tables[0]; var dataRow = dataTB.AsEnumerable().Where(x => x.Field <string>("REQUEST_ID") == txtSearch.Text); DataTable result = dataRow.CopyToDataTable <DataRow>(); if (result != null && result.Rows.Count > 0) { ResultGridView.DataSource = result; ResultGridView.DataBind(); } else { ResultGridView.DataSource = null; ResultGridView.DataBind(); } } }
public void GetAllStudentResult() { EnrollCourse _EnrollCourse = new EnrollCourse(); _EnrollCourse.DepartmentId = Convert.ToInt32(DepartmentsDropDownList.SelectedValue); _EnrollCourse.StudentRegNo = StudentsRegNoDropDownList.SelectedItem.ToString(); ResultGridView.DataSource = _ResultRepository.GetAllResult(_EnrollCourse.DepartmentId, _EnrollCourse.StudentRegNo); ResultGridView.DataBind(); }
private void FillGrid() { dataTable = new DataTable(); cmd.Connection = conn; cmd.CommandText = "SELECT Name,ProductNumber,Color,SafetyStockLevel,ReorderPoint,StandardCost,ListPrice FROM Production.Product"; ad = new SqlDataAdapter(cmd); ad.Fill(dataTable); ResultGridView.DataSource = dataTable; ResultGridView.DataBind(); ViewState["dirState"] = dataTable; ViewState["sortdr"] = "Asc"; }
private void DisplayRequest(string username) { RequestDAL dal = new RequestDAL(); List <RequestData> listresult = dal.GetRequest(username); if (listresult != null && listresult.Count > 0) { ResultGridView.DataSource = listresult; ResultGridView.DataBind(); } }
private void button1_Click(object sender, EventArgs e) { DataTable table = new DataTable(); int MGLT = Int32.Parse(textMGLT.Text); GetApiResponse getApiResponse = new GetApiResponse(); getApiResponse.GetStopsForEachShip(MGLT); ResultGridView.DataSource = MegalightCalc.getInstance().DisplayFlightInfo(); ResultGridView.AutoResizeColumns(); ResultGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; ResultGridView.Visible = true; Calc.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { if (Doctors?.Count > 0 && Patients?.Count > 0 && Visits?.Count > 0) { if (!IsPostBack && Session.Keys.OfType <string>().Contains("year")) { int year = Convert.ToInt32(Session["year"]); var dict = new Dictionary <int, DateTime>(); foreach (var visit in Visits) { if (visit.VisitDate.Year == year) { int id = visit.DoctorId; if (!dict.ContainsKey(id) || dict[id] > Patients[visit.PatientId].BirthDate) { dict[id] = Patients[visit.PatientId].BirthDate; } } } if (dict.Count > 0) { var resultList = new List <ResultItem>(); foreach (var item in dict) { resultList.Add(new ResultItem { Name = Doctors[item.Key].Name, Age = DateTime.Today.Year - item.Value.Year }); } ResultGridView.DataSource = resultList; ResultGridView.DataBind(); } else { Response.Write(@"<script>alert('No solution')</script>"); } } else { Response.Write(@"<script>alert('Undefined year')</script>"); } } else { Response.Write("<script>alert('Data are missing')</script>"); } }
/// <summary> /// we check if out lists and dictionaries are not empty, /// after that we check if values was chosen, convert then and go through dictionary /// if we found the right id, date and price we add deliveries to the sum /// after that we set the table with found values and count average of the deliveries /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Deliveries?.Count > 0 && Goods?.Count > 0) { if (!IsPostBack && Session.Keys.OfType <string>().Contains("id") && Session.Keys.OfType <string>().Contains("price")) { int sentId = Convert.ToInt32(Session["id"]); int price = Convert.ToInt32(Session["price"]); int sum = 0; int counter = 0; foreach (var el in Deliveries) { if (el.Id == sentId && el.Date.Year == 2020 && el.Date.Month > 6 && el.Price >= price) { sum += el.SizeDeliveries; counter++; } } if (counter > 0) { var resultList = new List <ResultItem>(); resultList.Add(new ResultItem { Id = sentId, Name = Goods[sentId].Name, Average = sum / counter }); ResultGridView.DataSource = resultList; ResultGridView.DataBind(); } else { Response.Write(@"<script>alert('No solution')</script>"); } } else { Response.Write(@"<script>alert('Undefined sentId')</script>"); } } else { Response.Write("<script>alert('Data are missing')</script>"); } }
protected void btnSearch_Click(object sender, EventArgs e) { string[] data_arr = new string[3]; data_arr[0] = txtSearch.Text; data_arr[1] = txtSearcjNameSubject.Text; data_arr[2] = txtDt.Text; RequestDAL dal = new RequestDAL(); List <RequestData> listResult = dal.GetRequest(data_arr); if (listResult != null && listResult.Count > 0) { ResultGridView.DataSource = listResult; ResultGridView.DataBind(); } }
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { DataTable dtrslt = (DataTable)ViewState["dirState"]; if (dtrslt.Rows.Count > 0) { if (Convert.ToString(ViewState["sortdr"]) == "Asc") { dtrslt.DefaultView.Sort = e.SortExpression + " Desc"; ViewState["sortdr"] = "Desc"; } else { dtrslt.DefaultView.Sort = e.SortExpression + " Asc"; ViewState["sortdr"] = "Asc"; } ResultGridView.DataSource = dtrslt; ResultGridView.DataBind(); } }
protected void showButton_Click(object sender, EventArgs e) { string FromDate = fromDateTB.Text; string ToDate = toDateTB.Text; DateTime oDate = DateTime.Parse(FromDate); DateTime oDate2 = DateTime.Parse(ToDate); int Fday = oDate.Day; int Fmonth = oDate.Month; int Fyear = oDate.Year; int Tday = oDate2.Day; int Tmonth = oDate2.Month; int Tyear = oDate2.Year; string Fdate = Fyear + "-" + Fmonth + "-" + Fday; string Tdate = Tyear + "-" + Tmonth + "-" + Tday; ReportManager aManagera = new ReportManager(); List <testWReport> alist = aManagera.TestWiseResult(Fdate, Tdate); ResultGridView.DataSource = alist; ResultGridView.DataBind(); }
public EnvironmentComparerPluginControl(IThemeProvider themeProvider) { if (themeProvider == null) { throw new ArgumentNullException(nameof(themeProvider)); } InitializeComponent(); this.messenger = new Messenger(this); this.tEnv1Name.Text = "1. Connect to environment 1"; this.tConnectToEnv2.Text = ConnectToEnvironment2String; this.outputView = new OutputView(themeProvider, messenger); this.outputView.Show(this.dockPanel, DockState.DockBottomAutoHide); this.viewModel = new EnvironmentComparerViewModel(this.messenger); var scheduler = new AsyncJobScheduler(this, viewModel); this.resultTreeView = new ResultTreeView(themeProvider, scheduler, this.messenger, this.outputView); this.resultTreeView.Show(this.dockPanel, DockState.DockLeft); this.configuratorView = new ConfiguratorView(themeProvider, scheduler, this.messenger, this.outputView); this.configuratorView.Show(this.dockPanel, DockState.DockLeft); this.resultGridView = new ResultGridView(themeProvider, this.messenger, this.outputView); this.resultGridView.Show(this.dockPanel, DockState.Document); this.resultRecordView = new ResultRecordView(themeProvider, this.messenger); this.resultRecordView.Show(this.dockPanel, DockState.Document); this.actionsView = new ActionsView(themeProvider, scheduler, this.messenger, this.outputView); this.actionsView.Show(this.dockPanel, DockState.Document); var helpContentIndexProvider = new HelpContentIndexProvider(); var helpContentIndex = helpContentIndexProvider.GetIndex(); var helpRepository = new HelpRepository(helpContentIndex, GetType().Assembly); var helpView = new HelpView(this.messenger, this.outputView, helpRepository, Topics.Home); helpView.Show(this.dockPanel, DockState.DockRight); helpView.DockState = DockState.DockRightAutoHide; // trick used because the DockState.AutoHide doesn't works well with browser control: the WebBrowser control "Dispose" method throws an exception if the form has not been loaded this.resultGridView.Show(); this.configuratorView.Show(); this.tEquals.Bind(_ => _.Visible, this.viewModel, _ => _.AreEqual); this.messenger.Register <HighlightResultRecord>(m => { this.resultRecordView.Show(); }); this.messenger.Register <LoadEntitiesRequest>(m => { ExecuteMethod(LoadEntities); }); this.messenger.Register <StatusBarMessageEventArgs>(m => { this.SendMessageToStatusBar?.Invoke(this, m); }); }