Exemplo n.º 1
0
        protected void cboType_SelectedIndexChanged(object sender, EventArgs e)
        {
            clsChartofAccounts chart = new clsChartofAccounts();

            txtDescription.Text = "";
            cboType.Text        = cboType.SelectedValue.Substring(0, 2);

            if (cboType.Text == "EXP")
            {
                txtCode.Text = chart.FindRecKount(cboType.Text).ToString();
            }
            if (cboType.Text == "INC")
            {
                txtCode.Text = chart.FindRecKount(cboType.Text).ToString();
            }
        }
Exemplo n.º 2
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            clsChartofAccounts DB = new clsChartofAccounts();

            try
            {
                //Validate values
                if (txtCode == null)
                {
                    lblResults.Text = "Customer id cannot be empty";
                }
                if (txtCode.GetType() != typeof(int))
                {
                    lblResults.Text = "Code must be a whole number";
                }
                if (cboType == null)
                {
                    lblResults.Text = "Account type cannot be empty";
                }
                if (cboType.GetType() != typeof(string))
                {
                    lblResults.Text = "Account type must be valid";
                }
                if (txtDescription == null)
                {
                    lblResults.Text = "Particulars cannot be empty";
                }
                if (cboType.GetType() != typeof(string))
                {
                    lblResults.Text = "Particulars must be valid";
                }


                //string reccount = "";
                //reccount = DB.FindRecKount(cboType.Text);

                //if (reccount > 0)
                //{
                //    lblResults.Text = "Record already exists!!!";
                //    return;
                //}

                DB.Delete_rec(int.Parse(txtCode.Text), cboType.Text, txtDescription.Text);

                //public string Add_rec(String txtCustomerid, String txtCustomerName, String txtAddress,String txtTelephoneNo) Define the ADO.NET objects.
                //string connectionString =
                //connectionString = WebConfigurationManager.ConnectionStrings["FleetConnectionString"].ConnectionString;

                //string selectSQL = "SELECT * FROM tb_Customer ORDER BY convert(int,customerno)";
                //SqlConnection con = new SqlConnection(connectionString);
                //SqlCommand cmd = new SqlCommand(selectSQL, con);
                //SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                // Fill the DataSet.
                DataSet ds = new DataSet();
                ds = DB.FindTable();
                //adapter.Fill(ds, "tb_Customer");
                // Perform the binding.
                GridView1.DataSource = ds;
                GridView1.DataBind();

                lblResults.Text = "Operation successful";

                txtCode.Text        = "0";
                cboType.Text        = "";
                txtDescription.Text = "";


                return;
            }
            catch (Exception err)
            {
                EventLog log = new EventLog();
                log.Source = "Milorry Frontend";
                log.WriteEntry(err.Message, EventLogEntryType.Error);
                return;
            }
            finally
            {
                //con.Close();
            }
        }