Esempio n. 1
0
        public int SaveRowData(SaleItemWise sr)
        {
            string query = "INSERT INTO [dbo].[SalesRegister] " +
                           "( [InvoiceNo], [InvoiceDate], [InvoiceType],  " +
                           "BrandName,ProductName,ItemDescrpetion,BarCode,StyleCode" +
                           "[Qty], [MRP], [Discount], [BasicAmt], [TaxAmount], " +
                           "[RoundOff], LineTotal,[BillAmount], Salesman,[PaymentMode]) " +
                           " VALUES (@Inv,@InvD , @InvT, @BName,@PName,@IDes,@BCode,@SCode" +
                           "@QTY, @MRP, @Dis, @BAMT, @TAMT,  @ROFF,@Ltotal, @BILL,@Sman,  @PM)";

            ;
            SqlCommand cmd;

            if (sqlDB == null || sqlDB.State != ConnectionState.Open)
            {
                cmd = new SqlCommand(query, (SqlConnection)DataBase.GetConnectionObject(ConType.SQLDB));
            }
            else
            {
                cmd = new SqlCommand(query, sqlDB);
            }

            // cmd.CommandText = query;
            //cmd.Connection = GetConnection();
            cmd.Parameters.AddWithValue("@Inv", sr.InvoiceNo);
            cmd.Parameters.AddWithValue("@InvD", sr.InvDate);
            cmd.Parameters.AddWithValue("@InvT", sr.InvType);
            cmd.Parameters.AddWithValue("@QTY", sr.QTY);
            cmd.Parameters.AddWithValue("@MRP", sr.MRP);
            cmd.Parameters.AddWithValue("@Dis", sr.Discount);
            cmd.Parameters.AddWithValue("@BAMT", sr.BasicRate);
            cmd.Parameters.AddWithValue("@TAMT", sr.Tax);
            cmd.Parameters.AddWithValue("@ROFF", sr.RoundOff);
            cmd.Parameters.AddWithValue("@BILL", sr.BillAmnt);
            cmd.Parameters.AddWithValue("@PM", sr.PaymentType);
            cmd.Parameters.AddWithValue("@Sman", sr.Saleman);
            cmd.Parameters.AddWithValue("@BCode", sr.Barcode);
            cmd.Parameters.AddWithValue("@SCode", sr.StyleCode);
            cmd.Parameters.AddWithValue("@Ltotal", sr.LineTotal);
            cmd.Parameters.AddWithValue("@BName", sr.Barcode);
            cmd.Parameters.AddWithValue("@PName", sr.StyleCode);
            cmd.Parameters.AddWithValue("@IDes", sr.LineTotal);
            return(InsertQuerySql(cmd));
        }
Esempio n. 2
0
        private int AddColSale(Cell cell, ref SaleItemWise sr, int c)
        {
            Logs.LogMe("cell(" + cell.ColumnIndex + ")=" + cell.Text);
            switch (cell.ColumnIndex)
            {
            case 0:
                sr.InvoiceNo = cell.Text;
                c++;
                break;

            case 1:
                sr.InvDate = DataConvertor.DateFromExcelFormatString(cell.Text);
                c++;
                break;

            case 2:
                sr.InvType = cell.Text;
                c++;
                break;

            case 3:
                sr.BrandName = cell.Text;
                c++;
                break;

            case 4:
                sr.ProductName = cell.Text;
                c++;
                break;

            case 5:
                sr.ItemDesc = cell.Text;
                c++;
                break;

            case 6:
                sr.Barcode = cell.Text;
                c++;
                break;

            case 7:
                sr.StyleCode = cell.Text;
                c++;
                break;

            case 8:
                sr.QTY = (int)cell.Amount;
                c++;
                break;

            case 9:
                sr.MRP = cell.Amount;
                c++;
                break;

            case 10:
                sr.BasicRate = cell.Amount;
                c++;
                break;

            case 11:
                sr.Discount = cell.Amount;
                c++;
                break;

            case 12:
                sr.Tax = cell.Amount;
                c++;
                break;

            case 14:
                sr.RoundOff = cell.Amount;
                c++;
                break;

            case 13:
                sr.LineTotal = cell.Amount;
                c++;
                break;

            case 15:
                sr.BillAmnt = cell.Amount;
                c++;
                break;

            case 16:
                sr.Saleman = cell.Text;
                c++;
                break;

            case 17:
                sr.PaymentType = cell.Text;
                c++;
                break;
            }

            return(c);
        }