Exemple #1
0
        public IHttpActionResult SendReopenMemo(PostMemo <ReopenMemo> postData)
        {
            var actor = ProjectUsers.GetProjectUser(postData.Entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (TransactionScope tranScope = new TransactionScope())
            {
                Dictionary <string, string> pdfData = new Dictionary <string, string>();
                if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    pdfData.Add("WorkflowName", "Rebuild");
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") != -1)
                {
                    pdfData.Add("WorkflowName", "MajorLease");
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("renewal") != -1)
                {
                    pdfData.Add("WorkflowName", "Renewal");
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                {
                    pdfData.Add("WorkflowName", "Reimage");
                }
                else
                {
                    pdfData.Add("WorkflowName", postData.Entity.ProjectId);
                }
                pdfData.Add("ProjectID", postData.Entity.ProjectId);
                pdfData.Add("RegionNameENUS", postData.Entity.Store.StoreBasicInfo.RegionENUS);
                pdfData.Add("RegionNameZHCN", postData.Entity.Store.StoreBasicInfo.RegionZHCN);
                pdfData.Add("MarketNameENUS", postData.Entity.Store.StoreBasicInfo.MarketENUS);
                pdfData.Add("MarketNameZHCN", postData.Entity.Store.StoreBasicInfo.MarketZHCN);
                pdfData.Add("ProvinceNameENUS", postData.Entity.Store.StoreBasicInfo.ProvinceENUS);
                pdfData.Add("ProvinceNameZHCN", postData.Entity.Store.StoreBasicInfo.ProvinceZHCN);
                pdfData.Add("CityNameENUS", postData.Entity.Store.StoreBasicInfo.CityENUS);
                pdfData.Add("CityNameZHCN", postData.Entity.Store.StoreBasicInfo.CityZHCN);
                pdfData.Add("StoreNameENUS", postData.Entity.Store.StoreBasicInfo.NameENUS);
                pdfData.Add("StoreNameZHCN", postData.Entity.Store.StoreBasicInfo.NameZHCN);
                pdfData.Add("USCode", postData.Entity.Store.StoreBasicInfo.StoreCode);

                pdfData.Add("IsMcCafe", postData.Entity.NewMcCafe ? "Y" : "N");
                pdfData.Add("IsKiosk", postData.Entity.NewKiosk ? "Y" : "N");
                pdfData.Add("IsMDS", postData.Entity.NewMDS ? "Y" : "N");
                pdfData.Add("Is24Hour", postData.Entity.Is24H ? "Y" : "N");

                pdfData.Add("TTMNetSales", DataConverter.ToMoney(postData.Entity.TTMNetSales) ?? "&nbsp;");
                var TTMNetSalesYearMonth = "";
                if (postData.Entity.YearMonthList != null && postData.Entity.YearMonthList.Count > 0)
                {
                    foreach (var val in postData.Entity.YearMonthList)
                    {
                        if (val.Value == postData.Entity.TTMNetSales)
                        {
                            TTMNetSalesYearMonth = val.Name;
                            break;
                        }
                    }
                }
                pdfData.Add("TTMNetSalesYearMonth", TTMNetSalesYearMonth ?? "&nbsp;");
                pdfData.Add("IncrementalSales", postData.Entity.IncrementalSales.HasValue ? DataConverter.ToMoney((postData.Entity.IncrementalSales.Value * 100)) : "&nbsp;");

                pdfData.Add("GBDate", postData.Entity.GBDate.HasValue ? postData.Entity.GBDate.Value.ToString("yyyy-MM-dd") : "&nbsp;");
                pdfData.Add("ConstCompletionDate", postData.Entity.CompletionDate.HasValue ? postData.Entity.CompletionDate.Value.ToString("yyyy-MM-dd") : "&nbsp;");

                //if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                //{
                //    pdfData.Add("ReopenDate", postData.Entity.RmgInfo.ReopenDate.HasValue ? postData.Entity.RmgInfo.ReopenDate.Value.ToString("yyyy-MM-dd") : "&nbsp;");
                //}
                //else
                //{
                //    pdfData.Add("ReopenDate", postData.Entity.ReopenDate.HasValue ? postData.Entity.RbdInfo.ReopenDate.Value.ToString("yyyy-MM-dd") : "&nbsp;");
                //}
                pdfData.Add("ReopenDate", postData.Entity.ReopenDate.HasValue ? postData.Entity.ReopenDate.Value.ToString("yyyy-MM-dd") : "&nbsp;");
                pdfData.Add("DesignConcept", GetConcetpetDesc(postData.Entity.DesignConcept) ?? "&nbsp;");
                pdfData.Add("TotalWriteOff", DataConverter.ToMoney(postData.Entity.WriteOff.TotalWriteOff) ?? "&nbsp;");
                pdfData.Add("TotalReinvestmentBudget", DataConverter.ToMoney(postData.Entity.TotalReinvestmentBudget) ?? "&nbsp;");
                pdfData.Add("OriginalOperationSize", postData.Entity.OriginalOperationSize ?? "&nbsp;");
                pdfData.Add("NewOperationSize", postData.Entity.AftOperationSize ?? "&nbsp;");
                pdfData.Add("OriginalSeatNumber", postData.Entity.OriginalSeatNumber ?? "&nbsp;");
                pdfData.Add("ARSN", postData.Entity.AftARSN ?? "&nbsp;");
                pdfData.Add("AftARPT", postData.Entity.AftARPT ?? "&nbsp;");
                pdfData.Add("PriceTiter", postData.Entity.PriceTiter ?? "&nbsp;");
                if (postData.Entity.ExteriorAfterImgURL1 != "../Images/mcd_logo.png")
                {
                    pdfData.Add("ExteriorAfterImgURL1", HtmlConversionUtility.ImageToBase64(postData.Entity.ExteriorAfterImgURL1, System.Drawing.Imaging.ImageFormat.Png));
                }
                else
                {
                    pdfData.Add("ExteriorAfterImgURL1", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAzCAMAAADrVgtcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPS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7F8eIys5Nmfx67qAF7WNi8p+Ny4i8U5kfc3zQzhdgOCybTXF36hvJk+9Pvc+YX5KxYuB3x2MZGePGPJ6fvGJb8y1GCSOlWQW3dsP6rGrO3t44qHFV2kexq1b/9Gby8adHZcTl3onb1Hxr+zjG6nMaLHxLbMjex1RpkRUjd/bZmTayMZ+Rrekz5PTW9gURkbdUUZEVKWNGgd0wbNfE07vgF+FTmia4rR45O0qlOX0KrG9qAifCGFwPTjyLYd2x1pdAGwySlwbEEERjAzVOECTuD8IgpkFC2BEn1l04wx47Q9jC7tkDw7nwf2Vp/4lhR2l1hx9e2Y7SBp5zOp2H/304nbZdle/R/vz01wMHRj9ELBu97OP3/xFgAEAgj7rRci3dAAAAAElFTkSuQmCC");
                }
                if (postData.Entity.ExteriorAfterImgURL2 != "../Images/mcd_logo.png")
                {
                    pdfData.Add("ExteriorAfterImgURL2", HtmlConversionUtility.ImageToBase64(postData.Entity.ExteriorAfterImgURL2, System.Drawing.Imaging.ImageFormat.Png));
                }
                else
                {
                    pdfData.Add("ExteriorAfterImgURL2", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAzCAMAAADrVgtcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIge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XVlNtWQr+62b4+7F8eIys5Nmfx67qAF7WNi8p+Ny4i8U5kfc3zQzhdgOCybTXF36hvJk+9Pvc+YX5KxYuB3x2MZGePGPJ6fvGJb8y1GCSOlWQW3dsP6rGrO3t44qHFV2kexq1b/9Gby8adHZcTl3onb1Hxr+zjG6nMaLHxLbMjex1RpkRUjd/bZmTayMZ+Rrekz5PTW9gURkbdUUZEVKWNGgd0wbNfE07vgF+FTmia4rR45O0qlOX0KrG9qAifCGFwPTjyLYd2x1pdAGwySlwbEEERjAzVOECTuD8IgpkFC2BEn1l04wx47Q9jC7tkDw7nwf2Vp/4lhR2l1hx9e2Y7SBp5zOp2H/304nbZdle/R/vz01wMHRj9ELBu97OP3/xFgAEAgj7rRci3dAAAAAElFTkSuQmCC");
                }
                if (postData.Entity.InteriorAfterImgURL1 != "../Images/mcd_logo.png")
                {
                    pdfData.Add("InteriorAfterImgURL1", HtmlConversionUtility.ImageToBase64(postData.Entity.InteriorAfterImgURL1, System.Drawing.Imaging.ImageFormat.Png));
                }
                else
                {
                    pdfData.Add("InteriorAfterImgURL1", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAzCAMAAADrVgtcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvd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pik1p/ysKsXVlNtWQr+62b4+7F8eIys5Nmfx67qAF7WNi8p+Ny4i8U5kfc3zQzhdgOCybTXF36hvJk+9Pvc+YX5KxYuB3x2MZGePGPJ6fvGJb8y1GCSOlWQW3dsP6rGrO3t44qHFV2kexq1b/9Gby8adHZcTl3onb1Hxr+zjG6nMaLHxLbMjex1RpkRUjd/bZmTayMZ+Rrekz5PTW9gURkbdUUZEVKWNGgd0wbNfE07vgF+FTmia4rR45O0qlOX0KrG9qAifCGFwPTjyLYd2x1pdAGwySlwbEEERjAzVOECTuD8IgpkFC2BEn1l04wx47Q9jC7tkDw7nwf2Vp/4lhR2l1hx9e2Y7SBp5zOp2H/304nbZdle/R/vz01wMHRj9ELBu97OP3/xFgAEAgj7rRci3dAAAAAElFTkSuQmCC");
                }
                if (postData.Entity.InteriorAfterImgURL2 != "../Images/mcd_logo.png")
                {
                    pdfData.Add("InteriorAfterImgURL2", HtmlConversionUtility.ImageToBase64(postData.Entity.InteriorAfterImgURL2, System.Drawing.Imaging.ImageFormat.Png));
                }
                else
                {
                    pdfData.Add("InteriorAfterImgURL2", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAzCAMAAADrVgtcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiBy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/OR+Xn3owpik1p/ysKsXVlNtWQr+62b4+7F8eIys5Nmfx67qAF7WNi8p+Ny4i8U5kfc3zQzhdgOCybTXF36hvJk+9Pvc+YX5KxYuB3x2MZGePGPJ6fvGJb8y1GCSOlWQW3dsP6rGrO3t44qHFV2kexq1b/9Gby8adHZcTl3onb1Hxr+zjG6nMaLHxLbMjex1RpkRUjd/bZmTayMZ+Rrekz5PTW9gURkbdUUZEVKWNGgd0wbNfE07vgF+FTmia4rR45O0qlOX0KrG9qAifCGFwPTjyLYd2x1pdAGwySlwbEEERjAzVOECTuD8IgpkFC2BEn1l04wx47Q9jC7tkDw7nwf2Vp/4lhR2l1hx9e2Y7SBp5zOp2H/304nbZdle/R/vz01wMHRj9ELBu97OP3/xFgAEAgj7rRci3dAAAAAElFTkSuQmCC");
                }
                string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.ReopenMemo, pdfData, null);
                EmailSendingResultType result;
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", postData.Entity.Store.StoreBasicInfo.StoreCode);
                bodyValues.Add("StoreName", postData.Entity.Store.StoreBasicInfo.NameENUS);
                bodyValues.Add("Actor", actor.RoleNameENUS);////--呈递人
                if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    bodyValues.Add("WorkflowName", Constants.Rebuild_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.Rebuild);             //项目名称
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                {
                    bodyValues.Add("WorkflowName", Constants.Reimage_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.Reimage);             //项目名称
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("tempclosure") >= 0)
                {
                    bodyValues.Add("WorkflowName", Constants.TempClosure_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.TempClosure);             //项目名称
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") >= 0)
                {
                    bodyValues.Add("WorkflowName", Constants.MajorLease_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.MajorLease);             //项目名称
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("renewal") >= 0)
                {
                    bodyValues.Add("WorkflowName", Constants.Renewal_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.Renewal);             //项目名称
                }
                else
                {
                    bodyValues.Add("WorkflowName", Constants.TempClosure_ReopenMemo); ////--流程名称
                    bodyValues.Add("ProjectName", Constants.TempClosure);             //项目名称
                }

                string viewPage = "";
                if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    viewPage = string.Format("{0}/Rebuild/Main#/ReopenMemo/Process/View?projectId={1}",
                                             ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
                }
                if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                {
                    viewPage = string.Format("{0}/Reimage/Main#/ReopenMemo/Process/View?projectId={1}",
                                             ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
                }
                bodyValues.Add("FormUrl", viewPage);

                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    foreach (Employee emp in postData.Receivers)
                    {
                        if (sbTo.Length > 0)
                        {
                            sbTo.Append(";");
                        }
                        if (!string.IsNullOrEmpty(emp.Mail))
                        {
                            sbTo.Append(emp.Mail);
                        }
                    }
                    if (sbTo.Length > 0)
                    {
                        sbTo.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    string strTitle = "";
                    if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                    {
                        strTitle = "Rebuild_ReopenMemo";
                    }
                    if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                    {
                        strTitle = "Reimage_ReopenMemo";
                    }
                    if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") >= 0)
                    {
                        strTitle = "MajorLease_ReopenMemo";
                    }
                    if (postData.Entity.ProjectId.ToLower().IndexOf("renewal") >= 0)
                    {
                        strTitle = "Renewal_ReopenMemo";
                    }
                    if (postData.Entity.ProjectId.ToLower().IndexOf("tempclosure") >= 0)
                    {
                        strTitle = "TempClosure_ReopenMemo";
                    }
                    attachments.Add(pdfPath, strTitle + "_" + postData.Entity.ProjectId + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendNotificationEmail(message);
                }

                if (!result.Successful)
                {
                    return(BadRequest(result.ErrorMessage + " " + pdfPath));
                }
                ReopenMemo.Submit(postData.Entity);
                tranScope.Complete();
            }
            return(Ok());
        }
        private string GenPrintReimageAttachment(ReimageInfo reimageInfo, ReimagePackage entity, PrintFileType fileType)
        {
            var            storeInfo = StoreBasicInfo.GetStore(reimageInfo.USCode);
            StoreBasicInfo store     = storeInfo.StoreBasicInfo;

            //生成Print文件
            var printDic = new Dictionary <string, string>();

            printDic.Add("WorkflowName", FlowCode.Reimage);
            printDic.Add("ProjectID", entity.ProjectId);
            printDic.Add("USCode", reimageInfo.USCode);
            printDic.Add("Region", store.RegionENUS);
            printDic.Add("Market", store.MarketENUS);
            printDic.Add("City", store.CityENUS);
            printDic.Add("AddressZHCN", store.AddressZHCN);
            printDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd"));
            if (store.CloseDate.HasValue && store.CloseDate.Value.Year == 1900)
            {
                printDic.Add("ClosureDate", string.Empty);
            }
            else
            {
                printDic.Add("ClosureDate", store.CloseDate.HasValue ? (store.CloseDate.Value.ToString("yyyy-MM-dd")) : "");
            }
            printDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName);
            printDic.Add("AssetsRep", storeInfo.StoreDevelop.AssetRepName);
            printDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString());
            var currentLeaseENDYear = storeInfo.CurrentYear - int.Parse(storeInfo.StoreContractInfo.EndYear);

            printDic.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString());
            printDic.Add("StoreNameEN", store.NameENUS);
            printDic.Add("StoreNameCN", store.NameENUS);
            var RmgSummaryentity     = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(entity.ProjectId) && e.IsHistory == false);
            var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(RmgSummaryentity.Id));

            printDic.Add("SalesBuildingInvestment", financialPreanalysis.SalesBuildingInvestment);
            printDic.Add("NoneSalesBuildingInvst", financialPreanalysis.NoneSalesBuildingInvst);
            printDic.Add("TTMSales", financialPreanalysis.TTMSales.HasValue ? Math.Round(financialPreanalysis.TTMSales.Value, 2).ToString() : string.Empty);
            var reimage = ReimageConsInfo.GetConsInfo(entity.ProjectId, "");
            ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id);

            printDic.Add("TotalReinvestmentNorm", reinCost.TotalReinvestmentNorm);
            printDic.Add("TotalSalesInc", financialPreanalysis.TotalSalesInc);
            printDic.Add("ROI", financialPreanalysis.ROI);
            ////printDic.Add("SalesInc", financialPreanalysis.ROI);
            printDic.Add("PaybackYears", financialPreanalysis.PaybackYears);
            printDic.Add("StoreCM", financialPreanalysis.StoreCM);
            printDic.Add("EstimatedWriteOffCost", financialPreanalysis.EstimatedWriteOffCost);
            printDic.Add("MarginInc", financialPreanalysis.MarginInc);
            printDic.Add("ISDWIP", financialPreanalysis.ISDWIP);
            printDic.Add("CurrStorePricingTier", financialPreanalysis.CurrentPriceTier);
            printDic.Add("SPTAR", financialPreanalysis.SPTAR);

            //Submission and Approval Records - 只显示通过意见
            List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>();
            //Submission and Approval Records Details — 所有意见
            List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>();

            ProjectComment          projectCommentBll = new ProjectComment();
            ProjectCommentCondition condition         = new ProjectCommentCondition();
            var package = ReimagePackage.Get(entity.ProjectId);

            condition.RefTableName = ReimagePackage.TableName;
            condition.RefTableId   = entity.Id;
            condition.SourceCode   = FlowCode.Reimage;

            var commentList       = VProjectComment.SearchVListForPDF(condition);
            var commentDetailList = VProjectComment.SearchVList(condition);

            SubmissionApprovalRecord record = null;

            foreach (var item in commentList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordList.Add(record);
            }
            foreach (var item in commentDetailList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordDetailList.Add(record);
            }



            string result = string.Empty;

            if (fileType == PrintFileType.Pdf)
            {
                result = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList);
            }
            else
            {
                result = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList);
            }
            return(result);
        }
Exemple #3
0
        public static List <EmailSendingResultType> SendPackageApprovalEmail(RenewalInfo info, RenewalPackage entity, ApproveUsers approvers)
        {
            var project       = ProjectInfo.Get(entity.ProjectId, FlowCode.Renewal_Package);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var assetMgr      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor    = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var results       = new List <EmailSendingResultType>();

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                List <SimpleEmployee> approveEmps = new List <SimpleEmployee> {
                    approvers.MarketMgr,
                    approvers.GM,
                    approvers.MDD,
                    approvers.FC,
                    approvers.MCCLAssetDtr
                };
                if (approvers.RegionalMgr != null)
                {
                    approveEmps.Add(approvers.RegionalMgr);
                }
                if (approvers.CDO != null)
                {
                    approveEmps.Add(approvers.CDO);
                }
                if (approvers.ManagingDirector != null)
                {
                    approveEmps.Add(approvers.ManagingDirector);
                }
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("Actor", assetActor.UserNameENUS);     ////--呈递人
                //bodyValues.Add("WorkflowName", Constants.TempClosure_Package);////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure); //项目名称
                var viewPage = string.Format("{0}/Renewal/Main#/Package/View/param?projectId={1}",
                                             HttpContext.Current.Request.Url.Authority, entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);
                Dictionary <string, string> templateFileds = entity.GetPrintTemplateFields();
                var approveRecords = ProjectComment.GetList("TempClosurePackage", entity.Id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord
                {
                    OperatorID    = pc.UserAccount,
                    OperatorName  = pc.UserNameENUS,
                    OperatorTitle = pc.TitleNameENUS,
                    OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now,
                    ActionName    = pc.ActivityName,
                    Comments      = pc.Content
                }).ToList();
                string imgPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Renewal, templateFileds, approveRecords);
                approveEmps.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);//--提交人
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result =  emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
                approvers.NoticeUsers.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))//--提交人
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result = emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
            }
            return(results);
        }
Exemple #4
0
        public IHttpActionResult Send(PostClosureMemoModel model)
        {
            var actor = ProjectUsers.GetProjectUser(model.Entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (TransactionScope tranScope = new TransactionScope())
            {
                Save(model.Entity);
                ClosureTool closureTool        = ClosureTool.FirstOrDefault(ct => ct.ProjectId == model.Entity.ProjectId);
                string      compensationAwards = "";
                string      compensation       = "暂无数据";
                if (closureTool != null && closureTool.Compensation.HasValue)
                {
                    compensationAwards = closureTool.Compensation.Value > 0 ? "Yes" : "No";
                    compensation       = closureTool.Compensation.Value.ToString("N");
                }
                Dictionary <string, string> pdfData = new Dictionary <string, string>();
                pdfData.Add("WorkflowName", "Closure");
                pdfData.Add("ProjectID", model.Entity.ProjectId);
                pdfData.Add("RegionNameENUS", model.Entity.RegionNameENUS);
                pdfData.Add("RegionNameZHCN", model.Entity.RegionNameZHCN);
                pdfData.Add("MarketNameENUS", model.Entity.MarketNameENUS);
                pdfData.Add("MarketNameZHCN", model.Entity.MarketNameZHCN);
                pdfData.Add("ProvinceNameENUS", model.Entity.ProvinceNameENUS);
                pdfData.Add("ProvinceNameZHCN", model.Entity.ProvinceNameZHCN);
                pdfData.Add("CityNameENUS", model.Entity.CityNameENUS);
                pdfData.Add("CityNameZHCN", model.Entity.CityNameZHCN);
                pdfData.Add("StoreNameENUS", model.Entity.StoreNameENUS);
                pdfData.Add("StoreNameZHCN", model.Entity.StoreNameZHCN);
                pdfData.Add("StoreAddressENUS", model.Entity.StoreAddressENUS);
                pdfData.Add("StoreAddressZHCN", model.Entity.StoreAddressZHCN);
                pdfData.Add("USCode", model.Entity.USCode);
                pdfData.Add("OpenDate", model.Entity.OpenDate.Value.ToString("yyyy-MM-dd"));
                pdfData.Add("ClosureDate", model.Entity.ClosureDate.Value.ToString("yyyy-MM-dd"));
                pdfData.Add("ClosureNature", model.Entity.ClosureNature.ToString());
                if (model.Entity.BecauseOfReimaging.HasValue)
                {
                    pdfData.Add("BecauseOfReimaging", model.Entity.BecauseOfReimaging.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfReimaging", "");
                }

                if (model.Entity.BecauseOfRemodel.HasValue)
                {
                    pdfData.Add("BecauseOfRemodel", model.Entity.BecauseOfRemodel.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfRemodel", "");
                }

                if (model.Entity.BecauseOfDespute.HasValue)
                {
                    pdfData.Add("BecauseOfDespute", model.Entity.BecauseOfDespute.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfDespute", "");
                }

                if (model.Entity.BecauseOfRedevelopment.HasValue)
                {
                    pdfData.Add("BecauseOfRedevelopment", model.Entity.BecauseOfRedevelopment.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfRedevelopment", "");
                }

                if (model.Entity.BecauseOfPlanedClosure.HasValue)
                {
                    pdfData.Add("BecauseOfPlanedClosure", model.Entity.BecauseOfPlanedClosure.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfPlanedClosure", "");
                }

                if (model.Entity.BecauseOfRebuild.HasValue)
                {
                    pdfData.Add("BecauseOfRebuild", model.Entity.BecauseOfRebuild.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("BecauseOfRebuild", "");
                }

                pdfData.Add("BecauseOfOthers", model.Entity.BecauseOfOthers);

                if (model.Entity.PermanentCloseOpportunity.HasValue)
                {
                    pdfData.Add("PermanentCloseOpportunity", model.Entity.PermanentCloseOpportunity.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("PermanentCloseOpportunity", "");
                }

                if (model.Entity.HasRelocationPlan.HasValue)
                {
                    pdfData.Add("HasRelocationPlan", model.Entity.HasRelocationPlan.Value ? "Yes" : "No");
                }
                else
                {
                    pdfData.Add("HasRelocationPlan", "");
                }

                pdfData.Add("PipelineName", model.Entity.PipelineName);
                pdfData.Add("CompensationAwarded", compensationAwards);
                pdfData.Add("Compensation", compensation);
                string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.ClosureMemo, pdfData, null);
                EmailSendingResultType result;
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                //bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", model.Entity.USCode);
                bodyValues.Add("StoreName", model.Entity.StoreNameENUS);
                bodyValues.Add("Actor", actor.RoleNameENUS);            ////--呈递人
                bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Closure);       //项目名称
                var webRootUrl = ConfigurationManager.AppSettings["webHost"];
                var viewPage   = string.Format("{0}Closure/Main#/ClosureMemo/ClosureMemoView?projectId={1}",
                                               webRootUrl, model.Entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);

                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    foreach (Employee emp in model.Receivers)
                    {
                        if (sbTo.Length > 0)
                        {
                            sbTo.Append(";");
                        }
                        if (!string.IsNullOrEmpty(emp.Mail))
                        {
                            sbTo.Append(emp.Mail);
                        }
                    }
                    if (sbTo.Length > 0)
                    {
                        sbTo.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    attachments.Add(pdfPath, model.Entity.USCode + " " + FlowCode.Closure_Memo + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendNotificationEmail(message);
                }

                if (!result.Successful)
                {
                    return(BadRequest(result.ErrorMessage + " " + pdfPath));
                }

                //store关闭不在这里设置,需要判断project状态和closuredata
                //var store = StoreBasicInfo.GetStorInfo(model.Entity.USCode);
                //store.StoreStatus = "suoya301003";
                //store.statusName = "Closed";
                //store.Update();


                if (model.Entity.ClosureNature == ClosureNatureType.Permanent)
                {
                    //选项为永久关闭并且发送成功后关闭任务
                    McdAMEntities _db  = new McdAMEntities();
                    var           task = _db.TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.Status == 0 && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_Memo && e.RefID == model.Entity.ProjectId);
                    if (task != null)
                    {
                        task.Status     = TaskWorkStatus.K2ProcessApproved;
                        task.FinishTime = DateTime.Now;
                        task.Url        = SiteInfo.GetProjectViewPageUrl(FlowCode.Closure_Memo, task.RefID);

                        //var enableExecutiveSummary = handler.EnableExecutiveSummary(entity.ProjectId.Value);

                        _db.TaskWork.Attach(task);
                        _db.Entry(task).State = EntityState.Modified;
                        _db.SaveChanges();

                        ProjectInfo.FinishNode(model.Entity.ProjectId, FlowCode.Closure_Memo, NodeCode.Closure_ClosureMemo_Input);
                        ProjectInfo.FinishNode(model.Entity.ProjectId, FlowCode.Closure_Memo, NodeCode.Closure_ClosureMemo_SendMemo, ProjectStatus.Finished);

                        #region Memo完成后,设定计划任务
                        var closureConsInvtChecking = new ClosureConsInvtChecking();
                        closureConsInvtChecking.GenerateConsInvtCheckingTask(model.Entity.ProjectId);

                        if (model.Entity.ClosureDate.HasValue)
                        {
                            ScheduleLog.UpdateStoreStatusSchedule(model.Entity.USCode, model.Entity.ProjectId, model.Entity.ClosureDate.Value, ClientCookie.UserCode);
                        }
                        #endregion
                    }
                    ProjectInfo.CompleteMainIfEnable(model.Entity.ProjectId);
                }
                tranScope.Complete();
                return(Ok());
            }
        }
        public IHttpActionResult PreparePackDownload(string refTableName, string projectId)
        {
            string pdfPath    = string.Empty;
            string refTableId = ProjectInfo.GetRefTableId(refTableName, projectId);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();
            HtmlTempalteType            templateType   = HtmlTempalteType.Default;
            string flowName = string.Empty;
            string flowCode = string.Empty;

            switch (refTableName)
            {
            case "MajorLeaseChangePackage":
            {
                templateType = HtmlTempalteType.MajorLease;
                flowName     = FlowCode.MajorLease;
                flowCode     = FlowCode.MajorLease_Package;
                var majorLeaseChangePkg = MajorLeaseChangePackage.GetMajorPackageInfo(projectId);
                templateFileds = majorLeaseChangePkg.GetPrintTemplateFields();
            }
            break;

            case "TempClosurePackage":
            {
                templateType = HtmlTempalteType.TempClosure;
                flowName     = FlowCode.TempClosure;
                flowCode     = FlowCode.TempClosure_ClosurePackage;
                var tempClosurePackage = TempClosurePackage.Get(projectId);
                if (tempClosurePackage == null)
                {
                    tempClosurePackage           = new TempClosurePackage();
                    tempClosurePackage.ProjectId = projectId;
                }
                templateFileds = tempClosurePackage.GetPrintTemplateFields();
            }
            break;

            case "ReimagePackage":
            {
                var entity = ReimagePackage.GetReimagePackageInfo(projectId);
                templateType = HtmlTempalteType.Reimage;
                flowName     = FlowCode.Reimage;
                flowCode     = FlowCode.Reimage_Package;
                if (entity == null || entity.Id == Guid.Parse("00000000-0000-0000-0000-000000000000"))
                {
                    entity           = new ReimagePackage();
                    entity.ProjectId = projectId;
                }
                templateFileds = entity.GetPrintTemplateFields();
            }
            break;

            case "RenewalLegalApproval":
            {
                templateType = HtmlTempalteType.RenewalLegalApproval;
                flowName     = FlowCode.Renewal;
                flowCode     = FlowCode.Renewal_LegalApproval;
                var legal = RenewalLegalApproval.Get(projectId);
                if (legal == null)
                {
                    legal           = new RenewalLegalApproval();
                    legal.ProjectId = projectId;
                }
                templateFileds = legal.GetPrintTemplateFields();
            }
            break;

            case "RenewalPackage":
            {
                templateType = HtmlTempalteType.Renewal;
                flowName     = FlowCode.Renewal;
                flowCode     = FlowCode.Renewal_Package;
                var package = RenewalPackage.Get(projectId);
                if (package == null)
                {
                    package           = new RenewalPackage();
                    package.ProjectId = projectId;
                }
                templateFileds = package.GetPrintTemplateFields();
            }
            break;

            case "ClosurePackage":
            {
                templateType = HtmlTempalteType.Default;
                flowName     = FlowCode.Closure;
                flowCode     = FlowCode.Closure_ClosurePackage;
                var closurePackage = ClosurePackage.Get(projectId);
                if (closurePackage == null)
                {
                    closurePackage           = new ClosurePackage();
                    closurePackage.ProjectId = projectId;
                }
                templateFileds = closurePackage.GetPrintTemplateFields();
            }
            break;

            default:
                break;
            }
            List <Attachment> attachments = Attachment.GetAllAttachmentsIncludeRequire(refTableName, projectId, flowCode).Where(att => att.ID != Guid.Empty &&
                                                                                                                                (att.RequirementId.HasValue || att.TypeCode == "Cover")).ToList();
            //Submission and Approval Records - 只显示通过意见
            List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>();
            //Submission and Approval Records Details — 所有意见
            List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>();
            ProjectCommentCondition         condition        = new ProjectCommentCondition();

            condition.RefTableName = refTableName;
            condition.RefTableId   = Guid.Parse(refTableId);
            condition.Status       = ProjectCommentStatus.Submit;

            var commentList       = condition.RefTableId == Guid.Empty ? new List <VProjectComment>() : VProjectComment.SearchVListForPDF(condition);
            var commentDetailList = condition.RefTableId == Guid.Empty ? new List <VProjectComment>() : VProjectComment.SearchVList(condition);

            SubmissionApprovalRecord record = null;

            foreach (var item in commentList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordList.Add(record);
            }
            recordList = recordList.OrderBy(i => i.OperationDate).ToList();

            foreach (var item in commentDetailList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordDetailList.Add(record);
            }
            recordDetailList = recordDetailList.OrderBy(i => i.OperationDate).ToList();

            pdfPath = HtmlConversionUtility.HtmlConvertToPDF(templateType, templateFileds, recordList, recordDetailList);
            var pdfFileName  = Path.GetFileName(pdfPath);
            var pdfExtension = Path.GetExtension(pdfPath);

            attachments.Add(new Attachment {
                InternalName = pdfFileName, Name = flowName + " Print", Extension = pdfExtension
            });

            if (refTableName == "RenewalLegalApproval")
            {
                SaveRenewalLegalApprovalPDF("RenewalLegalApproval", projectId,
                                            new Guid("870BD738-A512-4B27-9FDB-C18058BFA817"), pdfPath);
                return(Ok());
            }
            string packFileUrl = ZipHandle.ExeFiles(attachments);

            return(Ok(new
            {
                PackUrl = string.Concat("~/", "Temp/", Path.GetFileName(packFileUrl))
            }));
        }
        public IHttpActionResult Send(PostMemo <TempClosureReopenMemo> postData)
        {
            var actor = ProjectUsers.GetProjectUser(postData.Entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (TransactionScope tranScope = new TransactionScope())
            {
                Save(postData.Entity);
                Dictionary <string, string> pdfData = new Dictionary <string, string>();
                pdfData.Add("WorkflowName", "TempClosure");
                pdfData.Add("ProjectID", postData.Entity.ProjectId);
                pdfData.Add("RegionENUS", postData.Entity.RegionENUS);
                pdfData.Add("RegionZHCN", postData.Entity.RegionZHCN);
                pdfData.Add("MarketENUS", postData.Entity.MarketENUS);
                pdfData.Add("MarketZHCN", postData.Entity.MarketZHCN);
                pdfData.Add("ProvinceENUS", postData.Entity.ProvinceENUS);
                pdfData.Add("ProvinceZHCN", postData.Entity.ProvinceZHCN);
                pdfData.Add("CityENUS", postData.Entity.CityENUS);
                pdfData.Add("CityZHCN", postData.Entity.CityZHCN);
                pdfData.Add("PipelineId", postData.Entity.PipelineId);
                pdfData.Add("USCode", postData.Entity.USCode);
                pdfData.Add("StoreENUS", postData.Entity.StoreENUS);
                pdfData.Add("StoreZHCN", postData.Entity.StoreZHCN);
                pdfData.Add("ActualConsFinishDate", postData.Entity.ActualConsFinishDate.HasValue ? postData.Entity.ActualConsFinishDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("OpeningDate", postData.Entity.OpeningDate.HasValue ? postData.Entity.OpeningDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("ProtfolioTypeName", postData.Entity.ProtfolioTypeName);
                pdfData.Add("TAClassificationName", postData.Entity.TAClassificationName);
                pdfData.Add("MarketDesirability", postData.Entity.MarketDesirability);
                pdfData.Add("RERating", postData.Entity.RERating);
                pdfData.Add("BusinessArea", postData.Entity.BusinessArea);
                pdfData.Add("KitchenFloor", postData.Entity.KitchenFloor);
                pdfData.Add("SeatingFloor", postData.Entity.SeatingFloor);
                pdfData.Add("SeatingNum", postData.Entity.SeatingNum);
                pdfData.Add("ParkingNum", postData.Entity.ParkingNum);
                pdfData.Add("ContractType", postData.Entity.ContractType);
                pdfData.Add("Kiosk", postData.Entity.Kiosk);
                pdfData.Add("RERepName", postData.Entity.RERepName);
                pdfData.Add("PlannerName", postData.Entity.PlannerName);
                string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.TempClosureReopenMemo, pdfData, null);
                EmailSendingResultType result;
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", postData.Entity.USCode);
                bodyValues.Add("StoreName", postData.Entity.StoreENUS);
                bodyValues.Add("Actor", actor.RoleNameENUS);                      ////--呈递人
                bodyValues.Add("WorkflowName", Constants.TempClosure_ReopenMemo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure);             //项目名称
                var viewPage = string.Format("{0}/TempClosure/Main#/ReopenMemo/Process/View?projectId={1}",
                                             HttpContext.Current.Request.Url.Authority, postData.Entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);

                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    StringBuilder sbCC    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    //主送人
                    var actorEmployee = Employee.GetEmployeeByCode(actor.UserAccount);
                    if (actorEmployee != null)
                    {
                        sbTo.Append(actorEmployee.Mail + ";");
                    }
                    var cooList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Coordinator);
                    foreach (var coo in cooList)
                    {
                        sbTo.Append(coo.Mail + ";");
                    }
                    var mamList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Market_Asset_Mgr);
                    foreach (var mam in mamList)
                    {
                        sbTo.Append(mam.Mail + ";");
                    }
                    var ramList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Regional_Asset_Mgr);
                    foreach (var ram in ramList)
                    {
                        sbTo.Append(ram.Mail + ";");
                    }
                    var mcamList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.MCCL_Asset_Mgr);
                    foreach (var mcam in mcamList)
                    {
                        sbTo.Append(mcam.Mail + ";");
                    }

                    //抄送人
                    if (postData.Receivers != null)
                    {
                        foreach (Employee emp in postData.Receivers)
                        {
                            if (sbCC.Length > 0)
                            {
                                sbCC.Append(";");
                            }
                            if (!string.IsNullOrEmpty(emp.Mail))
                            {
                                sbCC.Append(emp.Mail);
                            }
                        }
                    }
                    if (sbCC.Length > 0)
                    {
                        sbCC.Append(";");
                    }

                    message.EmailBodyValues = bodyValues;
                    string strTitle = FlowCode.TempClosure_ReopenMemo;
                    attachments.Add(pdfPath, strTitle + "_" + postData.Entity.ProjectId + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.CC           = sbCC.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendNotificationEmail(message);
                }

                if (!result.Successful)
                {
                    return(BadRequest(result.ErrorMessage + " " + pdfPath));
                }
                var projectInfo = ProjectInfo.Get(postData.Entity.ProjectId, FlowCode.TempClosure_ReopenMemo);
                if (projectInfo.Status == ProjectStatus.UnFinish)
                {
                    postData.Entity.Submit();
                }
                tranScope.Complete();
            }
            return(Ok());
        }
Exemple #7
0
        public IHttpActionResult NotifyGBMemo(PostMemo <ReimageGBMemo> postData)
        {
            var actor = ProjectUsers.GetProjectUser(postData.Entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (TransactionScope tranScope = new TransactionScope())
            {
                Dictionary <string, string> pdfData = new Dictionary <string, string>();
                pdfData.Add("WorkflowName", Constants.Reimage);
                pdfData.Add("ProjectID", postData.Entity.ProjectId);
                pdfData.Add("RegionNameENUS", postData.Entity.Store.StoreBasicInfo.RegionENUS);
                pdfData.Add("RegionNameZHCN", postData.Entity.Store.StoreBasicInfo.RegionZHCN);
                pdfData.Add("MarketNameENUS", postData.Entity.Store.StoreBasicInfo.MarketENUS);
                pdfData.Add("MarketNameZHCN", postData.Entity.Store.StoreBasicInfo.MarketZHCN);
                pdfData.Add("ProvinceNameENUS", postData.Entity.Store.StoreBasicInfo.ProvinceENUS);
                pdfData.Add("ProvinceNameZHCN", postData.Entity.Store.StoreBasicInfo.ProvinceZHCN);
                pdfData.Add("CityNameENUS", postData.Entity.Store.StoreBasicInfo.CityENUS);
                pdfData.Add("CityNameZHCN", postData.Entity.Store.StoreBasicInfo.CityZHCN);
                pdfData.Add("StoreNameENUS", postData.Entity.Store.StoreBasicInfo.NameENUS);
                pdfData.Add("StoreNameZHCN", postData.Entity.Store.StoreBasicInfo.NameZHCN);
                pdfData.Add("USCode", postData.Entity.Store.StoreBasicInfo.StoreCode);

                pdfData.Add("IsClosed", postData.Entity.IsClosed ? "Y" : "N");
                pdfData.Add("IsInOperation", postData.Entity.IsInOperation ? "Y" : "N");
                pdfData.Add("IsMcCafe", postData.Entity.IsMcCafe ? "Y" : "N");
                pdfData.Add("IsKiosk", postData.Entity.IsKiosk ? "Y" : "N");
                pdfData.Add("IsMDS", postData.Entity.IsMDS ? "Y" : "N");
                pdfData.Add("Is24Hour", postData.Entity.Is24Hour ? "Y" : "N");
                var consInfo = ReimageConsInfo.GetConsInfo(postData.Entity.ProjectId);
                postData.Entity.ReinvestInfo = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id);
                pdfData.Add("GBDate", postData.Entity.rmgInfo.GBDate.HasValue ? postData.Entity.rmgInfo.GBDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("ConstCompletionDate", postData.Entity.ReinvestInfo.ConsCompletionDate.HasValue ? postData.Entity.ReinvestInfo.ConsCompletionDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("ReopenDate", postData.Entity.rmgInfo.ReopenDate.HasValue ? postData.Entity.rmgInfo.ReopenDate.Value.ToString("yyyy-MM-dd") : "");

                string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.GBMemo, pdfData, null);
                EmailSendingResultType result;
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", postData.Entity.Store.StoreBasicInfo.StoreCode);
                bodyValues.Add("StoreName", postData.Entity.Store.StoreBasicInfo.NameENUS);
                bodyValues.Add("Actor", actor.RoleNameENUS);              ////--呈递人
                bodyValues.Add("WorkflowName", Constants.Reimage_GBMemo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Reimage);         //项目名称

                string viewPage = string.Format("{0}/Reimage/Main#/GBMemo/Process/View?projectId={1}",
                                                ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);

                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    foreach (Employee emp in postData.Receivers)
                    {
                        if (sbTo.Length > 0)
                        {
                            sbTo.Append(";");
                        }
                        if (!string.IsNullOrEmpty(emp.Mail))
                        {
                            sbTo.Append(emp.Mail);
                        }
                    }
                    if (sbTo.Length > 0)
                    {
                        sbTo.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    string strTitle = FlowCode.Reimage_GBMemo;
                    attachments.Add(pdfPath, strTitle + "_" + postData.Entity.ProjectId + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendGBMemoNotificationEmail(message);
                }

                if (!result.Successful)
                {
                    return(BadRequest(result.ErrorMessage + " " + pdfPath));
                }
                postData.Entity.CompleteNotifyTask(postData.Entity.ProjectId);
                tranScope.Complete();
            }
            return(Ok());
        }
Exemple #8
0
        public static List <EmailSendingResultType> SendPackageApprovalEmail(TempClosureInfo tempClosureInfo, TempClosurePackage entity, ApproveUsers approvers)
        {
            var project       = ProjectInfo.Get(entity.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var assetMgr      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor    = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var results       = new List <EmailSendingResultType>();

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                List <SimpleEmployee> approveEmps = new List <SimpleEmployee> {
                    approvers.MarketMgr,
                    approvers.GM,
                    approvers.MDD,
                    approvers.FC,
                    approvers.VPGM
                    //approvers.MCCLAssetMgr,
                    //approvers.MCCLAssetDtr
                };
                if (approvers.RegionalMgr != null)
                {
                    approveEmps.Add(approvers.RegionalMgr);
                }
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("Actor", assetActor.UserNameENUS);     ////--呈递人
                //bodyValues.Add("WorkflowName", Constants.TempClosure_Package);////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure); //项目名称
                var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}",
                                             HttpContext.Current.Request.Url.Authority, entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);
                Dictionary <string, string> templateFileds = new Dictionary <string, string>();
                var flowInfo = FlowInfo.Get(FlowCode.TempClosure);
                templateFileds.Add("WorkflowName", flowInfo.NameENUS);
                templateFileds.Add("ProjectID", entity.ProjectId);
                templateFileds.Add("USCode", storeBasic.StoreCode);
                templateFileds.Add("City", storeBasic.CityZHCN);
                templateFileds.Add("Region", storeBasic.Region);
                templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
                templateFileds.Add("Market", storeBasic.Market);
                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 (!string.IsNullOrEmpty(storeInfo.StoreContractInfo.EndYear))
                {
                    templateFileds.Add("CurrentLeaseENDYear", (int.Parse(storeInfo.StoreContractInfo.EndYear) - storeInfo.CurrentYear).ToString());
                }
                else
                {
                    templateFileds.Add("CurrentLeaseENDYear", "");
                }

                if (assetMgr != null)
                {
                    templateFileds.Add("AssetsManager", assetMgr.UserNameENUS);
                }
                templateFileds.Add("AssetsActor", assetActor.UserNameENUS);
                templateFileds.Add("AssetsRep", assetRep.UserNameENUS);
                templateFileds.Add("ClosureDate", tempClosureInfo.ActualTempClosureDate.ToString("yyyy-MM-dd"));
                templateFileds.Add("LeaseExpireDate", tempClosureInfo.LeaseExpireDate.HasValue ? tempClosureInfo.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("ReOpenDate", tempClosureInfo.ActualReopenDate.ToString("yyyy-MM-dd"));
                templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(entity.RentReliefClause) ? "否" : "是");
                templateFileds.Add("RentFreeStartDate", entity.RentReliefStartDate.HasValue ? entity.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("RentFreeEndDate", entity.RentReliefEndDate.HasValue ? entity.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("FreeRentTerm", entity.RentReliefClause);
                var approveRecords = ProjectComment.GetList("TempClosurePackage", entity.Id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord
                {
                    OperatorID    = pc.UserAccount,
                    OperatorName  = pc.UserNameENUS,
                    OperatorTitle = pc.TitleNameENUS,
                    OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now,
                    ActionName    = pc.ActivityName,
                    Comments      = pc.Content
                }).ToList();
                string imgPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.TempClosure, templateFileds, approveRecords);
                approveEmps.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);//--提交人
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result =  emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
                approvers.NoticeUsers.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))//--提交人
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result = emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
            }
            return(results);
        }
        public IHttpActionResult Send(PostMemo <TempClosureMemo> postData)
        {
            var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == postData.Entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            Dictionary <string, string> pdfData = new Dictionary <string, string>();

            if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") != -1)
            {
                pdfData.Add("WorkflowName", "Rebuild");
                pdfData.Add("ClosureNature", "Temporary");
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") != -1)
            {
                pdfData.Add("WorkflowName", "MajorLease");
                pdfData.Add("ClosureNature", "Temporary");
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") != -1)
            {
                pdfData.Add("WorkflowName", "Reimage");
                pdfData.Add("ClosureNature", "Temporary");
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("renewal") != -1)
            {
                pdfData.Add("WorkflowName", "Renewal");
                pdfData.Add("ClosureNature", "Temporary");
            }
            else
            {
                pdfData.Add("WorkflowName", "TempClosure");
                pdfData.Add("ClosureNature", postData.Entity.ClosureNature.ToString());
            }
            pdfData.Add("ProjectID", postData.Entity.ProjectId);
            pdfData.Add("RegionNameENUS", postData.Entity.RegionNameENUS);
            pdfData.Add("RegionNameZHCN", postData.Entity.RegionNameZHCN);
            pdfData.Add("MarketNameENUS", postData.Entity.MarketNameENUS);
            pdfData.Add("MarketNameZHCN", postData.Entity.MarketNameZHCN);
            pdfData.Add("ProvinceNameENUS", postData.Entity.ProvinceNameENUS);
            pdfData.Add("ProvinceNameZHCN", postData.Entity.ProvinceNameZHCN);
            pdfData.Add("CityNameENUS", postData.Entity.CityNameENUS);
            pdfData.Add("CityNameZHCN", postData.Entity.CityNameZHCN);
            pdfData.Add("StoreNameENUS", postData.Entity.StoreNameENUS);
            pdfData.Add("StoreNameZHCN", postData.Entity.StoreNameZHCN);
            pdfData.Add("StoreAddressENUS", postData.Entity.StoreAddressENUS);
            pdfData.Add("StoreAddressZHCN", postData.Entity.StoreAddressZHCN);
            pdfData.Add("USCode", postData.Entity.USCode);
            pdfData.Add("OpenDate", postData.Entity.OpenDate.HasValue ? postData.Entity.OpenDate.Value.ToString("yyyy-MM-dd") : "");
            pdfData.Add("ClosureDate", postData.Entity.ClosureDate.HasValue ? postData.Entity.ClosureDate.Value.ToString("yyyy-MM-dd") : "");

            pdfData.Add("BecauseOfReimaging", postData.Entity.BecauseOfReimaging ? "Yes" : "No");
            pdfData.Add("BecauseOfRemodel", postData.Entity.BecauseOfRemodel ? "Yes" : "No");
            pdfData.Add("BecauseOfDespute", postData.Entity.BecauseOfDespute ? "Yes" : "No");
            pdfData.Add("BecauseOfRedevelopment", postData.Entity.BecauseOfRedevelopment ? "Yes" : "No");
            pdfData.Add("BecauseOfPlanedClosure", postData.Entity.BecauseOfPlanedClosure ? "Yes" : "No");
            pdfData.Add("BecauseOfRebuild", postData.Entity.BecauseOfRebuild ? "Yes" : "No");
            pdfData.Add("BecauseOfOthers", postData.Entity.BecauseOfOthers);
            pdfData.Add("PermanentCloseOpportunity", postData.Entity.PermanentCloseOpportunity ? "Yes" : "No");
            pdfData.Add("HasRelocationPlan", postData.Entity.HasRelocationPlan ? "Yes" : "No");
            pdfData.Add("PipelineName", postData.Entity.PipelineName);
            pdfData.Add("CompensationAwarded", postData.Entity.CompensationAwarded ? "Yes" : "No");
            pdfData.Add("Compensation", postData.Entity.Compensation.HasValue ? postData.Entity.Compensation.Value.ToString("N") : "");
            string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.ClosureMemo, pdfData, null);
            EmailSendingResultType result;
            //邮件模板中的数据
            Dictionary <string, string> bodyValues = new Dictionary <string, string>();

            //邮件内容中的键值对
            bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
            bodyValues.Add("StoreCode", postData.Entity.USCode);
            bodyValues.Add("StoreName", postData.Entity.StoreNameENUS);
            bodyValues.Add("Actor", actor.UserNameENUS);////--呈递人


            string viewPage = string.Format("{0}/TempClosure/Main#/ClosureMemo/Process/View?projectId={1}",
                                            ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);

            if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") != -1)
            {
                bodyValues.Add("WorkflowName", Constants.TempClosure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Rebuild);           //项目名称
                viewPage = string.Format("{0}/Rebuild/Main#/TempClosureMemo/View?projectId={1}",
                                         ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") != -1)
            {
                bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.MajorLease);    //项目名称
                viewPage = string.Format("{0}/MajorLease/Main#/ClosureMemo/View?projectId={1}",
                                         ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") != -1)
            {
                bodyValues.Add("WorkflowName", Constants.TempClosure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Reimage);           //项目名称
                viewPage = string.Format("{0}/Reimage/Main#/TempClosureMemo/View?projectId={1}",
                                         ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("renewal") != -1)
            {
                bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Renewal);       //项目名称
                viewPage = string.Format("{0}/Renewal/Main#/ClosureMemo/View?projectId={1}",
                                         ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
            }
            else if (postData.Entity.ProjectId.ToLower().IndexOf("closure") != -1)
            {
                bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Closure);       //项目名称
            }
            else
            {
                bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure);   //项目名称
            }
            bodyValues.Add("FormUrl", viewPage);

            if (postData.Entity.ProjectId.ToLower().Contains("tpcls"))
            {
                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    StringBuilder sbCC    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    //主送人
                    var actorEmployee = Employee.GetEmployeeByCode(actor.UserAccount);
                    if (actorEmployee != null)
                    {
                        sbTo.Append(actorEmployee.Mail + ";");
                    }
                    var cooList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Coordinator);
                    foreach (var coo in cooList)
                    {
                        sbTo.Append(coo.Mail + ";");
                    }
                    var mamList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Market_Asset_Mgr);
                    foreach (var mam in mamList)
                    {
                        sbTo.Append(mam.Mail + ";");
                    }
                    var ramList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.Regional_Asset_Mgr);
                    foreach (var ram in ramList)
                    {
                        sbTo.Append(ram.Mail + ";");
                    }
                    var mcamList = Employee.GetStoreEmployeesByRole(postData.Entity.USCode, RoleCode.MCCL_Asset_Mgr);
                    foreach (var mcam in mcamList)
                    {
                        sbTo.Append(mcam.Mail + ";");
                    }

                    //抄送人
                    if (postData.Receivers != null)
                    {
                        foreach (Employee emp in postData.Receivers)
                        {
                            if (sbCC.Length > 0)
                            {
                                sbCC.Append(";");
                            }
                            if (!string.IsNullOrEmpty(emp.Mail))
                            {
                                sbCC.Append(emp.Mail);
                            }
                        }
                    }
                    if (sbCC.Length > 0)
                    {
                        sbCC.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    attachments.Add(pdfPath, postData.Entity.USCode + " " + Constants.TempClosure_Memo + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.CC           = sbCC.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendNotificationEmail(message);
                }
            }
            else
            {
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    StringBuilder sbCC    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();

                    if (postData.Receivers != null)
                    {
                        foreach (Employee emp in postData.Receivers)
                        {
                            if (sbCC.Length > 0)
                            {
                                sbTo.Append(";");
                            }
                            if (!string.IsNullOrEmpty(emp.Mail))
                            {
                                sbTo.Append(emp.Mail);
                            }
                        }
                    }
                    if (sbCC.Length > 0)
                    {
                        sbCC.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    string strTitle = FlowCode.TempClosure_ClosureMemo;
                    if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                    {
                        strTitle = FlowCode.Rebuild_TempClosureMemo;
                    }
                    else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                    {
                        strTitle = FlowCode.Reimage_TempClosureMemo;
                    }
                    else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") >= 0)
                    {
                        strTitle = "MajorLease_ClosureMemo";
                    }

                    attachments.Add(pdfPath, postData.Entity.USCode + " " + strTitle + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendNotificationEmail(message);
                }
            }

            if (!result.Successful)
            {
                return(BadRequest(result.ErrorMessage + " " + pdfPath));
            }
            using (TransactionScope tranScope = new TransactionScope())
            {
                postData.Entity.Save();
                ProjectInfo projectInfo = null;
                if (postData.Entity.ProjectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    projectInfo = ProjectInfo.Get(postData.Entity.ProjectId, FlowCode.Rebuild_TempClosureMemo);
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("reimage") >= 0)
                {
                    projectInfo = ProjectInfo.Get(postData.Entity.ProjectId, FlowCode.Reimage_TempClosureMemo);
                }
                else if (postData.Entity.ProjectId.ToLower().IndexOf("majorlease") >= 0 ||
                         postData.Entity.ProjectId.ToLower().IndexOf("renewal") >= 0)
                {
                    postData.Entity.Submit();
                }
                else
                {
                    projectInfo = ProjectInfo.Get(postData.Entity.ProjectId, FlowCode.TempClosure_ClosureMemo);
                    var tempClosure = TempClosureInfo.Get(postData.Entity.ProjectId);
                    if (postData.Entity.ClosureDate != null)
                    {
                        tempClosure.ActualTempClosureDate = postData.Entity.ClosureDate.Value;
                    }
                    tempClosure.Update();
                }
                if (projectInfo != null && projectInfo.Status == ProjectStatus.UnFinish)
                {
                    postData.Entity.Submit();

                    if (postData.Entity.ProjectId.ToLower().Contains("tpcls"))
                    {
                        if (postData.Entity.ClosureDate.HasValue)
                        {
                            ScheduleLog.UpdateStoreStatusSchedule(postData.Entity.USCode, postData.Entity.ProjectId, postData.Entity.ClosureDate.Value, ClientCookie.UserCode);
                        }
                    }
                }
                tranScope.Complete();
            }
            return(Ok());
        }
Exemple #10
0
        public EmailSendingResultType SendEmail(Guid id, string[] emailToEids, string workflowName, string projectID, string tableName)
        {
            var closureInfo = ClosureInfo.GetByProjectId(projectID);
            var store       = StoreBasicInfo.GetStore(closureInfo.USCode);
            var storeBasic  = store.StoreBasicInfo;
            EmailServiceClient emailClient = new EmailServiceClient();
            var          bllProjectComment = new ProjectComment();
            EmailMessage email             = new EmailMessage();
            //邮件模板中的数据
            Dictionary <string, string> bodyValues = new Dictionary <string, string>();

            //邮件内容中的键值对
            bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
            bodyValues.Add("WorkflowName", workflowName);
            bodyValues.Add("StoreCode", storeBasic.StoreCode);
            bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
            bodyValues.Add("Actor", closureInfo.AssetActorNameENUS);////--呈递人
            var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}",
                                         HttpContext.Current.Request.Url.Authority, projectID);

            bodyValues.Add("FormUrl", viewPage);
            email.EmailBodyValues = bodyValues;
            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("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreAge", "");
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            var currentLeaseENDYear = store.CurrentYear - int.Parse(store.StoreContractInfo.EndYear);

            templateFileds.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString());
            templateFileds.Add("AssetsManager", closureInfo.AssetManagerNameENUS);
            templateFileds.Add("AssetsActor", closureInfo.AssetActorNameENUS);
            templateFileds.Add("AssetsRep", closureInfo.AssetRepNameENUS);
            if (closureInfo.ActualCloseDate.HasValue && closureInfo.ActualCloseDate.Value.Year == 1900)
            {
                templateFileds.Add("ClosureDate", string.Empty);
            }
            else
            {
                templateFileds.Add("ClosureDate", closureInfo.ActualCloseDate.HasValue ? closureInfo.ActualCloseDate.Value.ToString("yyyy-MM-dd") : "");
            }
            templateFileds.Add("ClosureType", closureInfo.ClosureTypeNameENUS);
            templateFileds.Add("LandlordName", "");
            templateFileds.Add("LeaseExpireDate", "");
            templateFileds.Add("OriginalCFNPV", "");

            List <SubmissionApprovalRecord> approveRecords = new List <SubmissionApprovalRecord>();

            if (id != new Guid())
            {
                approveRecords = ProjectComment.GetList(tableName, id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord
                {
                    OperatorID    = pc.UserAccount,
                    OperatorName  = pc.UserNameENUS,
                    OperatorTitle = pc.TitleNameENUS,
                    OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now,
                    ActionName    = pc.ActivityName,
                    Comments      = pc.Content
                }).ToList();
            }
            string        imgPath        = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Default, templateFileds, approveRecords);
            List <string> emailAddresses = Employee.Search(e => emailToEids.Contains(e.Code)).Select(e => e.Mail).ToList();

            emailAddresses.Add("*****@*****.**");
            emailAddresses.Add("*****@*****.**");
            emailAddresses.Add("*****@*****.**");
            //emailAddresses.Add("*****@*****.**");
            email.To          = string.Join(";", emailAddresses);
            email.Attachments = imgPath;
            //EmailSendingResultType result = emailClient.SendEmail(email);
            return(new EmailSendingResultType());
        }