예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnModify_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // check password
                //
                if (CheckEditPassword())
                {
                    foreach (GridViewRow row in this.GridView1.Rows)
                    {
                        int  dataID;
                        bool deleted;
                        GetDataIDAndDeleted(row, out dataID, out deleted);

                        if (deleted)
                        {
                            DitchDataDBI.Delete(dataID);
                        }
                    }

                    this.ClientScript.RegisterStartupScript(
                        this.GetType(),
                        "deletsuccess",
                        JavaScriptHelper.GetAlertScript("数据删除成功")
                        );
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "passworderror", GetScript("修改密码错误"));
                }
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        private void Query()
        {
            int[] deviceIDs = this.UCRain1.SelectedStationCollection.GetDeviceCollection().GetDeviceIDs();
            if (deviceIDs.Length == 1)
            {
                RangeType rt    = this.UCRain1.RangeType;
                DateTime  begin = this.UCRain1.Begin;
                DateTime  end   = this.UCRain1.End;

                DataTable tbl = null;

                switch (rt)
                {
                case RangeType.Real:
                    tbl = RainDBI.GetData(begin, end, deviceIDs);
                    break;

                case RangeType.Day:
                case RangeType.Month:
                case RangeType.Year:
                    tbl = RainDBI.GetDayData(begin, end, deviceIDs);
                    break;
                }

                H.DataSource = tbl;
                H.Bind();
            }
            else
            {
                ClientScript.RegisterStartupScript(
                    this.GetType(), "key",
                    JavaScriptHelper.GetAlertScript("只能选择一个测点.")
                    );
            }
        }
예제 #3
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("数据错误"));
                }
            }
        }
예제 #4
0
 private bool Check()
 {
     if (this.UCCompareAmount1.SelectedStationCollection.Count != 1)
     {
         string js = JavaScriptHelper.GetAlertScript("只能选择一个测点");
         this.ClientScript.RegisterStartupScript(this.GetType(), "key", js);
         return(false);
     }
     return(true);
 }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnModify_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (CheckEditPassword())
                {
                    this.Device = this.UCWLAdd1.SelectedStation.DeviceCollection[0];
                    int deviceID = this.UCWLAdd1.SelectedStation.DeviceCollection[0].DeviceID;

                    // delete history of the day
                    //
                    if (this.chkDeleteHistory.Checked)
                    {
                        DateTime dt = this.UCWLAdd1.Begin.Date;
                        DitchDataDBI.DeleteDay(deviceID, dt);
                    }

                    foreach (GridViewRow row in this.GridView1.Rows)
                    {
                        TextBox txtDT = row.Cells[1].Controls[1] as TextBox;
                        TextBox txtWL = row.Cells[2].Controls[1] as TextBox;

                        DateTime dt  = Convert.ToDateTime(txtDT.Text);
                        int      wl1 = Convert.ToInt32(txtWL.Text);

                        float flux = CalcInstantFlux(dt, wl1);
                        DitchDataDBI.Insert(deviceID, dt, wl1, 0, flux);
                    }

                    // alert success msg
                    //
                    string addSuccessMsg = "数据添加成功";
                    string js            = JavaScriptHelper.GetAlertScript(addSuccessMsg);
                    this.ClientScript.RegisterStartupScript(
                        this.GetType(),
                        "addSuccess",
                        js);
                }
                else
                {
                    ClientScript.RegisterStartupScript(
                        this.GetType(), "passworderror",
                        JavaScriptHelper.GetAlertScript("修改密码错误"));
                }
            }
            else
            {
                string js = JavaScriptHelper.GetAlertScript("输入数据错误!");
                this.ClientScript.RegisterStartupScript(this.GetType(), "key", js);
            }
        }
예제 #6
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("重新计算成功")
                    );
            }
        }