//protected void GridViewHistory_RowCommand(Object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName == "Delete") // { // GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; // //int id = Convert.ToInt32(e.CommandSource); // Label lblId = gvr.FindControl("lblId") as Label; // if (lblId != null) // { // using (ProjectTrackerContainer context = new ProjectTrackerContainer()) // { // int id = Convert.ToInt32(lblId.Text); // PubHistory ph = context.PubHistories.First(t => t.Id == id); // context.PubHistories.Remove(ph); // context.SaveChanges(); // GridViewHistory.DeleteRow(gvr.RowIndex); // } // } // } //} protected void GridViewHistory_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = GridViewHistory.Rows[e.RowIndex]; Label lblId = row.FindControl("lblId") as Label; if (lblId != null) { using (ProjectTrackerContainer context = new ProjectTrackerContainer()) { int id = Convert.ToInt32(lblId.Text); PubHistory hist = context.PubHistories.First(t => t.Id == id); context.PubHistories.Remove(hist); context.SaveChanges(); var pubHist = context.PubHistories .Join(context.Publications, h => h.PublicationId, p => p.Id, (h, p) => new { h }) //.Join(context.PublishStatus, ph => ph.h.Status, ps => ps.Id, (ph, ps) => new { ph.h.Id, ps.Name, ph.h.StartDate, ph.h.EndDate, ph.h.Creator, ph.h.PublicationId }) .Where(i => i.h.PublicationId == hist.PublicationId) .ToList(); GridViewHistory.DataSource = pubHist; GridViewHistory.DataBind(); } if (GridViewHistory.Rows.Count > 0) { GridViewHistory.SelectRow(GridViewHistory.Rows.Count - 1); GridViewHistory.SelectedRow.Focus(); } } }
protected void GridViewHistory_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Reset") { try { if (RoutingController.ResetLock(Convert.ToInt32(e.CommandArgument), User.Identity.Name)) { GridViewHistory.DataBind(); } else { DisplayMessage("Failed to Reset Locks.", DiscoveryMessageType.Error); } } catch (Exception e1) { if (ExceptionPolicy.HandleException(e1, "User Interface")) { DisplayMessage("Failed to Reset Locks."); } } } else if (e.CommandName == "Details") { RoutingHistoryId = Convert.ToInt32(e.CommandArgument); MultiViewHistory.ActiveViewIndex = 1; // Reset the page number TDCShipmentsUserControl.PageIndex = 0; // Search was clicked, refresh shipments TDCShipmentsUserControl.DataBind(); } }
protected void populate_data() { String filepath = HttpContext.Current.Server.MapPath(MortgageLogger.LOGPATH); GridViewHistory.DataSource = CSVHelper.GetDataTabletFromCSVFile(filepath); GridViewHistory.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { String filepath = HttpContext.Current.Server.MapPath(MortgageLogger.LOGPATH); GridViewHistory.DataSource = CSVHelper.GetDataTabletFromCSVFile(filepath); GridViewHistory.DataBind(); }
protected void ddlPublication_Changed(Object sender, EventArgs e) { int pubId; Int32.TryParse(ddlPublication.SelectedValue, out pubId); if (pubId > 0) { using (ProjectTrackerContainer context = new ProjectTrackerContainer()) { var pubHist = context.PubHistories .Join(context.Publications, h => h.PublicationId, p => p.Id, (h, p) => new { h }) //.Join(context.PublishStatus, ph => ph.h.StatusId, ps => ps.Id, (ph, ps) => new { ph.h.Id, ps.Name, ph.h.StartDate, ph.h.EndDate, ph.h.Creator, ph.h.PublicationId }) .Where(i => i.h.PublicationId == pubId) .ToList(); GridViewHistory.DataSource = pubHist; GridViewHistory.DataBind(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateControl()) { using (ProjectTrackerContainer context = new ProjectTrackerContainer()) { int pubId = Convert.ToInt32(ddlPublication.SelectedValue); PubHistory newHist = new PubHistory() { PublicationId = pubId, StatusId = PubStatus, PaperDate = Convert.ToDateTime(TextBoxStartDate.Text), Creator = Page.User.Identity.Name, CreateDate = Convert.ToDateTime(HiddenFieldCurrentDate.Value) }; context.PubHistories.Add(newHist); context.SaveChanges(); Response.Write("<script>alert('Publication History Saved.');</script>"); var pubHist = context.PubHistories .Join(context.Publications, h => h.PublicationId, p => p.Id, (h, p) => new { h }) //.Join(context.PublishStatus, ph => ph.h.StatusId, ps => ps.Id, (ph, ps) => new { ph.h.Id, ps.Name, ph.h.PaperDate, ph.h.Creator, ph.h.PublicationId }) .Where(i => i.h.PublicationId == pubId) .ToList(); GridViewHistory.DataSource = pubHist; GridViewHistory.DataBind(); } } else { Response.Write("<script>alert('Please check the data entered.');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { int hedgefundId = Convert.ToInt32(Request["hedgefundId"]); string strCode = Request["Code"].ToString().Trim().ToUpper(); string industryOrRating = Request["IndustryOrRating"]; _isEquity = (Request["IsEquity"].ToString() == "1") ? true : false; string stkName = ""; string industryName = ""; string strReason = "(无)"; string strPoolName = ""; string strAnalyst = "(未知)"; if (strCode.Length == 0) { return; } try { DataTable dtPool = DataService.GetInstance().GetFundSecurityPool(strCode, null, false, false, false, false, 0, _isEquity, new DateTime(1900, 1, 1), DateTime.Today, hedgefundId); if (dtPool.Rows.Count > 0) { stkName = dtPool.Rows[0]["s_info_name"].ToString(); industryName = dtPool.Rows[0]["SW_IND_NAME1"].ToString(); industryOrRating = dtPool.Rows[0]["s_info_indexcode"].ToString(); strReason = dtPool.Rows[0]["reason"].ToString(); strAnalyst = dtPool.Rows[0]["analystName"].ToString(); if (dtPool.Rows[0]["inbasepool"] != DBNull.Value) { strPoolName += "基础库 "; LabelPoolName.ForeColor = System.Drawing.Color.Blue; } if (dtPool.Rows[0]["incorepool"] != DBNull.Value) { strPoolName += "核心库 "; LabelPoolName.ForeColor = System.Drawing.Color.Blue; } if (dtPool.Rows[0]["inrestpool"] != DBNull.Value) { strPoolName += "限制库 "; LabelPoolName.ForeColor = System.Drawing.Color.Red; } if (dtPool.Rows[0]["inprohpool"] != DBNull.Value) { strPoolName += "禁止库 "; LabelPoolName.ForeColor = System.Drawing.Color.Red; } if (strPoolName.Trim().Length == 0) { strPoolName = "(未分配)"; LabelPoolName.ForeColor = System.Drawing.Color.Red; } } LabelCode.Text = strCode; LabelName.Text = stkName; LabelIndustry.Text = industryName; TextBoxReason.Text = (strReason.Length == 0)?"(无)":strReason; LabelPoolName.Text = strPoolName; LabelAnalyst.Text = strAnalyst; if (_isEquity) { spIndustryOrRating.InnerText = "行业"; } else { spIndustryOrRating.InnerText = "到期日"; } DataTable dtHistory = DataService.GetInstance().GetFundSecurityPoolHistory(strCode, new DateTime(1900, 1, 1), DateTime.Today, null, null); GridViewHistory.DataSource = dtHistory; GridViewHistory.DataBind(); LoadReportTable(strCode, industryOrRating); } catch (Exception ex) { TextBoxReason.Text = ex.Message; } } }
protected void PopulateData() { GridViewHistory.DataSource = MortgageLoggerSQL.GetDataTable(); GridViewHistory.DataBind(); }