Пример #1
0
        private void chkRealValue_CheckedChanged(object sender, EventArgs e)
        {
            CDBOperations obj_op = new CDBOperations();

            if (chkRealValue.Checked == true)
            {
                obj_op.EnableControls(integerpart_min);
                obj_op.EnableControls(integerpart_max);
                obj_op.EnableControls(integerpart1);
                obj_op.EnableControls(integerpart2);
                obj_op.EnableControls(integerpart3);
                obj_op.EnableControls(integerpart4);

                obj_op.EnableControls(realpart_min);
                obj_op.EnableControls(realpart_max);
                obj_op.EnableControls(realpart1);
                obj_op.EnableControls(realpart2);
                obj_op.EnableControls(realpart3);
                obj_op.EnableControls(realpart4);

                obj_op.DisableControls(minvalue);
                obj_op.DisableControls(maxvalue);
                obj_op.DisableControls(value1);
                obj_op.DisableControls(value2);
                obj_op.DisableControls(value3);
                obj_op.DisableControls(value4);
                obj_op.DisableControls(value5);

                integerpart_min.Focus();
            }
            else
            {
                obj_op.DisableControls(integerpart_min);
                obj_op.DisableControls(integerpart_max);
                obj_op.DisableControls(integerpart1);
                obj_op.DisableControls(integerpart2);
                obj_op.DisableControls(integerpart3);
                obj_op.DisableControls(integerpart4);

                obj_op.DisableControls(realpart_min);
                obj_op.DisableControls(realpart_max);
                obj_op.DisableControls(realpart1);
                obj_op.DisableControls(realpart2);
                obj_op.DisableControls(realpart3);
                obj_op.DisableControls(realpart4);

                obj_op.EnableControls(minvalue);
                obj_op.EnableControls(maxvalue);
                obj_op.EnableControls(value1);
                obj_op.EnableControls(value2);
                obj_op.EnableControls(value3);
                obj_op.EnableControls(value4);
                obj_op.EnableControls(value5);

                minvalue.Focus();
            }

            obj_op = null;
        }
Пример #2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            string int_part_min = "";
            string int_part_max = "";
            string int_part1    = "";
            string int_part2    = "";
            string int_part3    = "";
            string int_part4    = "";


            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            try
            {
                if (chkRealValue.Checked == true)
                {
                    int_part_min = integerpart_min.Text + mychar.Text + realpart_min.Text;
                    int_part_max = integerpart_max.Text + mychar.Text + realpart_max.Text;
                    int_part1    = integerpart1.Text + mychar.Text + realpart1.Text;
                    int_part2    = integerpart2.Text + mychar.Text + realpart2.Text;
                    int_part3    = integerpart3.Text + mychar.Text + realpart3.Text;
                    int_part4    = integerpart4.Text + mychar.Text + realpart4.Text;


                    string[] fldname  = { "tabname", "var_name", "var_id", "var_nmae", "var_seq", "field_desc", "remarks", "data_type", "field_len", "field_decimal", "MinValue", "MaxValue", "value1", "value2", "value3", "value4", "value5", "taborder", "msg", "IsOthers", "Others_Value", "No_Options", "Isblank", "fldvalue" };
                    string[] fldvalue = { tabname.SelectedValue.ToString(), varname.Text, varid.SelectedValue.ToString(), varname.Text, varseq.Text, fielddesc.Text, remarks.Text, datatype.Text, fieldlen.Text, fielddecimal.Text, int_part_min, int_part_max, int_part1, int_part2, int_part3, int_part4, "", taborder.Text, message.Text, "", "", "", "", "3" };

                    ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_CreateDictionary");
                }
                else
                {
                    string[] fldname  = { "tabname", "var_name", "var_id", "var_nmae", "var_seq", "field_desc", "remarks", "data_type", "field_len", "field_decimal", "MinValue", "MaxValue", "value1", "value2", "value3", "value4", "value5", "taborder", "msg", "IsOthers", "Others_Value", "No_Options", "Isblank", "fldvalue" };
                    string[] fldvalue = { tabname.SelectedValue.ToString(), varname.Text, varid.SelectedValue.ToString(), varname.Text, varseq.Text, fielddesc.Text, remarks.Text, datatype.Text, fieldlen.Text, fielddecimal.Text, minvalue.Text, maxvalue.Text, value1.Text, value2.Text, value3.Text, value4.Text, value5.Text, taborder.Text, message.Text, "", "", "", "", "3" };

                    ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_CreateDictionary");
                }


                MessageBox.Show("Record saved successfully ", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ClearFields();
                cmdSave.Visible   = false;
                cmdDelete.Visible = false;


                obj_op.DisableControls(integerpart_min);
                obj_op.DisableControls(integerpart_max);
                obj_op.DisableControls(integerpart1);
                obj_op.DisableControls(integerpart2);
                obj_op.DisableControls(integerpart3);
                obj_op.DisableControls(integerpart4);

                obj_op.DisableControls(realpart_min);
                obj_op.DisableControls(realpart_max);
                obj_op.DisableControls(realpart1);
                obj_op.DisableControls(realpart2);
                obj_op.DisableControls(realpart3);
                obj_op.DisableControls(realpart4);

                obj_op.EnableControls(minvalue);
                obj_op.EnableControls(maxvalue);
                obj_op.EnableControls(value1);
                obj_op.EnableControls(value2);
                obj_op.EnableControls(value3);
                obj_op.EnableControls(value4);
                obj_op.EnableControls(value5);

                varid.Focus();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            finally
            {
                obj_op       = null;
                ds           = null;
                cmdSave.Text = "Save";
            }
        }