示例#1
0
        private void SaveShift_Click(object sender, System.EventArgs e)
        {
            float?num = null;

            if (this.textBoxDischarge.Text.Trim() != "")
            {
                num = new float?(System.Convert.ToSingle(this.textBoxDischarge.Text));
            }
            float?num2 = null;

            if (this.textBoxGageHeight.Text.Trim() != "")
            {
                num2 = new float?(System.Convert.ToSingle(this.textBoxGageHeight.Text));
            }
            HydrometTools.Login login = new HydrometTools.Login();
            if (login.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    string text = HydrometEditsVMS.UpdateShift(login.Username, login.Password, this.cbtt.ToUpper().Trim(), this.textBoxPcode.Text.ToUpper().Trim(), (double)System.Convert.ToSingle(this.textBoxNewShift.Text));
                    if (text.ToLower().Contains("error"))
                    {
                        FormStatus.ShowStatus(text, true);
                    }
                    else
                    {
                        FormStatus.ShowStatus(text, false);
                        System.Console.WriteLine(text);
                        double          shift     = System.Convert.ToDouble(this.textBoxNewShift.Text);
                        string          arg_1D9_1 = this.cbtt.ToUpper().Trim();
                        string          arg_1D9_2 = this.textBoxPcode.Text.ToUpper().Trim();
                        System.DateTime arg_1D9_3 = System.Convert.ToDateTime(this.DateMeasured.Text);
                        float?          num3      = num;
                        double?         arg_1D9_4 = num3.HasValue ? new double?((double)num3.GetValueOrDefault()) : null;
                        num3 = num2;
                        Database.InsertShift(arg_1D9_1, arg_1D9_2, arg_1D9_3, arg_1D9_4, num3.HasValue ? new double?((double)num3.GetValueOrDefault()) : null, shift, this.textBoxComments.Text, System.DateTime.Now);
                        Reclamation.Core.BasicDBServer postgresServer = Reclamation.Core.PostgreSQL.GetPostgresServer("", "", "");
                        TimeSeriesName tn = new TimeSeriesName(this.cbtt.ToLower() + "_" + this.textBoxPcode.Text.ToLower(), "instant");
                        TimeSeriesDatabaseDataSet.seriespropertiesDataTable.Set("shift", shift.ToString(), tn, postgresServer);
                        this.ReadShiftTable();
                        this.textBoxPcode.Text      = "";
                        this.textBoxCbtt.Text       = "";
                        this.textBoxDischarge.Text  = "";
                        this.textBoxComments.Text   = "";
                        this.textBoxNewShift.Text   = "";
                        this.textBoxGageHeight.Text = "";
                    }
                }
                catch (System.Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }
            }
        }