예제 #1
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            try
            {
                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(), "", varid.SelectedValue.ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "5" };

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

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

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

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

            finally
            {
                obj_op       = null;
                ds           = null;
                cmdSave.Text = "Save";
            }
        }
예제 #2
0
        private void GetTables()
        {
            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            try
            {
                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 = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "0" };

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

                tabname.DisplayMember = ds.Tables[0].Columns["TABLE_NAME"].ColumnName;
                tabname.ValueMember   = ds.Tables[0].Columns["TABLE_NAME"].ColumnName;
                tabname.DataSource    = ds.Tables[0];
            }

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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #3
0
        private void GetPermissionData(int id)
        {
            CDBOperations obj_op = null;

            try
            {
                string[] fldname  = { "@ID", "@UserID", "@FormID", "@Permission", "@fldvalue" };
                string[] fldvalue = { "0", "", "", "1", id.ToString() };

                obj_op = new CDBOperations();
                DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_Permissions");

                if (ds.Tables.Count > 0)
                {
                    DGPermissions.DataSource = ds.Tables[0];

                    DGPermissions.Columns[0].Visible  = false;
                    DGPermissions.Columns[1].ReadOnly = true;
                    DGPermissions.Columns[2].ReadOnly = true;
                    DGPermissions.Columns[3].ReadOnly = true;
                }

                ds = null;
            }

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

            finally
            {
                obj_op = null;
            }
        }
예제 #4
0
        private void tabname_SelectedIndexChanged(object sender, EventArgs e)
        {
            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            try
            {
                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(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "1" };


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

                varid.DisplayMember = ds.Tables[0].Columns["COLUMN_NAME"].ColumnName;
                varid.ValueMember   = ds.Tables[0].Columns["COLUMN_NAME"].ColumnName;
                varid.DataSource    = ds.Tables[0];

                cmdSave.Visible   = true;
                cmdDelete.Visible = true;
            }

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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #5
0
        private void GetPermissions()
        {
            CDBOperations obj_op = null;

            try
            {
                string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                string[] fldvalue = { "0", "", "", "1", "", "5", "", "", "", "" };

                obj_op = new CDBOperations();
                DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement");

                cboPermissions.DisplayMember = ds.Tables[0].Columns[1].ToString();
                cboPermissions.ValueMember   = ds.Tables[0].Columns[0].ToString();
                cboPermissions.DataSource    = ds.Tables[0];

                ds = null;
            }

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

            finally
            {
                obj_op = null;
            }
        }
예제 #6
0
        private bool IsUserExists()
        {
            CDBOperations obj_op  = null;
            bool          IsLogin = false;

            try
            {
                string[] fldname  = { "UserID", "Passwd" };
                string[] fldvalue = { txtUserID.Text, txtPasswd.Text };

                obj_op = new CDBOperations();
                DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_Login");

                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        IsLogin = true;
                    }
                }
            }

            catch (Exception ex)
            {
            }

            finally
            {
                obj_op = null;
            }

            return(IsLogin);
        }
예제 #7
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;
        }
예제 #8
0
        private void GrantPermissions()
        {
            CDBOperations obj_op = null;
            DataSet       ds     = null;

            try
            {
                ds     = new DataSet();
                obj_op = new CDBOperations();

                if (cboUser.SelectedValue == "" || cboUser.SelectedValue == null)
                {
                    MessageBox.Show("Please select users ", "User Missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (cboForms.SelectedValue == "" || cboForms.SelectedValue == null)
                {
                    MessageBox.Show("Please select forms ", "Form Missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (cboPermissions.SelectedValue == "" || cboPermissions.SelectedValue == null)
                {
                    MessageBox.Show("Please select permissions ", "Permission Missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string[] fldname  = { "@ID", "@UserID", "@FormID", "@Permission", "@fldvalue" };
                    string[] fldvalue = { "0", cboUser.SelectedValue.ToString(), cboForms.SelectedValue.ToString(), cboPermissions.SelectedValue.ToString(), "0" };

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

                    if (ds != null)
                    {
                        if (ds.Tables.Count > 0)
                        {
                            DGPermissions.DataSource = ds.Tables[0];

                            DGPermissions.Columns[0].Visible  = false;
                            DGPermissions.Columns[1].ReadOnly = true;
                            DGPermissions.Columns[2].ReadOnly = true;
                            DGPermissions.Columns[3].ReadOnly = true;
                        }
                    }
                }

                GetPermissionData(2);
            }


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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #9
0
        private void UpdateRecord()
        {
            CDBOperations obj_op = null;
            DataSet       ds     = null;

            try
            {
                DateTime EntryDate = new DateTime();
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
                EntryDate = Convert.ToDateTime(DateTime.Now.Date);


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

                if (var_user_id != "")
                {
                    if (cboStatus.SelectedValue.ToString() == "3")
                    {
                        string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                        string[] fldvalue = { var_user_id, txtUserID.Text, txtPasswd.Text, "False", "", "1", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() };

                        ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement");
                    }
                    else
                    {
                        string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                        string[] fldvalue = { var_user_id, txtUserID.Text, txtPasswd.Text, "True", "", "1", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() };

                        ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement");
                    }
                }
                else
                {
                    MessageBox.Show("Please select any record from User Management Grid ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }


                if (ds.Tables.Count > 0)
                {
                    DGUser.DataSource = ds.Tables[0];
                }
            }

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

            finally
            {
                cmdAddUser.Text = "Add User";
            }
        }
예제 #10
0
        private void AddUser()
        {
            CDBOperations obj_op = null;
            DataSet       ds     = null;

            try
            {
                DateTime EntryDate = new DateTime();
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
                EntryDate = Convert.ToDateTime(DateTime.Now.Date);


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


                string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                string[] fldvalue = { "0", txtUserID.Text, txtPasswd.Text, cboStatus.SelectedValue.ToString(), "0", "0", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() };

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


                if (ds.Tables.Count > 0)
                {
                    DGUser.DataSource = ds.Tables[0];
                }

                IsUpdate    = false;
                var_user_id = "";
            }


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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #11
0
        private void cmdDeleteUser_Click(object sender, EventArgs e)
        {
            CDBOperations obj_op = null;

            try
            {
                obj_op = new CDBOperations();

                if (var_user_id != "")
                {
                    DialogResult = MessageBox.Show("Are you sure you want to delete user ? Deletion of a user will also delete the permissions ", "Delete User", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (DialogResult.ToString() == "Yes")
                    {
                        string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                        string[] fldvalue = { var_user_id, "", "", "", "", "2", "", "", "", "" };

                        obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement");

                        cmdAddUser.Text = "Add User";

                        GetUsersData();
                        GetUser();
                    }
                }
                else
                {
                    MessageBox.Show("Please select record from the grid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                IsUpdate = false;
            }

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

            finally
            {
                ClearFields();
                obj_op = null;
            }
        }
예제 #12
0
        private void RevokePermissions_Click(object sender, EventArgs e)
        {
            CDBOperations obj_op = null;

            try
            {
                if (var_perm_id != "")
                {
                    obj_op = new CDBOperations();

                    DialogResult = MessageBox.Show("Are you sure you want to revoke the permission ? ", "Reveoke Permissions", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (DialogResult.ToString() == "Yes")
                    {
                        string[] fldname  = { "ID", "UserID", "FormID", "Permission", "fldvalue" };
                        string[] fldvalue = { var_perm_id, "", "", "", "3" };

                        obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_Permissions");

                        cmdGrantPermission.Text = "Grant Permission";

                        GetPermissionData(2);
                    }
                }
                else
                {
                    MessageBox.Show("Please select a record from the grid ", "Delete Permission Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

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

            finally
            {
                ClearFields();
                obj_op = null;
            }
        }
예제 #13
0
        private bool IsRecordExists()
        {
            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            bool IsExists = false;

            try
            {
                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(), "", varid.SelectedValue.ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "4" };

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

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            IsExists = true;
                        }
                    }
                }
            }

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

            finally
            {
                obj_op = null;
                ds     = null;
            }

            return(IsExists);
        }
예제 #14
0
        private bool IsPermissionExists()
        {
            bool          IsExists = false;
            CDBOperations obj_op   = null;

            try
            {
                string[] fldname  = { "@ID", "@UserID", "@FormID", "@Permission", "@fldvalue" };
                string[] fldvalue = { "0", cboUser.SelectedValue.ToString(), cboForms.SelectedValue.ToString(), cboPermissions.SelectedValue.ToString(), "7" };

                obj_op = new CDBOperations();
                DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_Permissions");

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            IsExists = true;
                        }
                    }
                }

                ds = null;
            }

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

            finally
            {
                obj_op = null;
            }

            return(IsExists);
        }
예제 #15
0
        private void GetUsersData()
        {
            CDBOperations obj_op = null;

            try
            {
                string[] fldname  = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" };
                string[] fldvalue = { "0", "", "", "", "", "3", "", "", "", "" };

                obj_op = new CDBOperations();
                DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement");

                if (ds.Tables.Count > 0)
                {
                    DGUser.DataSource = ds.Tables[0];

                    DGUser.Columns[0].Visible  = false;
                    DGUser.Columns[0].ReadOnly = true;
                    DGUser.Columns[1].ReadOnly = true;
                    DGUser.Columns[2].ReadOnly = true;
                    DGUser.Columns[3].ReadOnly = true;
                    DGUser.Columns[4].ReadOnly = true;
                    DGUser.Columns[5].ReadOnly = true;
                }

                ds = null;
            }

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

            finally
            {
                obj_op = null;
            }
        }
예제 #16
0
        private void varid_SelectedIndexChanged(object sender, EventArgs e)
        {
            CDBOperations obj_op = new CDBOperations();
            DataSet       ds     = null;

            try
            {
                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(), "", varid.SelectedValue.ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "2" };


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


                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            datatype.Enabled = true;
                            datatype.Text    = ds.Tables[0].Rows[0]["data_type"].ToString();
                            datatype.Enabled = false;


                            //if (datatype.Text == "real" || datatype.Text == "REAL")
                            //{
                            //    label11.Visible = true;
                            //    integerpart.Visible = true;

                            //    label12.Visible = true;
                            //    realpart.Visible = true;
                            //}
                            //else
                            //{
                            //    label11.Visible = false;
                            //    integerpart.Visible = false;

                            //    label12.Visible = false;
                            //    realpart.Visible = false;
                            //}

                            cmdSave.Visible   = true;
                            cmdDelete.Visible = true;
                        }
                    }
                }

                GetRecords();
            }

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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #17
0
        private void GetRecords()
        {
            string[] arr_min;
            string[] arr_max;
            string[] arr_val1;
            string[] arr_val2;
            string[] arr_val3;
            string[] arr_val4;

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

            try
            {
                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(), "", varid.SelectedValue.ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "6" };


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


                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            varname.Text        = ds.Tables[0].Rows[0]["var_name"].ToString();
                            varid.SelectedValue = ds.Tables[0].Rows[0]["var_id"].ToString();
                            varseq.Text         = ds.Tables[0].Rows[0]["var_seq"].ToString();
                            fielddesc.Text      = ds.Tables[0].Rows[0]["field_desc"].ToString();
                            remarks.Text        = ds.Tables[0].Rows[0]["remarks"].ToString();
                            datatype.Text       = ds.Tables[0].Rows[0]["data_type"].ToString();
                            //integerpart.Text = ds.Tables[0].Rows[0]["integerpart"].ToString();
                            //realpart.Text = ds.Tables[0].Rows[0]["realpart"].ToString();
                            fieldlen.Text     = ds.Tables[0].Rows[0]["field_len"].ToString();
                            fielddecimal.Text = ds.Tables[0].Rows[0]["field_decimal"].ToString();

                            if (ds.Tables[0].Rows[0]["minvalue"].ToString().IndexOf(".") == -1)
                            {
                                minvalue.Text = ds.Tables[0].Rows[0]["minvalue"].ToString();
                                maxvalue.Text = ds.Tables[0].Rows[0]["maxvalue"].ToString();
                                value1.Text   = ds.Tables[0].Rows[0]["value1"].ToString();
                                value2.Text   = ds.Tables[0].Rows[0]["value2"].ToString();
                                value3.Text   = ds.Tables[0].Rows[0]["value3"].ToString();
                                value4.Text   = ds.Tables[0].Rows[0]["value4"].ToString();
                                value5.Text   = ds.Tables[0].Rows[0]["value5"].ToString();

                                mychar.Text = "";

                                chkRealValue.Checked = false;
                            }
                            else
                            {
                                arr_min = ds.Tables[0].Rows[0]["minvalue"].ToString().Split('.');

                                if (arr_min[0] != "" && arr_min[1] != "")
                                {
                                    integerpart_min.Text = arr_min[0];
                                    realpart_min.Text    = arr_min[1];
                                }



                                arr_max = ds.Tables[0].Rows[0]["maxvalue"].ToString().Split('.');

                                if (arr_max[0] != "" && arr_max[1] != "")
                                {
                                    integerpart_max.Text = arr_max[0];
                                    realpart_max.Text    = arr_max[1];
                                }



                                arr_val1 = ds.Tables[0].Rows[0]["value1"].ToString().Split('.');

                                if (arr_val1[0] != "" && arr_val1[1] != "")
                                {
                                    integerpart1.Text = arr_val1[0];
                                    realpart1.Text    = arr_val1[1];
                                }



                                arr_val2 = ds.Tables[0].Rows[0]["value2"].ToString().Split('.');

                                if (arr_val2[0] != "" && arr_val2[1] != "")
                                {
                                    integerpart2.Text = arr_val2[0];
                                    realpart2.Text    = arr_val2[1];
                                }



                                arr_val3 = ds.Tables[0].Rows[0]["value3"].ToString().Split('.');

                                if (arr_val3[0] != "" && arr_val3[1] != "")
                                {
                                    integerpart3.Text = arr_val3[0];
                                    realpart3.Text    = arr_val3[1];
                                }



                                arr_val4 = ds.Tables[0].Rows[0]["value4"].ToString().Split('.');

                                if (arr_val4[0] != "" && arr_val4[1] != "")
                                {
                                    integerpart4.Text = arr_val4[0];
                                    realpart4.Text    = arr_val4[1];
                                }



                                mychar.Text = ".";

                                //value5.Text = ds.Tables[0].Rows[0]["value5"].ToString();

                                chkRealValue.Checked = true;
                            }


                            taborder.Text = ds.Tables[0].Rows[0]["taborder"].ToString();
                            message.Text  = ds.Tables[0].Rows[0]["msg"].ToString();

                            cmdSave.Text = "Update";
                        }
                        else
                        {
                            cmdSave.Text = "Save";
                            ClearFields1();
                        }
                    }
                }
            }

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

            finally
            {
                obj_op = null;
                ds     = null;
            }
        }
예제 #18
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";
            }
        }