public ActionResult do_export_billing(string p_case_code) { try { string _mapPath_Report = Server.MapPath("~/Report/"); string _mapPath = Server.MapPath("~/"); string _fileName = AppsCommon.Export_Billing_Crytal_View(p_case_code, _mapPath_Report, _mapPath); return(Json(new { success = _fileName })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = "-1" })); } }
public ActionResult DoAdminConfirm(string p_case_code, decimal p_status, string p_note) { try { SearchObject_BL _con = new SearchObject_BL(); decimal _ck = _con.Admin_Update(p_case_code, p_status, p_note, AppsCommon.GetCurrentLang(), SessionData.CurrentUser.Username); // nếu thành công thì gửi email cho khách hàng if (_ck != -1 && p_status == (decimal)CommonSearch.Stt_DaPhanHoi) { // lấy thông tin search SearchObject_BL _searchBL = new SearchObject_BL(); List <SearchObject_Detail_Info> _ListDetail = new List <SearchObject_Detail_Info>(); SearchObject_Question_Info _QuestionInfo = new SearchObject_Question_Info(); List <AppClassDetailInfo> search_Class_Infos = new List <AppClassDetailInfo>(); SearchObject_Header_Info _HeaderInfo = _searchBL.SEARCH_HEADER_GETBY_CASECODE(p_case_code, ref _ListDetail, ref _QuestionInfo, ref search_Class_Infos); // lấy thông tin người dùng UserBL _UserBL = new UserBL(); UserInfo userInfo = _UserBL.GetUserByUsername(_HeaderInfo.CREATED_BY.Trim()); #region Bỏ đi vì đã có trong email //string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Search Report.doc"); //if (_HeaderInfo.Customer_Country != Common.Common.Country_VietNam_Id) // _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Search Report_En.doc"); //DocumentModel document = DocumentModel.Load(_fileTemp); //// Fill export_header //string fileName = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "Search_report" + p_case_code.ToString() + ".pdf"); //document.MailMerge.FieldMerging += (sender, e) => //{ // if (e.IsValueFound) // { // if (e.FieldName == "Text") // ((Run)e.Inline).Text = e.Value.ToString(); // } //}; //string _search_type = ""; //if (_ListDetail.Count > 0) //{ // _search_type = _ListDetail[0].SEARCH_TYPE_NAME; //} //document.MailMerge.Execute(new { DateNo = DateTime.Now.ToString("dd-MM-yyyy") }); //document.MailMerge.Execute(new { Case_Name = _HeaderInfo.CASE_NAME }); //document.MailMerge.Execute(new { Client_Reference = _HeaderInfo.CLIENT_REFERENCE }); //document.MailMerge.Execute(new { Case_Code = _HeaderInfo.CASE_CODE }); //document.MailMerge.Execute(new { Applicant_Name = _HeaderInfo.Customer_Name }); //document.MailMerge.Execute(new { Customer_Country_Name = _HeaderInfo.Customer_Country_Name }); //document.MailMerge.Execute(new { Object = _HeaderInfo.Object_Search_Name }); //document.MailMerge.Execute(new { Result = _QuestionInfo.RESULT }); //document.MailMerge.Execute(new { Search_Type = _search_type }); //if (userInfo != null) //{ // document.MailMerge.Execute(new { Contact_Person = userInfo.Contact_Person }); // document.MailMerge.Execute(new { Address = userInfo.Address }); // document.MailMerge.Execute(new { FullName = userInfo.FullName }); //} //else //{ // document.MailMerge.Execute(new { Contact_Person = "" }); // document.MailMerge.Execute(new { Address = "" }); // document.MailMerge.Execute(new { FullName = "" }); //} //document.Save(fileName, SaveOptions.PdfDefault); //byte[] fileContents; //var options = SaveOptions.PdfDefault; //// Save document to DOCX format in byte array. //using (var stream = new MemoryStream()) //{ // document.Save(stream, options); // fileContents = stream.ToArray(); //} //Convert.ToBase64String(fileContents); #endregion string _emailTo = userInfo.Email; string _emailCC = ""; //string _emailCC = userInfo.Copyto; List <string> _LstAttachment = new List <string>(); //20190812 bỏ đi vì đã gửi trong email rồi //_LstAttachment.Add(fileName); if (_QuestionInfo.FILE_URL != null && _QuestionInfo.FILE_URL != "") { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_QuestionInfo.FILE_URL)); } if (_QuestionInfo.FILE_URL02 != null && _QuestionInfo.FILE_URL02 != "") { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_QuestionInfo.FILE_URL02)); } if (_HeaderInfo.Billing_Id > 0) { // lấy thông tin billing Billing_BL _Billing_BL = new Billing_BL(); Billing_Header_Info _Billing_Header_Info = _Billing_BL.Billing_GetBy_Id(_HeaderInfo.Billing_Id, AppsCommon.GetCurrentLang()); if (_Billing_Header_Info.Billing_Id > 0 && _Billing_Header_Info.Status == (decimal)CommonEnums.Billing_Status.Approved) { //_LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_HeaderInfo.Url_Billing)); // kết xuất thông tin string _mapPath_Report = Server.MapPath("~/Report/"); string _mapPath = Server.MapPath("~/"); string _fileName = AppsCommon.Export_Billing_Crytal_View(_Billing_Header_Info.Case_Code, _mapPath_Report, _mapPath); _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_fileName)); } } string _content = _QuestionInfo.RESULT.Replace("\n", "<br><br>"); _content = AppsCommon.SetContentMailTemplate(_content, yourref: _QuestionInfo.CLIENT_REFERENCE, outref: p_case_code, dearname: userInfo.Username); Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom_Business, Pass = EmailHelper.EmailOriginal.PassWord_Business, Display_Name = EmailHelper.EmailOriginal.DisplayName_Business, EmailTo = _emailTo, EmailCC = _emailCC, Subject = "Search Report", Content = _content, LstAttachment = _LstAttachment, }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); } return(Json(new { success = _ck })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = "-1" })); } }