Exemplo n.º 1
0
        public override RawMaterialOrderDetail GetRawMaterialOrderDetailByRawMaterialOrderDetailIDDAL(Guid RawMaterialOrderDetailID)
        {
            RawMaterialOrderDetail matchingRawMaterialOrderDetail = null;

            try
            {
                //Find RawMaterialOrderDetail based on searchRawMaterialOrderDetailID
                matchingRawMaterialOrderDetail = RawMaterialorderlist.Find(
                    (item) => { return(item.RawMaterialOrderDetailID == RawMaterialOrderDetailID); }
                    );
            }
            catch (Exception)
            {
                throw;
            }
            return(matchingRawMaterialOrderDetail);
        }
Exemplo n.º 2
0
        /// <returns>Determinates whether the new systemUser is added.</returns>
        public override bool AddRawMaterialOrderDetailDAL(RawMaterialOrderDetail newRawMaterialOrderDetail)
        {
            bool RawMaterialOrderDetailAdded = false;

            try
            {
                newRawMaterialOrderDetail.RawMaterialOrderDetailID = Guid.NewGuid();

                RawMaterialorderlist.Add(newRawMaterialOrderDetail);

                RawMaterialOrderDetailAdded = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(RawMaterialOrderDetailAdded);
        }
Exemplo n.º 3
0
        public override bool UpdateRawMaterialOrderDetailDAL(RawMaterialOrderDetail updateRawMaterialOrderDetail)
        {
            bool RawMaterialOrderDetailUpdated = false;

            try
            {
                RawMaterialOrderDetail matchingRawMaterialOrderDetail = GetRawMaterialOrderDetailByRawMaterialOrderDetailIDDAL(updateRawMaterialOrderDetail.RawMaterialOrderDetailID);

                if (matchingRawMaterialOrderDetail != null)
                {
                    matchingRawMaterialOrderDetail = updateRawMaterialOrderDetail;


                    RawMaterialOrderDetailUpdated = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(RawMaterialOrderDetailUpdated);
        }
Exemplo n.º 4
0
        public override bool DeleteRawMaterialOrderDetailDAL(Guid deleteRawMaterialOrderDetailID)
        {
            bool RawMaterialOrderDetailDeleted = false;

            try
            {
                //Find RawMaterialOrderDetail based on searchRawMaterialOrderDetailID
                RawMaterialOrderDetail matchingRawMaterialOrderDetail = RawMaterialorderlist.Find(
                    (item) => { return(item.RawMaterialOrderDetailID == deleteRawMaterialOrderDetailID); }
                    );

                if (matchingRawMaterialOrderDetail != null)
                {
                    //Delete RawMaterialOrderDetail from the collection
                    RawMaterialorderlist.Remove(matchingRawMaterialOrderDetail);
                    RawMaterialOrderDetailDeleted = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(RawMaterialOrderDetailDeleted);
        }
Exemplo n.º 5
0
        public static async Task PlaceOrder()
        {
            try
            {
                string                    choice1 = "N";
                List <RawMaterial>        selectedRawMaterials     = new List <RawMaterial>();
                List <double>             quantitylist             = new List <double>();
                RawMaterialOrder          RawMaterialorder         = new RawMaterialOrder();
                IRawMaterialOrderBL       RawMaterialorderBL       = new RawMaterialOrderBL();
                ISupplierBL               SupplierBL               = new SupplierBL();
                Supplier                  Supplier                 = new Supplier();
                RawMaterial               RawMaterial              = new RawMaterial();
                RawMaterialBL             rawMaterialBL            = new RawMaterialBL();
                IRawMaterialOrderDetailBL RawMaterialorderDetailBL = new RawMaterialOrderDetailBL();
                Supplier = await SupplierBL.GetSupplierByEmailBL(CommonData.CurrentUser.Email);

                List <RawMaterial> RawMaterialList = new List <RawMaterial>();


                RawMaterialList = await rawMaterialBL.GetAllRawMaterialsBL();

                foreach (RawMaterial item in RawMaterialList)
                {
                    WriteLine(item.RawMaterialName + "  " + item.RawMaterialCode);
                }
                do
                {
                    WriteLine("Enter the code of the RawMaterial ");
                    string      code        = ReadLine();
                    RawMaterial rawMaterial = await rawMaterialBL.GetRawMaterialByRawMaterialCodeBL("code");

                    if (rawMaterial != null)


                    {
                        WriteLine("Enter the Quantity of the RawMaterial ");
                        RawMaterialorder.RawMaterialTotalQuantity = double.Parse(ReadLine());
                    }
                    else
                    {
                        WriteLine("wrong raw material code");
                    }

                    // RawMaterial rawMaterial1 = await rawMaterialBL.GetRawMaterialByRawMaterialCodeBL(code);
                    selectedRawMaterials.Add(rawMaterial);

                    double RawMaterialorderTotalPrice = rawMaterial.RawMaterialPrice * RawMaterialorder.RawMaterialTotalQuantity;
                    Console.WriteLine("Do you want to add more RawMaterials? Enter  Y/N");
                    choice1 = Console.ReadLine();
                } while (choice1 == "Y");

                int    j = 0;
                double totalorderprice = 0.00;
                double totalquantity   = 0.0;

                foreach (RawMaterial item in selectedRawMaterials)
                {
                    totalorderprice += item.RawMaterialPrice * quantitylist[j];
                    totalquantity   += quantitylist[j];
                    j++;
                }
                Console.WriteLine("Total price of the order" + totalorderprice);
                Console.WriteLine("do you want to place the order? \n Enter 1 for yes 0 for no ");
                int  m = int.Parse(Console.ReadLine());
                Guid orderID;
                if (m == 1)
                {
                    SupplierBL      supplierBL = new SupplierBL();
                    List <Supplier> list1      = await supplierBL.GetAllSuppliersBL();


                    RawMaterialorder.RawMaterialTotalPrice = totalorderprice;

                    RawMaterialorder.SupplierID =


                        RawMaterialorder.RawMaterialTotalQuantity = totalquantity;
                    orderID = await RawMaterialorderBL.AddRawMaterialOrderBL(RawMaterialorder);

                    for (int i = 0; i < selectedRawMaterials.Count; i++)

                    {
                        RawMaterialOrderDetail RawMaterialorderdetail = new RawMaterialOrderDetail();
                        RawMaterialorderdetail.RawMaterialOrderID = orderID;
                        RawMaterial = await rawMaterialBL.GetRawMaterialByRawMaterialCodeBL(selectedRawMaterials[i].RawMaterialCode);

                        RawMaterialorderdetail.RawMaterialID         = RawMaterial.RawMaterialID;
                        RawMaterialorderdetail.RawMaterialQuantity   = quantitylist[i];
                        RawMaterialorderdetail.RawMaterialUnitPrice  = RawMaterial.RawMaterialPrice;
                        RawMaterialorderdetail.RawMaterialTotalPrice = quantitylist[i] * RawMaterial.RawMaterialPrice;

                        await RawMaterialorderDetailBL.AddRawMaterialOrderDetailBL(RawMaterialorderdetail);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }
Exemplo n.º 6
0
 public abstract bool UpdateRawMaterialOrderDetailDAL(RawMaterialOrderDetail updateorder);
Exemplo n.º 7
0
        //Methods for CRUD operations


        public abstract bool AddRawMaterialOrderDetailDAL(RawMaterialOrderDetail orderdetail);