Example #1
0
        public static int InsertServiceBillDetail(ServiceBillDetail newSBD)
        {
            String sqlInsert = @"INSERT INTO SERVICEBILLDETAIL(BILLID, SERVICEID, QUANTITY, PRICE)
                                VALUES        (@BILLID,@SERVICEID,@QUANTITY,@PRICE)";

            SqlParameter[] sqlParameters = { new SqlParameter("@BILLID", newSBD.BillID),
                                            new SqlParameter("@SERVICEID", newSBD.ServiceID),
                                            new SqlParameter("@QUANTITY", newSBD.Quantity),
                                           new SqlParameter("@PRICE",newSBD.Price)};

            return SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters);
        }
Example #2
0
        public static int InsertServiceBillDetail(ServiceBillDetail newSBD)
        {
            String sqlInsert = @"INSERT INTO SERVICEBILLDETAIL(BILLID, SERVICEID, QUANTITY, PRICE)
                                VALUES        (@BILLID,@SERVICEID,@QUANTITY,@PRICE)";

            SqlParameter[] sqlParameters = { new SqlParameter("@BILLID",    newSBD.BillID),
                                             new SqlParameter("@SERVICEID", newSBD.ServiceID),
                                             new SqlParameter("@QUANTITY",  newSBD.Quantity),
                                             new SqlParameter("@PRICE",     newSBD.Price) };

            return(SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters));
        }
Example #3
0
        // Insert bill detail after insert bill
        private void insertBillDetail()
        {
            switch (BillDetail.BillTypeID)
            {
                case Bill.MEDICINEBILL:

                    MedicineBillDetail newMedicineBillDetail = new MedicineBillDetail();

                    foreach (DataRow record in ((DataTable)dataViewBillDetail.DataSource).Rows)
                    {
                        newMedicineBillDetail.BillID = BillDetail.BillID;
                        newMedicineBillDetail.MedicineID = Convert.ToInt32(record["MEDICINEID"]);
                        newMedicineBillDetail.Quantity = Convert.ToInt32(record["Số lượng"]);
                        newMedicineBillDetail.Price = Convert.ToDecimal(record["Giá"]);

                        MedicineBillDetail.InsertMedicineBillDetail(newMedicineBillDetail);
                    }
                    break;

                case Bill.SERVICEBILL:

                    ServiceBillDetail newServiceBillDetail = new ServiceBillDetail();

                    foreach (DataRow record in ((DataTable)dataViewBillDetail.DataSource).Rows)
                    {
                        newServiceBillDetail.BillID = BillDetail.BillID;
                        newServiceBillDetail.ServiceID = Convert.ToInt32(record["SERVICEID"]);
                        newServiceBillDetail.Quantity = Convert.ToInt32(record["Số lượng"]);
                        newServiceBillDetail.Price = Convert.ToDecimal(record["Giá"]);

                        ServiceBillDetail.InsertServiceBillDetail(newServiceBillDetail);
                    }
                    break;
                case Bill.MATERIALBILL:

                    RentMaterialBillDetail newRentMaterialBillDetail = new RentMaterialBillDetail();

                    foreach (DataRow record in ((DataTable)dataViewBillDetail.DataSource).Rows)
                    {
                        newRentMaterialBillDetail.BillID = BillDetail.BillID;
                        newRentMaterialBillDetail.MaterialID = Convert.ToInt32(record["MATERIALID"]);
                        newRentMaterialBillDetail.Quantity = Convert.ToInt32(record["Số lượng"]);
                        newRentMaterialBillDetail.Price = Convert.ToDecimal(record["Giá"]);

                        RentMaterialBillDetail.InsertRentMaterialBillDetail(newRentMaterialBillDetail);
                    }
                    break;
            }
        }