Esempio n. 1
0
        public List <taxcodeworking> getTaxCodeDetails()
        {
            taxcodeworking        tcw;
            List <taxcodeworking> TaxCodeWorkings = new List <taxcodeworking>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select taxcode,operator,operatorValue,TaxItemName,SUBSTRING(TaxItemName,0,CHARINDEX('-',TaxItemName)) TaxItem" +
                                      " from TaxCodeWorking " +
                                      " where operator='Percentage' order by Taxcode";
                ////" where Taxcode='" + TaxCode + "' and operator='Percentage' order by Taxcode";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    tcw               = new taxcodeworking();
                    tcw.TaxCode       = reader.GetString(0);
                    tcw.Operator      = reader.GetString(1);
                    tcw.OperatorValue = reader.GetDouble(2);
                    tcw.TaxItemName   = reader.GetString(4);
                    TaxCodeWorkings.Add(tcw);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error Getting tax code details");
            }
            return(TaxCodeWorkings);
        }
Esempio n. 2
0
        public List <taxcodeworking> getTaxCodeWorkings(string TaxCode)
        {
            taxcodeworking        tcw;
            List <taxcodeworking> TaxCodeWorkings = new List <taxcodeworking>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select TaxCode, [LineNo],Description,Operator,OperandLine1,OperandLine2,OperatorValue," +
                                      "Amount, TaxItemName,status " +
                                      "from TaxcodeWorking  where Taxcode='" + TaxCode + "' order by Taxcode";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    tcw               = new taxcodeworking();
                    tcw.TaxCode       = reader.GetString(0);
                    tcw.LineNo        = reader.GetInt32(1);
                    tcw.Description   = reader.GetString(2);
                    tcw.Operator      = reader.GetString(3);
                    tcw.OperandLine1  = reader.GetInt32(4);
                    tcw.OperandLine2  = reader.GetInt32(5);
                    tcw.OperatorValue = reader.GetDouble(6);
                    tcw.Amount        = reader.GetDouble(7);
                    tcw.TaxItemName   = reader.GetString(8);
                    tcw.status        = reader.GetInt32(9);
                    TaxCodeWorkings.Add(tcw);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying Tax Code Workings");
            }
            return(TaxCodeWorkings);
        }