예제 #1
0
        public static void GeneratePackageTask(string projectId)
        {
            var taskWork = new TaskWork();

            taskWork.SourceCode        = FlowCode.TempClosure;
            taskWork.SourceNameENUS    = taskWork.SourceCode;
            taskWork.SourceNameZHCN    = taskWork.SourceCode;
            taskWork.Status            = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN    = "任务";
            taskWork.StatusNameENUS    = "任务";
            taskWork.RefID             = projectId;
            taskWork.Id                = Guid.NewGuid();
            taskWork.CreateTime        = DateTime.Now;
            taskWork.CreateUserAccount = ClientCookie.UserCode;

            var tempClosure = TempClosureInfo.FirstOrDefault(i => i.ProjectId == projectId);

            if (tempClosure == null)
            {
                return;
            }

            taskWork.Title            = TaskWork.BuildTitle(projectId, tempClosure.StoreNameENUS, tempClosure.StoreNameZHCN);
            taskWork.TypeCode         = FlowCode.TempClosure_ClosurePackage;
            taskWork.TypeNameENUS     = "Closure Package";
            taskWork.TypeNameZHCN     = "Closure Package";
            taskWork.ReceiverAccount  = tempClosure.AssetActorAccount;
            taskWork.ReceiverNameENUS = tempClosure.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = tempClosure.AssetActorNameZHCN;
            taskWork.Url          = string.Format(@"/TempClosure/Main#/ClosurePackage?projectId={0}", projectId);
            taskWork.StoreCode    = tempClosure.USCode;
            taskWork.ActivityName = "Start";

            TaskWork.Add(taskWork);
        }
예제 #2
0
        public void Confirm()
        {
            var tempClosureInfo = TempClosureInfo.Get(this.ProjectId);
            var url             = "/TempClosure/Main#/ClosureMemo?projectId=" + this.ProjectId;
            var title           = TaskWork.BuildTitle(this.ProjectId, tempClosureInfo.StoreNameZHCN, tempClosureInfo.StoreNameENUS);

            TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.RefID == this.ProjectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == FlowCode.TempClosure_ClosurePackage);
            ProjectInfo.FinishNode(ProjectId, FlowCode.TempClosure_ClosurePackage, NodeCode.TempClosure_ClosurePackage_Upload, ProjectStatus.Finished);
        }
예제 #3
0
        public void UpdateType(string projectId, Dictionary type)
        {
            var entity = TempClosureInfo.FirstOrDefault(p => p.ProjectId == projectId);

            using (TransactionScope tranScope = new TransactionScope())
            {
                entity.Type         = type.Code;
                entity.TypeNameENUS = type.NameENUS;
                entity.TypeNameZHCN = type.NameZHCN;
                TempClosureInfo.Update(entity);
                tranScope.Complete();
            }
        }
예제 #4
0
        public void GenerateReopenTask(string projectId)
        {
            var taskWork = new TaskWork();

            taskWork.SourceCode        = FlowCode.TempClosure;
            taskWork.SourceNameENUS    = taskWork.SourceCode;
            taskWork.SourceNameZHCN    = taskWork.SourceCode;
            taskWork.Status            = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN    = "任务";
            taskWork.StatusNameENUS    = "任务";
            taskWork.RefID             = projectId;
            taskWork.Id                = Guid.NewGuid();
            taskWork.CreateTime        = DateTime.Now;
            taskWork.CreateUserAccount = ClientCookie.UserCode;

            var tempClosure = TempClosureInfo.FirstOrDefault(i => i.ProjectId == projectId);

            if (tempClosure == null)
            {
                return;
            }

            taskWork.Title            = TaskWork.BuildTitle(projectId, tempClosure.StoreNameZHCN, tempClosure.StoreNameENUS);
            taskWork.TypeCode         = FlowCode.TempClosure_ReopenMemo;
            taskWork.TypeNameENUS     = "ReopenMemo";
            taskWork.TypeNameZHCN     = "ReopenMemo";
            taskWork.ReceiverAccount  = tempClosure.AssetActorAccount;
            taskWork.ReceiverNameENUS = tempClosure.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = tempClosure.AssetActorNameZHCN;
            taskWork.Url          = string.Format(@"/TempClosure/Main#/ReopenMemo?projectId={0}", projectId);
            taskWork.StoreCode    = tempClosure.USCode;
            taskWork.ActivityName = "Start";

            //Re-open Date 前7天发出任务
            ScheduleLog.GenerateTaskSchedule(tempClosure.ActualReopenDate.AddDays(-7), taskWork, ClientCookie.UserCode, projectId, FlowCode.TempClosure_ReopenMemo, tempClosure.USCode);
        }
예제 #5
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project            = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic         = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);
            var storeContract      = StoreContractInfo.Get(storeBasic.StoreCode);
            var assetMgr           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor         = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var tempClosurePackage = TempClosurePackage.Get(ProjectId);
            var tempClosure        = TempClosureInfo.Get(ProjectId);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language));
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            var storeInfo = StoreBasicInfo.GetStore(project.USCode);

            if (storeInfo.StoreContractInfo != null)
            {
                templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear);
            }
            else
            {
                templateFileds.Add("CurrentLeaseENDYear", "");
            }

            if (assetMgr != null)
            {
                templateFileds.Add("AssetsManager", assetMgr.UserNameENUS);
            }
            else
            {
                templateFileds.Add("AssetsManager", "");
            }

            templateFileds.Add("AssetsActor", assetActor.UserNameENUS);
            templateFileds.Add("AssetsRep", assetRep.UserNameENUS);
            templateFileds.Add("Address", storeBasic.AddressZHCN);
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");
            templateFileds.Add("ClosureDate", tempClosure.ActualTempClosureDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("LeaseExpireDate", tempClosure.LeaseExpireDate.HasValue ? tempClosure.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("ReOpenDate", tempClosure.ActualReopenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(tempClosurePackage.RentReliefClause) ? "否" : "是");
            templateFileds.Add("RentFreeStartDate", tempClosurePackage.RentReliefStartDate.HasValue ? tempClosurePackage.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("RentFreeEndDate", tempClosurePackage.RentReliefEndDate.HasValue ? tempClosurePackage.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("FreeRentTerm", tempClosurePackage.RentReliefClause);
            templateFileds.Add("LandlordName", tempClosure.LandlordName);
            if (tempClosurePackage.RentRelief.HasValue)
            {
                templateFileds.Add("ReliefRent", tempClosurePackage.RentRelief.Value ? "是" : "否");
            }
            else
            {
                templateFileds.Add("ReliefRent", "");
            }

            return(templateFileds);
        }