Пример #1
0
        public void SaveDetail()
        {
            PaymentDetail pod = PDetails.Where(x => x.LedgerId == PDetail.LedgerId).FirstOrDefault();

            if (pod == null)
            {
                pod = new PaymentDetail();
                PDetails.Add(pod);
            }

            PDetail.toCopy <PaymentDetail>(pod);
            ClearDetail();
            Amount = PDetails.Sum(x => x.Amount);
        }
Пример #2
0
        public void SaveDetail()
        {
            if (PDetail.ProductId != 0)
            {
                PurchaseDetail pod = PDetails.Where(x => x.ProductId == PDetail.ProductId).FirstOrDefault();

                if (pod == null)
                {
                    pod = new PurchaseDetail();
                    PDetails.Add(pod);
                }
                else
                {
                    PDetail.Quantity += pod.Quantity;
                }
                PDetail.toCopy <PurchaseDetail>(pod);
                ClearDetail();
                ItemAmount = PDetails.Sum(x => x.Amount);
            }
        }
Пример #3
0
        private void opDetails()                            //Add Order Product Details
        {
            if (txtd1.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d1 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd1.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d1;
                pd.Kg    = txtq1.Text;
                pd.Price = txtp1.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd2.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d2 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd2.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d2;
                pd.Kg    = txtq2.Text;
                pd.Price = txtp2.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd3.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d3 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd3.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d3;
                pd.Kg    = txtq3.Text;
                pd.Price = txtp3.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd4.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d4 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd4.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d4;
                pd.Kg    = txtq4.Text;
                pd.Price = txtp4.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd5.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d5 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd5.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d5;
                pd.Kg    = txtq5.Text;
                pd.Price = txtp5.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd6.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d6 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd6.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d6;
                pd.Kg    = txtq6.Text;
                pd.Price = txtp6.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd7.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d7 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd7.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d7;
                pd.Kg    = txtq7.Text;
                pd.Price = txtp7.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
            if (txtd8.Text != "")
            {
                AllDataContext dc = new AllDataContext();
                PDetail        pd = new PDetail();
                pd.O_Id = Convert.ToInt32(lblOId.Text);
                int d8 = (from cu in dc.GetTable <FastFood>()
                          where cu.Name == txtd8.Text
                          select cu.Id).SingleOrDefault();
                pd.P_Id  = d8;
                pd.Kg    = txtq8.Text;
                pd.Price = txtp8.Text;

                dc.PDetails.InsertOnSubmit(pd);
                dc.SubmitChanges();
            }
        }