Exemple #1
0
 public HttpResponseMessage SingleOrderAction(ActionDataModel data)
 {
     if (data != null)
     {
         purchaseOrderManager.SingleOrderStatus(data);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, "invalid request"));
 }
Exemple #2
0
        //public List<PurchaseOrderParentModel> GetPurchaseOrdersParent(int id)
        //{
        //    using (Conn)
        //    {
        //        string query = @"select cs.FRST_NME as FirstName,cs.PHNE as Phone,sum(c.AMNT) as Total, p.STATUS, p.SHPNG_ADRS from Shopping_Cart s
        //                        left join Cart_Item c on c.CART_ID = s.ID
        //                        left join Customer cs on s.CSTMR_ID = cs.ID
        //                        left join Purchase_Order p on p.CART_ITEM_ID = c.ID
        //                        where c.VNDR_ID = @VNDR_ID AND STATUS != @STATUS AND IsCanceled = 0 AND s.IsActive = 'True'
        //                        group by s.ID, s.CSTMR_ID,cs.FRST_NME,cs.PHNE,p.STATUS,p.SHPNG_ADRS";

        //        //return Conn.Query<Purchase_Order>(query).ToList();
        //        return Conn.Query<PurchaseOrderParentModel>(query, new { VNDR_ID = id, STATUS = "Rejected" }).ToList();
        //    }
        //}

        public void UpdateOrderStatus(ActionDataModel data)
        {
            string query = @"update Purchase_Order set STATUS = @STATUS
                            from Purchase_Order p
                            left join Cart_Item c on c.ID = p.ID
                            left join Shopping_Cart s on s.ID = c.CART_ID
                            where s.ID = @ID AND p.STATUS != 'Accepted' AND  p.STATUS != 'Rejected'";

            Conn.Execute(query, new { STATUS = data.action, ID = data.id });
        }
Exemple #3
0
        public ActionDataModel GetSingleWithResponsiblePerson(int actionID, int Userid, int OrganizationId)
        {
            ActionDataModel model = new ActionDataModel();
            var             data  = GetSingle(actionID, Userid, OrganizationId);

            model = Mapper.Map <Data.Action, ActionDataModel>(data);
            var data1        = this._ActionResponsiblePersonRepository.GetByActionId(actionID, Userid, OrganizationId);
            var commentsList = base.RepositoryContext.SP_GetActionComments(actionID, OrganizationId).ToList();

            model.ActionResponsiblePersonDataModel = Mapper.Map <List <ActionResponsiblePerson>, List <ActionResponsiblePersonDataModel> >(data1);
            model.ActionCommentsListModel          = Mapper.Map <List <SP_GetActionComments_Result>, List <ActionCommentsListModel> >(commentsList);
            return(model);
        }
Exemple #4
0
        public int UpdateActionData(ActionDataModel model, int Userid, int OrganizationId)
        {
            var data = Mapper.Map <ActionDataModel, Angular2_AspDotNet.Data.Action>(model);

            data.OrganizationID = OrganizationId;
            if (model.ActionID > 0)
            {
                base.Update(data);
                base.RepositoryContext.Sp_DeleteActionResponsiblePerson(model.ActionID);
            }
            else
            {
                base.Insert(data);
            }


            foreach (ActionResponsiblePersonDataModel resposibleModel in model.ActionResponsiblePersonDataModel)
            {
                var childData = Mapper.Map <ActionResponsiblePersonDataModel, ActionResponsiblePerson>(resposibleModel);
                childData.Action = data;
                _ActionResponsiblePersonRepository.Add(childData, Userid, OrganizationId);
            }
            if (!string.IsNullOrWhiteSpace(model.Comments))
            {
                this._actionCommentRepository.Add(new ActionComment()
                {
                    ActionId = model.ActionID,
                    Action   = data,
                    AddedBy  = 1,
                    Comment  = model.Comments,
                    AddedOn  = DateTime.Now
                }, Userid, OrganizationId);
            }
            _unitOfWork.Save();
            return(data.ActionID);
        }
        //public List<PurchaseOrderParentModel> GetPurchaseOrdersParent(int id)
        //{
        //    List<PurchaseOrderParentModel> orders = purchaseOrderDao.GetPurchaseOrdersParent(id);
        //    return orders;
        //}

        //public void AcceptOrder(int id) {
        //    purchaseOrderDao.UpdateOrderStatus(id,"Accepted");
        //}

        //public void RejectOrder(int id)
        //{
        //    purchaseOrderDao.UpdateOrderStatus(id,"Rejected");
        //}

        public void OrderStatus(ActionDataModel data)
        {
            purchaseOrderDao.UpdateOrderStatus(data);
        }
 public int UpdateAction([FromBody] ActionDataModel eventData)
 {
     return(this._ActionRepository.UpdateActionData(eventData, base.UserId, base.OrganizationId));
 }
Exemple #7
0
        public void UpdateSingleOrderStatus(ActionDataModel data)
        {
            string query = @"update Purchase_Order set STATUS = @STATUS where ID = @ID";

            Conn.Execute(query, new { STATUS = data.action, ID = data.id });
        }