示例#1
0
 private void button_OK_Click(object sender, EventArgs e)
 {
     try
     {
         var cmd = CreateUpdateSql();
         AmmeterDB.ExcuteSql(cmd);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#2
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());
     }
 }
示例#3
0
        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());
            }
        }
示例#4
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());
     }
 }
        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(), "错误");
                    }
                }
            }
        }