예제 #1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            AcceptStatsLog acceptlog = new AcceptStatsLog();

            acceptlog.PullRequestId = int.Parse(txtPullRequestID.Text);
            acceptlog.SubmitDate    = DateTime.ParseExact(txtSubmitDate.Text, "dd/MM/yyyy HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);

            acceptlog.SubmitPerson = txtSubmitPerson.Text;
            string fileInfo = txtFileCount.Text.Trim();
            int    posn     = fileInfo.IndexOf('.');

            if (posn > 0)
            {
                acceptlog.FileCount = int.Parse(fileInfo.Substring(0, posn));
            }
            else
            {
                acceptlog.FileCount = int.Parse(txtFileCount.Text);
            }

            acceptlog.LogPerson     = txtName.Text;
            acceptlog.LogReason     = txtDetails.Text;
            acceptlog.LogAcceptDate = DateTime.ParseExact(txtAcceptDate.Text, "dd/MM/yyyy HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);
            acceptlog.LogStatus     = true;

            bool doAcceptStats = false;
            bool doUpdateStats = false;

            if (lblTitle.Text.StartsWith("Update"))
            {
                int pullRequestId2 = 0;
                if (int.TryParse(txtPullRequestId2.Text, out pullRequestId2) == true)
                {
                    acceptlog.StatsPullRequestId = pullRequestId2;
                    acceptlog.LogReason          = "Update 'Accepted' Stats to Pull Request Id: " + pullRequestId2.ToString();
                    acceptlog.LogStatus          = false;
                    doUpdateStats = true;
                }
            }
            else
            {
                doAcceptStats = true;
            }

            txtName.Text           = string.Empty;
            txtDetails.Text        = string.Empty;
            txtPullRequestId2.Text = string.Empty;
            this.ModalPopupExtender1.Hide();

            if (doAcceptStats == true)
            {
                WebAP_Interactions.UpdatePullRequestStats("Accept", acceptlog);
            }
            else if (doUpdateStats == true)
            {
                WebAP_Interactions.UpdatePullRequestStats("Update", acceptlog);
            }

            Response.Redirect(Request.RawUrl);
        }
예제 #2
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlApsimFile.SelectedItem.Value == "0")
                {
                    throw new Exception("Please select a valid Apsim FileName.");
                }
                if (ddlTableName.SelectedItem.Value == "0")
                {
                    throw new Exception("Please select a valid TableName.");
                }
                if (txtNewTableName.Text.Trim().Length <= 0)
                {
                    throw new Exception("Please enter a New TableName.");
                }
                if (ddlTableName.SelectedItem.Text.Trim() == txtNewTableName.Text.Trim())
                {
                    throw new Exception("The New Tablename cannot be the same as the old TableName.");
                }

                PORename rename = new PORename();
                rename.SubmitUser   = txtUserName.Text;
                rename.Type         = "TableRename";
                rename.FileName     = ddlApsimFile.SelectedItem.Text;
                rename.TableName    = ddlTableName.SelectedItem.Text;
                rename.NewTableName = txtNewTableName.Text;

                WebAP_Interactions.RenamePredictedObservedTable(rename);
            }
            catch (Exception ex)
            {
                lblErrors.Text = "Error:  " + ex.Message.ToString();
            }
        }