/// <summary> /// This procedure is automaticall /// called on Update /// </summary> override protected void OnDelete(EventArgs e) { // Calling base we check if the user has rights on deleting base.OnUpdate(e); if (ItemID > 0) { MilestonesDB milestonesDb = new MilestonesDB(); milestonesDb.DeleteMilestones(ItemID); } // This method is provided by the base class this.RedirectBackToReferringPage(); }
private void Page_Load(object sender, System.EventArgs e) { // If the page is being requested the first time, determine if a // Milestone itemID value is specified, and if so, // populate the page contents with the Milestone details. if (Page.IsPostBack == false) { //Item id is defined in base class if (ItemID > 0) { //Obtain a single row of Milestone information. MilestonesDB milestonesDB = new MilestonesDB(); SqlDataReader dr = milestonesDB.GetSingleMilestones(ItemID, WorkFlowVersion.Staging); try { //Load the first row into the DataReader if (dr.Read()) { TitleField.Text = (string)dr["Title"]; EstCompleteDate.Text = ((DateTime)dr["EstCompleteDate"]).ToShortDateString(); StatusBox.Text = (string)dr["Status"]; CreatedBy.Text = (string)dr["CreatedByUser"]; CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString(); // 15/7/2004 added localization by Mario Endara [email protected] if (CreatedBy.Text == "unknown" || CreatedBy.Text == string.Empty) { CreatedBy.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown"); } } } finally { dr.Close(); } } else { //Provide defaults EstCompleteDate.Text = DateTime.Now.AddDays(60).ToShortDateString(); } } }
/// <summary> /// This procedure is automaticall /// called on Update /// </summary> protected override void OnUpdate(EventArgs e) { // Calling base we check if the user has rights on updating base.OnUpdate(e); // Update onlyif the entered data is Valid if (Page.IsValid == true) { MilestonesDB milestonesDb = new MilestonesDB(); if (ItemID <= 0) { milestonesDb.AddMilestones(ItemID, ModuleID, PortalSettings.CurrentUser.Identity.Email, DateTime.Now, TitleField.Text, DateTime.Parse(EstCompleteDate.Text), StatusBox.Text); } else { milestonesDb.UpdateMilestones(ItemID, ModuleID, PortalSettings.CurrentUser.Identity.Email, DateTime.Now, TitleField.Text, DateTime.Parse(EstCompleteDate.Text), StatusBox.Text); } // Redirects to the referring page // This method is provided by the base class this.RedirectBackToReferringPage(); } }
private void Page_Load(object sender, System.EventArgs e) { // Added EsperantusKeys for Localization // Mario Endara [email protected] 11/05/2004 foreach (DataGridColumn column in myDataGrid.Columns) { switch (myDataGrid.Columns.IndexOf(column)) { case 1: column.HeaderText = Esperantus.Localize.GetString("MILESTONES_TITLE"); break; case 2: column.HeaderText = Esperantus.Localize.GetString("MILESTONES_COMPLETION_DATE"); break; case 3: column.HeaderText = Esperantus.Localize.GetString("MILESTONES_STATUS"); break; } } if (!Page.IsPostBack) { // Create an instance of MilestonesDB class MilestonesDB milestones = new MilestonesDB(); // Get the Milstones data for the current module. // ModuleID is defined on base class and contains // a reference to the current module. myDataGrid.DataSource = milestones.GetMilestones(ModuleID, Version); // Bind the milestones data to the grid. myDataGrid.DataBind(); } }