Esempio n. 1
0
        public HttpResponseMessage SavePO(PurchaseHeaderStructure headerStructure,
                                          PurchaseItemStructure itemStructure,
                                          PurchaseService purServ,
                                          TEVendorPaymentMilestone value,
                                          PurchaseItemwise purItemCond)

        {
            bool res = true;
            int  headerStructureID = 0, itemID = 0, serviceID = 0,
                 PaymntID = 0, ConditionID = 0;
            HttpResponseMessage hrm   = new HttpResponseMessage();
            SuccessInfo         sinfo = new SuccessInfo();
            FailInfo            finfo = new FailInfo();

            try
            {
                headerStructureID = SavePurchaseHeaderStructure(headerStructure);
                if (headerStructureID > 0)
                {
                    itemStructure.HeaderStructureID = headerStructureID;
                    purServ.HeaderStructureID       = headerStructureID;
                    value.ContextIdentifier         = value.ContextIdentifier;
                    purItemCond.HeaderStructureID   = headerStructureID;

                    //itemID = SavePurchaseItemStructure(itemStructure);
                    serviceID = SavePurchaseService(purServ);
                    PaymntID  = PostPOMilestones(value);
                    //ConditionID = SavePurchaseItemWiseCondition(purItemCond);
                }
            }
            catch (Exception ex)
            {
                res = false;
            }
            if (res)
            {
                sinfo.errorcode    = 0;
                sinfo.errormessage = "Successfully Saved";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
            else
            {
                finfo.errorcode    = 1;
                finfo.errormessage = "Failed To Save";
                return(new HttpResponseMessage()
                {
                    StatusCode = System.Net.HttpStatusCode.NotAcceptable, Content = new JsonContent(new { info = finfo })
                });
            }
        }
Esempio n. 2
0
        public override void Write()
        {
            Packet.Write(Result);

            Packet.PutBit(HasSuccessInfo);
            Packet.PutBit(HasWaitInfo);
            Packet.FlushBits();

            if (HasSuccessInfo)
            {
                SuccessInfo.Write(Packet);
            }

            if (HasWaitInfo)
            {
                WaitInfo.Write(Packet);
            }
        }
Esempio n. 3
0
        public HttpResponseMessage SavePO(PurchaseHeaderStructure headerStructure,
                                          List <PurchaseItemStructure> itemStructure,
                                          List <PurchaseService> purServ,
                                          List <TEVendorPaymentMilestone> paymntMilestone,
                                          List <PurchaseItemwise> purItemCond)

        {
            bool res = true;
            int  headerStructureID = 0, itemID = 0, serviceID = 0,
                 PaymntID = 0, ConditionID = 0;
            HttpResponseMessage hrm   = new HttpResponseMessage();
            SuccessInfo         sinfo = new SuccessInfo();
            FailInfo            finfo = new FailInfo();

            try
            {
                headerStructureID = SavePurchaseHeaderStructure(headerStructure);
                if (headerStructureID > 0)
                {
                    if (itemStructure.Count > 0)
                    {
                        foreach (PurchaseItemStructure item in itemStructure)
                        {
                            item.HeaderStructureID = headerStructureID;
                            // itemID = SavePurchaseItemStructure(item);
                        }
                    }
                    if (purServ.Count > 0)
                    {
                        foreach (PurchaseService purch in purServ)
                        {
                            purch.HeaderStructureID = headerStructureID;
                            serviceID = SavePurchaseService(purch);
                        }
                    }
                    if (paymntMilestone.Count > 0)
                    {
                        foreach (TEVendorPaymentMilestone mstn in paymntMilestone)
                        {
                            mstn.ContextIdentifier = headerStructureID.ToString();
                            PaymntID = PostPOMilestones(mstn);
                        }
                    }
                    if (purItemCond.Count > 0)
                    {
                        foreach (PurchaseItemwise purchItem in purItemCond)
                        {
                            purchItem.HeaderStructureID = headerStructureID;
                            //ConditionID = SavePurchaseItemWiseCondition(purchItem);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                res = false;
            }
            if (res)
            {
                sinfo.errorcode    = 0;
                sinfo.errormessage = "Successfully Saved";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
            else
            {
                finfo.errorcode    = 1;
                finfo.errormessage = "Failed To Save";
                return(new HttpResponseMessage()
                {
                    StatusCode = System.Net.HttpStatusCode.NotAcceptable, Content = new JsonContent(new { info = finfo })
                });
            }
        }