Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnModify_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                if (CheckNewWL())
                {
                    if (CheckEditPassword())
                    {
                        this.Device = this.UCChannelStationDTOne1.SelectedStation.DeviceCollection[0];

                        int DATE_COLUMN_INDEX   = 1;
                        int NEW_WL_COLUMN_INDEX = 4;

                        int NEW_WL_VALUE_CONTROL_INDEX = 1;
                        //return;
                        foreach (GridViewRow row in this.GridView1.Rows)
                        {
                            int index = row.RowIndex;

                            TextBox txtNewWL = (TextBox)row.Cells[NEW_WL_COLUMN_INDEX].Controls[NEW_WL_VALUE_CONTROL_INDEX];
                            string  newWL    = txtNewWL.Text;
                            if (newWL.Length > 0)
                            {
                                int      newWLValue  = Convert.ToInt32(newWL);
                                int      dataID      = Convert.ToInt32(this.GridView1.DataKeys[index].Value);
                                DateTime dt          = Convert.ToDateTime(row.Cells[DATE_COLUMN_INDEX].Text);
                                float    instantFlux = CalcInstantFlux(dt, newWLValue);


                                DitchDataDBI.Update(dataID, newWLValue, 0, instantFlux);
                            }
                        }

                        // re query
                        //
                        QueryData();

                        this.ClientScript.RegisterStartupScript(
                            this.GetType(),
                            "modifysuccess",
                            JavaScriptHelper.GetAlertScript("数据修改成功")
                            );
                    }
                    else
                    {
                        // password error
                        ClientScript.RegisterStartupScript(this.GetType(), "passworderror", GetScript("修改密码错误"));
                    }
                }
                else
                {
                    // data error
                    ClientScript.RegisterStartupScript(this.GetType(), "dataerror", GetScript("数据错误"));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Calc_Click(object sender, EventArgs e)
        {
            if (Check())
            {
                DataTable tbl = this.GetData();
                foreach (DataRow row in tbl.Rows)
                {
                    int      dataID = Convert.ToInt32(row["ditchdataid"]);
                    DateTime dt     = Convert.ToDateTime(row["dt"]);
                    int      wl1    = Convert.ToInt32(row["wl1"]);
                    float    flux   = this.DeviceFormulaCollectionMap.FormulaCollection.CalcInstantFlux(dt, wl1, 0);

                    DitchDataDBI.Update(dataID, wl1, 0, flux);
                }

                Query();

                this.ClientScript.RegisterStartupScript(
                    this.GetType(),
                    "calcsuccess",
                    JavaScriptHelper.GetAlertScript("重新计算成功")
                    );
            }
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dataID"></param>
 /// <param name="wl1"></param>
 /// <param name="instantFlux"></param>
 private void UpdateData(int dataID, int wl1, float instantFlux)
 {
     //TODO:
     //
     DitchDataDBI.Update(dataID, wl1, 0, instantFlux);
 }