public static GridRow BindGridData(IntegrationOrder source)
        {
            var row = new GridRow {
                IdentityValue = source.Id
            };

            row.AddCell(source.Name);
            row.AddCell(source.AllocatedIsolatorId.ToString());
            row.AddCell(source.BookedInDate == null ? "" : ((DateTime)source.BookedInDate).ToString("dd/MM/yyyy"));
            row.AddCell(((OrderProgressEnum)source.OrderLastProgressId).ToString());
            //row.AddCell(source.ExternalBarcode);
            //row.AddCell(source.ExternalOrderId);
            row.AddCell(source.RequiredDate == null ? "" : ((DateTime)source.RequiredDate).ToString("dd/MM/yyyy"));
            row.AddCell(source.ScheduledDate == null ? "" : ((DateTime)source.ScheduledDate).ToString("dd/MM/yyyy"));

            row.AddActionIcon("fa fa-edit text-success", "Click to view/edit");
            row.AddActionIcon("fa fa-info-circle text-success compareVersion", "Compare version");

            //if(!source.IntegrationOrderProgress.Name.Contains("Decline", StringComparison.OrdinalIgnoreCase))
            if (source.OrderLastProgressId == null)
            {
                row.AddActionIcon("fa fa-check text-success", "Click to authorize request");
                row.AddActionIcon("fa fa-times text-danger", "Click to decline request");
                row.AddActionIcon("fa fa-commenting-o text-default", "Click to call for supervisor");
                row.AddActionIcon("fa fa-object-group text-default", "Click to classify order");
            }
            return(row);
        }
Beispiel #2
0
        public static GridBoxRow BindOrderGridData(IntegrationOrder source)
        {
            var row = new GridBoxRow
            {
                IdentityValue = source.Id,
                BoxHeading    = source.Name
            };

            row.DataAttriDictionary.Add("reqtime", source.RequiredPreperationTimeInMins.ToString());

            row.BoxBodyDictionary.Add("Req. prepration time", source.RequiredPreperationTimeInMins + " mins");
            row.BoxBodyDictionary.Add("Req. date", source.RequiredDate.HasValue? source.RequiredDate.Value.ToString("dd/MM/yyyy") : "");
            row.BoxBodyDictionary.Add("Scheduled date", source.ScheduledDate.HasValue? source.ScheduledDate.Value.ToString("dd/MM/yyyy") : "");

            return(row);
        }
Beispiel #3
0
        public BaseResultViewModel <string> SaveUpdateIntegrationOrder(IntegrationOrderViewModel integrationOrderViewModel, string user)
        {
            var result = new BaseResultViewModel <string>
            {
                IsSuccess = false,
                Message   = "",
                Extra     = null
            };

            try
            {
                if (integrationOrderViewModel.Id > 0)
                {       //Edit
                    var integrationOrder = _repository.GetById <IntegrationOrder>(integrationOrderViewModel.Id);

                    integrationOrder.Name = integrationOrderViewModel.Name; //DateTime.Now.ToString("ddmmyyyy hh:mm:ss");
                    integrationOrder.IntegratedSystemId  = integrationOrderViewModel.IntegratedSystemId;
                    integrationOrder.AdministeredDate    = integrationOrderViewModel.AdministeredDate;
                    integrationOrder.AllocatedIsolatorId = integrationOrderViewModel.AlocatedIsolatorId;
                    integrationOrder.BookedInDate        = integrationOrderViewModel.BookedInDate;
                    integrationOrder.ExternalBarcode     = integrationOrderViewModel.ExternalBarcode;
                    integrationOrder.ExternalOrderId     = integrationOrderViewModel.ExternalOrderId;
                    integrationOrder.OrderLastProgressId = (int)OrderProgressEnum.Scheduled;
                    integrationOrder.RequiredDate        = integrationOrderViewModel.RequiredDate;
                    integrationOrder.ScheduledDate       = integrationOrderViewModel.ScheduledDate;

                    _repository.SaveExisting <IntegrationOrder>(integrationOrder, user);
                }
                else
                {
                    var integrationOrder = new IntegrationOrder
                    {
                        Name                = integrationOrderViewModel.Name,
                        IsArchived          = false,
                        IntegratedSystemId  = integrationOrderViewModel.IntegratedSystemId,
                        AdministeredDate    = integrationOrderViewModel.AdministeredDate,
                        AllocatedIsolatorId = integrationOrderViewModel.AlocatedIsolatorId,
                        BookedInDate        = integrationOrderViewModel.BookedInDate,
                        ExternalBarcode     = integrationOrderViewModel.ExternalBarcode,
                        ExternalOrderId     = integrationOrderViewModel.ExternalOrderId,
                        OrderLastProgressId = (int)OrderProgressEnum.Scheduled,
                        RequiredDate        = integrationOrderViewModel.RequiredDate,
                        ScheduledDate       = integrationOrderViewModel.ScheduledDate
                    };
                    //Mapper.Map<IntegrationOrderViewModel, IntegrationOrder>(integrationOrderViewModel);
                    integrationOrder.SetCreateDetails(user);
                    if (integrationOrder.Id == 0)
                    {
                        //integrationOrder.OrderLastProgressId = (int) OrderStatusEnum.New;
                        var saveNew = _repository.SaveNew(integrationOrder, user);
                        result.IsSuccess = true;
                        result.Message   = "Success: Create new Integration Order";
                        return(result);
                    }

                    //integrationOrder.OrderLastProgressId = (int)OrderStatusEnum.Pending;
                    _repository.SaveExisting <IntegrationOrder>(integrationOrder, user);
                    result.IsSuccess = true;
                    result.Message   = "Success: Update Integration Order.";
                }
                return(result);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }