Exemple #1
0
        public IHttpActionResult GetSiteInfo(string usCode, Guid identifier, string projectId = "", string flowCode = "")
        {
            var storeSTLocation = StoreSTLocation.GetStoreSTLocation(usCode);
            var history         = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == identifier);

            if (history != null)
            {
                Mapper.CreateMap <StoreSTLocationHistory, StoreSTLocation>();
                storeSTLocation = Mapper.Map <StoreSTLocation>(history);
            }
            if (!string.IsNullOrEmpty(projectId) &&
                !string.IsNullOrEmpty(flowCode))
            {
                var wfEntity = BaseWFEntity.GetWorkflowEntity(projectId, BaseWFEntity.GetMainProjectFlowCode(flowCode));

                var designStyle = wfEntity.GetDesignStypleForSiteInfo();
                if (!string.IsNullOrEmpty(designStyle))
                {
                    storeSTLocation.DesignStyle = designStyle;
                }
            }
            storeSTLocation.ProjectIdentifier = identifier;

            return(Ok(storeSTLocation));
        }
        public IHttpActionResult Save(StoreSTLocation store)
        {
            using (var scope = new TransactionScope())
            {
                //store.Save();

                Mapper.CreateMap <StoreSTLocation, StoreSTLocationHistory>();
                var history = Mapper.Map <StoreSTLocationHistory>(store);
                var his     = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == store.ProjectIdentifier);
                if (his == null)
                {
                    history.Id    = Guid.NewGuid();
                    history.RefId = store.ProjectIdentifier;
                }
                else
                {
                    history.Id    = his.Id;
                    history.RefId = store.ProjectIdentifier;
                }
                history.Save();

                if (store.EstimatedVsActualConstruction != null)
                {
                    store.EstimatedVsActualConstruction.Save();
                }

                scope.Complete();
            }
            return(Ok());
        }
        public IHttpActionResult Submit(StoreSTLocation store)
        {
            using (var scope = new TransactionScope())
            {
                //store.Save();

                Mapper.CreateMap <StoreSTLocation, StoreSTLocationHistory>();
                var history = Mapper.Map <StoreSTLocationHistory>(store);
                var his     = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == store.ProjectIdentifier);
                var project = ProjectInfo.Get(store.ProjectIdentifier);
                if (his == null)
                {
                    history.Id    = Guid.NewGuid();
                    history.RefId = store.ProjectIdentifier;
                }
                else
                {
                    history.Id    = his.Id;
                    history.RefId = store.ProjectIdentifier;
                }
                history.Save();

                if (store.EstimatedVsActualConstruction != null)
                {
                    store.EstimatedVsActualConstruction.Save();
                }
                TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.TypeCode == FlowCode.Renewal_SiteInfo && t.RefID == project.ProjectId);
                ProjectInfo.FinishNode(project.ProjectId, FlowCode.Renewal_SiteInfo, NodeCode.Finish, ProjectStatus.Finished);
                ProjectInfo.CompleteMainIfEnable(project.ProjectId);
                if (ProjectInfo.IsFlowFinished(project.ProjectId, FlowCode.Renewal_ContractInfo))
                {
                    ProjectProgress.SetProgress(project.ProjectId, "100%");
                }
                scope.Complete();
            }
            return(Ok());
        }