Beispiel #1
0
        public void LoadLvList()
        {
            try
            {
                SqlConnection cnSQL = new SqlConnection(MyModules.strConnect);
                SqlCommand    cmSQL = new SqlCommand("FetchUserAccessByPwd", cnSQL);
                cmdOk.Visible     = true;
                cmSQL.CommandType = CommandType.StoredProcedure;
                switch (listQuery1)
                {
                case "SystemUser":
                    cmSQL.CommandText = "FetchAllUserAccess";
                    // '-------------Accounts
                    break;

                case "Clients":
                    cmSQL.CommandText = "SELECT [Code] ,[Telephone],[Name],[Outline],[Address],[Email] FROM [Register] WHERE [Discontinue]<>1";
                    cmSQL.CommandType = CommandType.Text;
                    break;

                case "Services":
                    cmSQL.CommandText = "SELECT [Sn],[TransDate],[RefNo],[Name],[Telephone] ,[ServiceRendered] ,[ValueOfService] ,[AmountPaid] ,[AmountChargedFromReward],[Username] FROM [RewardAssured].[dbo].[Services] ORDER BY [TransDate] DESC";
                    cmSQL.CommandType = CommandType.Text;
                    break;
                }

                cnSQL.Open();
                dataAdapter = new SqlDataAdapter(cmSQL); //"AC_FetchAllPaymentVouchers", strConnect)
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(this.dataAdapter);
                DataTable         table          = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                this.dataAdapter.Fill(table);
                this.bindingSource.DataSource = table;

                cmSQL.Dispose();

                DGrid.Refresh();

                lblCount.Text = DGrid.Rows.Count.ToString();


                //filterStatusLabel.Text = DGrid.Rows.Count.ToString + " of " + DGrid.Rows.Count.ToString


                SelColumn.Minimum = 1;
                SelColumn.Maximum = DGrid.Columns.Count;

                MyModules.formatGrid(DGrid);


                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //  MessageBox.Show("Ooops! ERROR", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        public void LoadLvList(string strQ)
        {
            if (strQ == "" || strQ == null)
            {
                return;
            }
            try
            {
                strQryMain = strQ;
                string str;
                if (strQ == "<ALL>")
                {
                    str = "SELECT [Sn] AS [RefNo],[SchName] AS [School Name] ,[SchAddress] AS [School Address] ,[State],[EmailAddress] AS [Email Address] ,[Telephone] ,[BankName] AS [Bank Name],[BankAcctNo] AS [Account No],[BankCode] AS [Bank Code],[BankAddress] AS [Bank Address],[Remark],[InActive] FROM RegisterSchool";
                }
                else
                {
                    str = "SELECT [Sn] AS [RefNo],[SchName] AS [School Name] ,[SchAddress] AS [School Address] ,[State],[EmailAddress] AS [Email Address] ,[Telephone] ,[BankName] AS [Bank Name],[BankAcctNo] AS [Account No],[BankCode] AS [Bank Code],[BankAddress] AS [Bank Address],[Remark],[InActive] FROM RegisterSchool WHERE " + strQ;
                }


                SqlConnection cnSQL = new SqlConnection(MyModules.strConnect);
                SqlCommand    cmSQL = new SqlCommand();
                cmSQL.Connection  = cnSQL;
                cmSQL.CommandType = CommandType.Text;
                cmSQL.CommandText = str;


                cnSQL.Open();
                dataAdapter1 = new SqlDataAdapter(cmSQL);
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(this.dataAdapter1);
                DataTable         table          = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                this.dataAdapter1.Fill(table);
                this.BindingSource1.DataSource = table;

                cmSQL.Dispose();

                dGrid.Refresh();

                lblCount.Text = "List Count:" + dGrid.Rows.Count.ToString();


                //filterStatusLabel.Text = DGrid.Rows.Count.ToString + " of " + DGrid.Rows.Count.ToString


                SelColumn.Minimum       = 1;
                SelColumn.Maximum       = dGrid.Columns.Count;
                dGrid.Columns[1].Width  = 210;
                dGrid.Columns[2].Width  = 210;
                dGrid.Columns[6].Width  = 210;
                dGrid.Columns[9].Width  = 210;
                dGrid.Columns[0].Width  = 40;
                dGrid.Columns[11].Width = 50;


                MyModules.formatGrid(dGrid);


                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }