Esempio n. 1
0
        ///Setting
        public void EditSetting(SetTable obj)
        {
            string sql = string.Format("UPDATE {0} SET {1} = '{2}' WHERE ID = {3};", obj.TableName, obj.NameParam, obj.ValueParam, obj.ID);

            using (SqlCommand cmd = new SqlCommand(sql, this.sqlCon))
            {
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 2
0
        public void AddSetting(SetTable obj)
        {
            string sql = string.Format("INSERT INTO {0} VALUES ('{1}');", obj.TableName, obj.ValueParam);

            using (SqlCommand cmd = new SqlCommand(sql, this.sqlCon))
            {
                cmd.ExecuteNonQuery();
            }
        }
        private void butOk_Click(object sender, EventArgs e)
        {
            switch (Mode)
            {
            case FormMode.Add:
                set = new SetTable(Convert.ToInt32(txtID.Text), Field, txtName.Text, Table);
                (this.MdiParent as MainForm).MainForm_AddSetting(set, e);
                break;

            case FormMode.Edit:
                set = new SetTable(Convert.ToInt32(txtID.Text), Field, txtName.Text, Table);
                (this.MdiParent as MainForm).MainForm_EditSetting(set, e);
                break;

            default:
                break;
            }
            butCancel_Click(sender, e);
            ///dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader;
            switch (Table)
            {
            case "Positions":
                (this.MdiParent as MainForm).positionToolStripMenuItem_Click(sender, e);
                break;

            case "WorkTimes":
                (this.MdiParent as MainForm).workTimesToolStripMenuItem_Click(sender, e);
                break;

            case "Educations":
                (this.MdiParent as MainForm).educationToolStripMenuItem_Click(sender, e);
                break;

            default:
                break;
            }
        }