コード例 #1
0
        private void RunQuery(string filter)
        {
            var usages = AmmeterDB.LoadAmmeterUsage(filter);

            this.dataGridView1.AutoGenerateColumns = true;
            //this.dataGridView1.
            bindingSource1.DataSource = (usages as DataSet).Tables[0];

            this.dataGridView1.DataSource = bindingSource1;
        }
コード例 #2
0
ファイル: FormAmmMod.cs プロジェクト: skyformat99/PowerSystem
 private void button_OK_Click(object sender, EventArgs e)
 {
     try
     {
         var cmd = CreateUpdateSql();
         AmmeterDB.ExcuteSql(cmd);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #3
0
        void menuItem_CloneAdd_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();

            FormAmmAdd form = new FormAmmAdd();

            form.CurrentData = (P_AmmeterInfo)this.SelectedNode.Tag;
            // form.ShowDialog(this);
            if (form.ShowDialog() == DialogResult.OK)
            {
                this.LoadData(AmmeterDB.LoadAmmInfoFromDatabase());
            }
        }
コード例 #4
0
 void button_OK_Click(object sender, EventArgs e)
 {
     try
     {
         string sql = string.Format("DELETE from AMMETERINFO where RowID = {0}", this.CurrentData.ROWID);
         AmmeterDB.ExcuteSql(sql);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #5
0
        void toolStripLoadData(object sender, EventArgs e)
        {
            this.autoToolStrip1.Enabled = false;
            try
            {
                var results = AmmeterDB.LoadAmmInfoFromDatabase();
                treeView_Ammeter.ClearData();
                this.treeView_Ammeter.AddData(results);
                this.treeView_Ammeter.BuildTree();
            }

            finally
            {
                this.autoToolStrip1.Enabled = true;
            }
        }
コード例 #6
0
ファイル: FormAmmAdd.cs プロジェクト: skyformat99/PowerSystem
        private void button_OK_Click(object sender, EventArgs e)
        {
            var cmd = CreateInsertSql();

            try
            {
                Debug.Write(cmd);
                AmmeterDB.ExcuteSql(cmd);
                this.DialogResult = DialogResult.OK;
                MessageBox.Show("添加成功");

                // this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #7
0
        private void OpeNode(DataOpeMode ope)
        {
            if (this.SelectedNode != null)
            {
                var groupnode = this.SelectedNode.Tag as LevelBase;
                if (groupnode != null)
                {
                    FormNodeModifyDelete form = new FormNodeModifyDelete();
                    form.Ope  = ope;
                    form.Info = this.SelectedNode.Tag as LevelBase;
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        this.LoadData(AmmeterDB.LoadAmmInfoFromDatabase());
                    }
                }
                else
                {
                    if (ope == DataOpeMode.Del)
                    {
                        FormAmmDel form = new FormAmmDel();

                        form.CurrentData = (P_AmmeterInfo)this.SelectedNode.Tag;
                        // form.ShowDialog(this);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            this.LoadData(AmmeterDB.LoadAmmInfoFromDatabase());
                        }
                    }
                    else if (ope == DataOpeMode.Mod)
                    {
                        FormAmmMod form = new FormAmmMod();

                        form.CurrentData = (P_AmmeterInfo)this.SelectedNode.Tag;
                        // form.ShowDialog(this);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            this.LoadData(AmmeterDB.LoadAmmInfoFromDatabase());
                        }
                    }
                }
            }
        }
コード例 #8
0
 private void button_OK_Click(object sender, EventArgs e)
 {
     try
     {
         var cmd = CreateUpdateSql();
         Debug.Write(cmd);
         AmmeterDB.ExcuteSql(cmd);
         MessageBox.Show("修改成功");
         //
         if (this.chkKeepWWindow.Checked != true)
         {
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.Close();
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #9
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string sql = string.Empty;

            if (this.editField1.Changed || this._ope == DataOpeMode.Del || this.comboField_phase.Changed)
            {
                if (MessageBox.Show(null, "确定修改?\r\n(修改完数据请最好重新启动应用程序重新加载数据)", "warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    if (L0companynode != null)
                    {
                        var cur = L0companynode;
                        sql = string.Format("update AMMETERINFO set USER_COMPANY = '{0}' where user_company= '{1}'",
                                            this.editField1.Result,
                                            cur.Company);
                    }
                    if (L1stationnode != null)
                    {
                        var cur = L1stationnode;
                        sql = string.Format("update AMMETERINFO set USER_STATION = '{0}' where user_company= '{1}' and USER_STATION = '{2}'",
                                            this.editField1.Result,
                                            cur.Company, cur.Station);
                    }
                    if (L2busnode != null)
                    {
                        var cur = L2busnode;
                        sql = string.Format("update AMMETERINFO set USER_BUS = '{0}' where user_company= '{1}' and USER_STATION = '{2}' and USER_BUS = '{3}'",
                                            this.editField1.Result,
                                            cur.Company, cur.Station, cur.Bus);
                    }
                    if (L3linenode != null)
                    {
                        var cur = L3linenode;
                        sql = string.Format("update AMMETERINFO set USER_LINENAME = '{0}' where user_company= '{1}' and USER_STATION = '{2}' and USER_BUS='{3}' and USER_LINENAME='{4}'",
                                            this.editField1.Result,
                                            cur.Company, cur.Station, cur.Bus, cur.Line);
                    }
                    if (L4transinfo != null)
                    {
                        var cur = L4transinfo;
                        sql = string.Format("update AMMETERINFO set USER_TRANSFORMER = '{0}' where user_company= '{1}' and USER_STATION = '{2}' and USER_BUS='{3}' and USER_LINENAME = '{4}' and USER_TRANSFORMER = '{5}' ",
                                            this.editField1.Result,
                                            cur.Company, cur.Station, cur.Bus, cur.Line, cur.Tranformer);
                    }
                    if (L5moduleinfo != null)
                    {
                        var cur = L5moduleinfo;
                        sql = string.Format("update AMMETERINFO set USER_MODULE = '{0}', user_phase = {7} where user_company= '{1}' and USER_STATION = '{2}' and USER_BUS='{3}' and USER_LINENAME = '{4}' and USER_TRANSFORMER = '{5}'and USER_MODULE = '{6}' ",
                                            this.editField1.Result,
                                            cur.Company, cur.Station, cur.Bus, cur.Line, cur.Tranformer, cur.Module, this.comboField_phase.Result);
                    }

                    try
                    {
                        if (this._ope == DataOpeMode.Del)
                        {
                            sql = "delete from AMMETERINFO " + sql.Substring(sql.IndexOf("where"));
                        }
                        AmmeterDB.ExcuteSql(sql);
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "错误");
                    }
                }
            }
        }