public ActionResult GetInfoByCaseCode(string p_case_code) { try { SearchObject_BL _bl = new SearchObject_BL(); List <Billing_Detail_Info> _lst_billing_detail = new List <Billing_Detail_Info>(); SearchObject_Header_Info objSearch_HeaderInfo = _bl.GetBilling_By_Case_Code(p_case_code, SessionData.CurrentUser.Username, AppsCommon.GetCurrentLang(), ref _lst_billing_detail); ViewBag.objSearch_HeaderInfo = objSearch_HeaderInfo; if (objSearch_HeaderInfo == null) { return(Json(new { success = -1 })); } // chỉ lấy những thằng nào mà > đã nộp đơn lên cục //if (objSearch_HeaderInfo != null && objSearch_HeaderInfo.Status < (decimal)Common.CommonData.CommonEnums.App_Status.DaNopDon) //{ // return Json(new { success = -2 }); //} Billing_Detail_Info _ChiPhiKhac = new Billing_Detail_Info(); _ChiPhiKhac.Nation_Fee = 0; _ChiPhiKhac.Represent_Fee = 0; _ChiPhiKhac.Service_Fee = 0; _ChiPhiKhac.Biling_Detail_Name = "Chi phí khác"; _ChiPhiKhac.Biling_Detail_Name_EN = "Others"; _ChiPhiKhac.Type = Convert.ToDecimal(Common.CommonData.CommonEnums.Billing_Detail_Type.Others); _lst_billing_detail.Add(_ChiPhiKhac); foreach (Billing_Detail_Info item in _lst_billing_detail) { item.Total_Fee = item.Nation_Fee + item.Represent_Fee + item.Service_Fee; } SessionData.SetDataSession(p_case_code, _lst_billing_detail); SessionData.SetDataSession(p_case_code + "_CURRENCY_TYPE", objSearch_HeaderInfo.Currency_Type); ViewBag.List_Billing = _lst_billing_detail; ViewBag.Operator_Type = Convert.ToDecimal(Common.CommonData.CommonEnums.Operator_Type.Insert); ViewBag.App_Case_Code = p_case_code; ViewBag.Currency_Type = objSearch_HeaderInfo.Currency_Type; ViewBag.ShowPopUp = 0; var Partial_AppInfo = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Manager/Views/Billing_Search/_Partial_SearchInfo.cshtml"); var PartialDetail_Insert_Billing = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Manager/Views/Billing_Search/_PartialDetail_Insert_Billing.cshtml"); var json = Json(new { success = 1, Partial_AppInfo, PartialDetail_Insert_Billing }); return(json); } catch (Exception ex) { Logger.LogException(ex); return(PartialView("~/Areas/TradeMark/Views/Shared/_PartialThongTinChuDon.cshtml")); } }
public ActionResult SearchShowTodo() { if (SessionData.CurrentUser == null) { return(Redirect("/account/dang-xuat")); } try { SearchObject_BL _searchBL = new SearchObject_BL(); SearchObject_Header_Info _HeaderInfo = new SearchObject_Header_Info(); 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>(); string _casecode = ""; if (RouteData.Values.ContainsKey("id")) { _casecode = RouteData.Values["id"].ToString(); _HeaderInfo = _searchBL.SEARCH_HEADER_GETBY_CASECODE(_casecode, ref _ListDetail, ref _QuestionInfo, ref search_Class_Infos); ViewBag.SearchHeader = _HeaderInfo; ViewBag.SearchListDetail = _ListDetail; ViewBag.QuestionInfo = _QuestionInfo; // lấy dữ liệu lịch sử giao dịch B_Todos_BL _B_Todos_BL = new B_Todos_BL(); List <B_Remind_Info> _ListRemind = new List <B_Remind_Info>(); List <B_Todos_Info> _Listtodo = _B_Todos_BL.NotifiGetByCasecode(_casecode, ref _ListRemind); ViewBag.ListTodo = _Listtodo; ViewBag.ListRemind = _ListRemind; ViewBag.Currstatus = _HeaderInfo.STATUS; ViewBag.lstClassDetailInfo = search_Class_Infos; B_Todos_Info _B_Todos_Info = _B_Todos_BL.Todo_GetByCaseCode(_casecode, SessionData.CurrentUser.Username); if (_B_Todos_Info != null) { ViewBag.B_Todos_Info = _B_Todos_Info; } //action là view hay sửa decimal _operator_type = Convert.ToDecimal(Common.CommonData.CommonEnums.Operator_Type.Update); if (RouteData.Values.ContainsKey("id1")) { _operator_type = Convert.ToDecimal(RouteData.Values["id1"].ToString()); } ViewBag.Operator_Type = _operator_type; } } catch (Exception ex) { Logger.LogException(ex); } return(View(@"~\Areas\Manager\Views\SearchManage\Search_Detail.cshtml")); }
public decimal SEARCH_HEADER_UPDATE(SearchObject_Header_Info p_SearchObject_Header_Info) { try { SearchObject_DA _objDA = new SearchObject_DA(); return(_objDA.SEARCH_HEADER_UPDATE(p_SearchObject_Header_Info)); } catch (Exception ex) { Logger.LogException(ex); return(-1); } }
public ActionResult SearchEdit() { if (SessionData.CurrentUser == null) { return(Redirect("/account/dang-xuat")); } try { SearchObject_BL _searchBL = new SearchObject_BL(); SearchObject_Header_Info _HeaderInfo = new SearchObject_Header_Info(); List <SearchObject_Detail_Info> _ListDetail = new List <SearchObject_Detail_Info>(); SearchObject_Question_Info _QuestionInfo = new SearchObject_Question_Info(); //List<Search_Class_Info> search_Class_Infos = new List<Search_Class_Info>(); List <AppClassDetailInfo> search_Class_Infos = new List <AppClassDetailInfo>(); decimal _Searchid = 0; if (RouteData.Values.ContainsKey("id")) { _Searchid = Convert.ToDecimal(RouteData.Values["id"]); _HeaderInfo = _searchBL.SEARCH_HEADER_GETBYID(_Searchid, ref _ListDetail, ref _QuestionInfo, ref search_Class_Infos); ViewBag.SearchHeader = _HeaderInfo; ViewBag.SearchListDetail = _ListDetail; ViewBag.QuestionInfo = _QuestionInfo; ViewBag.lstClassDetailInfo = search_Class_Infos; } int _Status = 0; if (RouteData.Values.ContainsKey("id2")) { _Status = Convert.ToInt32(RouteData.Values["id2"]); ViewBag.CurrStatus = _Status; } if (_HeaderInfo.Object_Search == Common.CommonData.Search_Object_Enum.Trademark) { return(View(@"~\Areas\Manager\Views\SearchManage\SearchEdit.cshtml")); } else if (_HeaderInfo.Object_Search == Common.CommonData.Search_Object_Enum.Legal_Inquiries) { return(View(@"~\Areas\Manager\Views\SearchManage\SearchEdit_Inquiries.cshtml")); } return(View(@"~\Areas\Manager\Views\SearchManage\SearchEdit.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(View(@"~\Areas\Manager\Views\SearchManage\SearchEdit.cshtml")); } }
public Billing_Header_Info Billing_Search_GetBy_Id(decimal p_billing_id, string p_app_case_code, string p_language_code, ref SearchObject_Header_Info searchObject_Header_Info, ref List <Billing_Detail_Info> p_lst_billing_detail) { try { Billing_DA _da = new Billing_DA(); DataSet _ds = _da.Billing_GetBy_Id(p_billing_id, p_app_case_code, p_language_code); p_lst_billing_detail = CBO <Billing_Detail_Info> .FillCollectionFromDataTable(_ds.Tables[1]); searchObject_Header_Info = CBO <SearchObject_Header_Info> .FillObjectFromDataTable(_ds.Tables[2]); return(CBO <Billing_Header_Info> .FillObjectFromDataTable(_ds.Tables[0])); } catch (Exception ex) { Logger.LogException(ex); return(new Billing_Header_Info()); } }
public ActionResult Index_Search() { try { if (SessionData.CurrentUser == null) { return(Redirect("/")); } SessionData.CurrentUser.chashFile.Clear(); string AppCode = ""; if (RouteData.Values.ContainsKey("id")) { AppCode = RouteData.Values["id"].ToString().ToUpper(); } ViewBag.AppCode = AppCode; if (RouteData.Values.ContainsKey("id1")) { string _SearchCode = RouteData.Values["id1"].ToString().ToUpper(); ViewBag.SearchCode = _SearchCode; 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(_SearchCode, ref _ListDetail, ref _QuestionInfo, ref search_Class_Infos); ViewBag.Name = _HeaderInfo.Name; } return(PartialView("~/Areas/Patent/Views/Lao_PT/_Partial_Lao_PT_Insert.cshtml")); } catch (Exception ex) { Logger.LogException(ex); return(PartialView("~/Areas/Patent/Views/Lao_PT/_Partial_Lao_PT_Insert.cshtml")); } }
public decimal SEARCH_HEADER_UPDATE(SearchObject_Header_Info p_SearchObject_Header_Info) { try { OracleParameter paramReturn = new OracleParameter("p_return", OracleDbType.Decimal, ParameterDirection.Output); OracleHelper.ExecuteNonQuery(Configuration.connectionString, CommandType.StoredProcedure, "PKG_SEARCH_OBJECTS.PROC_SEARCH_HEADER_UPDATE", new OracleParameter("P_SEARCH_ID", OracleDbType.Decimal, p_SearchObject_Header_Info.SEARCH_ID, ParameterDirection.Input), new OracleParameter("P_CASE_CODE", OracleDbType.Varchar2, p_SearchObject_Header_Info.CASE_CODE, ParameterDirection.Input), new OracleParameter("P_CLIENT_REFERENCE", OracleDbType.Varchar2, p_SearchObject_Header_Info.CLIENT_REFERENCE, ParameterDirection.Input), new OracleParameter("P_CASE_NAME", OracleDbType.Varchar2, p_SearchObject_Header_Info.CASE_NAME, ParameterDirection.Input), new OracleParameter("P_REQUEST_DATE", OracleDbType.Date, p_SearchObject_Header_Info.REQUEST_DATE, ParameterDirection.Input), new OracleParameter("P_RESPONSE_DATE", OracleDbType.Date, p_SearchObject_Header_Info.RESPONSE_DATE, ParameterDirection.Input), new OracleParameter("P_STATUS", OracleDbType.Decimal, p_SearchObject_Header_Info.STATUS, ParameterDirection.Input), new OracleParameter("P_LAWER_ID", OracleDbType.Decimal, p_SearchObject_Header_Info.LAWER_ID, ParameterDirection.Input), new OracleParameter("P_MODIFIED_BY", OracleDbType.Varchar2, p_SearchObject_Header_Info.MODIFIED_BY, ParameterDirection.Input), new OracleParameter("P_MODIFIED_DATE", OracleDbType.Date, p_SearchObject_Header_Info.MODIFIED_DATE, ParameterDirection.Input), new OracleParameter("P_NOTES", OracleDbType.Varchar2, p_SearchObject_Header_Info.NOTE, ParameterDirection.Input), new OracleParameter("P_OBJECT_SEARCH", OracleDbType.Decimal, p_SearchObject_Header_Info.Object_Search, ParameterDirection.Input), new OracleParameter("P_URL_FILE", OracleDbType.Varchar2, p_SearchObject_Header_Info.Url_File, ParameterDirection.Input), //HungTD thêm up ảnh new OracleParameter("P_LOGOURL", OracleDbType.Varchar2, p_SearchObject_Header_Info.Logourl, ParameterDirection.Input), new OracleParameter("P_LOGOCHU", OracleDbType.Decimal, p_SearchObject_Header_Info.Logochu, ParameterDirection.Input), new OracleParameter("P_LOGO_FONT_SIZE", OracleDbType.Decimal, p_SearchObject_Header_Info.LOGO_FONT_SIZE, ParameterDirection.Input), new OracleParameter("P_FONTTYPE", OracleDbType.Varchar2, p_SearchObject_Header_Info.FONTTYPE, ParameterDirection.Input), new OracleParameter("P_NAME", OracleDbType.Varchar2, p_SearchObject_Header_Info.Name, ParameterDirection.Input), paramReturn); return(Convert.ToDecimal(paramReturn.Value.ToString())); } catch (Exception ex) { Logger.LogException(ex); return(-1); } }
public ActionResult DoSearchResult(SearchObject_Question_Info p_SearchObject_Header_Info, Billing_Header_Info p_Billing_Header_Info) { try { List <Billing_Detail_Info> _lst_billing_detail = AppsCommon.Get_LstFee_Detail(p_SearchObject_Header_Info.CASE_CODE); decimal _ck = 0; decimal _billing_id = 0; using (var scope = new TransactionScope()) { p_SearchObject_Header_Info.LANGUAGE_CODE = AppsCommon.GetCurrentLang(); p_SearchObject_Header_Info.MODIFIED_BY = SessionData.CurrentUser.Username; p_SearchObject_Header_Info.MODIFIED_DATE = DateTime.Now; p_SearchObject_Header_Info.FILE_URL = AppLoadHelpers.PushFileToServer(p_SearchObject_Header_Info.FileBase_File_Url, AppUpload.Search); p_SearchObject_Header_Info.FILE_URL02 = AppLoadHelpers.PushFileToServer(p_SearchObject_Header_Info.FileBase_File_Url02, AppUpload.Search); SearchObject_BL _con = new SearchObject_BL(); _ck = _con.SEARCH_RESULT_SEARCH(p_SearchObject_Header_Info); if (_ck < 0) { goto Commit_Transaction; } // insert billing // lấy thông tin cũ if (_lst_billing_detail.Count == 0) { goto Commit_Transaction; } SearchObject_BL _SearchObject_BL = new SearchObject_BL(); List <Billing_Detail_Info> _lst_detail = new List <Billing_Detail_Info>(); SearchObject_Header_Info objSearch_HeaderInfo = _SearchObject_BL.GetBilling_By_Case_Code(p_SearchObject_Header_Info.CASE_CODE, SessionData.CurrentUser.Username, AppsCommon.GetCurrentLang(), ref _lst_detail); Billing_BL _obj_bl = new Billing_BL(); p_Billing_Header_Info.Created_By = SessionData.CurrentUser.Username; p_Billing_Header_Info.Created_Date = DateTime.Now; p_Billing_Header_Info.Language_Code = AppsCommon.GetCurrentLang(); p_Billing_Header_Info.Status = (decimal)CommonEnums.Billing_Status.New_Wait_Approve; p_Billing_Header_Info.Billing_Type = (decimal)CommonEnums.Billing_Type.Search; p_Billing_Header_Info.Notes = "Billing for case code " + p_SearchObject_Header_Info.CASE_CODE; // + " - " + p_SearchObject_Header_Info.NOTE; p_Billing_Header_Info.Case_Code = _obj_bl.Billing_GenCaseCode(); p_Billing_Header_Info.App_Case_Code = p_SearchObject_Header_Info.CASE_CODE; p_Billing_Header_Info.Billing_Date = DateTime.Now; p_Billing_Header_Info.Deadline = DateTime.Now.AddDays(30); p_Billing_Header_Info.Request_By = SessionData.CurrentUser.Username; p_Billing_Header_Info.Approve_By = ""; decimal _Total_Amount_Represent = 0; decimal _Total_Amount_Temp = 0; decimal _Percent_discount = 0; List <AllCodeInfo> _lstDiscount = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("DISCOUNT", "SERVICE"); if (_lstDiscount.Count > 0) { _Percent_discount = Convert.ToDecimal(_lstDiscount[0].CdVal); } foreach (Billing_Detail_Info item in _lst_billing_detail) { _Total_Amount_Represent = _Total_Amount_Represent + item.Represent_Fee; _Total_Amount_Temp = _Total_Amount_Temp + item.Total_Fee; } decimal _discount = Math.Round(_Total_Amount_Represent * _Percent_discount / 100); p_Billing_Header_Info.Total_Pre_Tex = _Total_Amount_Temp - _discount; p_Billing_Header_Info.Tex_Fee = Math.Round(p_Billing_Header_Info.Total_Pre_Tex / 100 * Common.Common.Tax); p_Billing_Header_Info.Total_Amount = p_Billing_Header_Info.Total_Pre_Tex + p_Billing_Header_Info.Tex_Fee; p_Billing_Header_Info.Currency = objSearch_HeaderInfo.Currency_Type; p_Billing_Header_Info.Currency_Rate = AppsCommon.Get_Currentcy_VCB(); p_Billing_Header_Info.Insert_Type = (decimal)Common.CommonData.CommonEnums.Billing_Insert_Type.Search; p_Billing_Header_Info.Discount_Fee_Service = _discount; p_Billing_Header_Info.Percent_Discount = _Percent_discount; p_Billing_Header_Info.Currency_Rate = AppsCommon.Get_Currentcy_VCB(); _billing_id = _obj_bl.Billing_Insert(p_Billing_Header_Info); if (_billing_id > 0 && _lst_billing_detail.Count > 0) { _ck = _obj_bl.Billing_Detail_InsertBatch(_lst_billing_detail, _billing_id); } if (_ck > 0 && p_Billing_Header_Info.Insert_Type == (decimal)Common.CommonData.CommonEnums.Billing_Insert_Type.Search) { //string _fileExport = AppsCommon.Export_Billing(p_Billing_Header_Info.Case_Code); string _mapPath_Report = Server.MapPath("~/Report/"); string _mapPath = Server.MapPath("~/"); string _fileExport = AppsCommon.Export_Billing_Crytal(p_Billing_Header_Info.Case_Code, _mapPath_Report, _mapPath, objSearch_HeaderInfo.CREATED_BY, p_Billing_Header_Info, _lst_billing_detail); if (_fileExport == "") { goto Commit_Transaction; } SearchObject_BL _bl = new SearchObject_BL(); _ck = _bl.Update_Url_Billing(p_Billing_Header_Info.App_Case_Code, _billing_id, _fileExport); // insert vào docking AppsCommon.Insert_Docketing(p_Billing_Header_Info.Case_Code, "Report Billing", _fileExport, true); } //end Commit_Transaction: if (_ck < 0) { Transaction.Current.Rollback(); } else { SessionData.RemoveDataSession(p_SearchObject_Header_Info.CASE_CODE); scope.Complete(); } } return(Json(new { success = _ck })); } 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" })); } }
public ActionResult SearchEdit(SearchObject_Header_Info p_searchHeaderInfo, List <SearchObject_Detail_Info> p_SearchObject_Detail_Info, SearchObject_Question_Info p_questionInfo, List <Search_Class_Info> pAppClassInfo) { decimal _rel = 0; try { using (var scope = new TransactionScope()) { SearchObject_BL _searchBL = new SearchObject_BL(); p_searchHeaderInfo.MODIFIED_BY = SessionData.CurrentUser.Username; p_searchHeaderInfo.MODIFIED_DATE = DateTime.Now; p_searchHeaderInfo.REQUEST_DATE = DateTime.Now; var url_File_Atachment = ""; if (p_searchHeaderInfo.Url_File_Up != null) { url_File_Atachment = AppLoadHelpers.PushFileToServer(p_searchHeaderInfo.Url_File_Up, AppUpload.Search); p_searchHeaderInfo.Url_File = url_File_Atachment; } else { p_searchHeaderInfo.Url_File = "NA"; } //HungTD if (p_searchHeaderInfo.Object_Search == Common.CommonData.Search_Object_Enum.Trademark) { if (p_searchHeaderInfo.pfileLogo != null) { p_searchHeaderInfo.Logourl = AppLoadHelpers.PushFileToServer(p_searchHeaderInfo.pfileLogo, AppUpload.Logo); } else { p_searchHeaderInfo.Logourl = p_searchHeaderInfo.LogourlOrg; } if (p_searchHeaderInfo.Logochu != 1) { //pDetail.Logochu = 0; if (p_searchHeaderInfo.pfileLogo != null) { p_searchHeaderInfo.Logourl = AppLoadHelpers.PushFileToServer(p_searchHeaderInfo.pfileLogo, AppUpload.Logo); } } else { p_searchHeaderInfo.Logourl = p_searchHeaderInfo.ChuLogo; p_searchHeaderInfo.Logochu = 1; } //End HungTD } _rel = _searchBL.SEARCH_HEADER_UPDATE(p_searchHeaderInfo); if (_rel < 0) { return(Json(new { success = _rel })); } p_questionInfo.SEARCH_ID = p_searchHeaderInfo.SEARCH_ID; _rel = _searchBL.SEARCH_QUESTION_UPDATE(p_questionInfo); if (_rel < 0) { goto Commit_Transaction; } // detail if (p_SearchObject_Detail_Info == null) { p_SearchObject_Detail_Info = new List <SearchObject_Detail_Info>(); } if (p_SearchObject_Detail_Info.Count > 0) { foreach (SearchObject_Detail_Info item in p_SearchObject_Detail_Info) { item.SEARCH_ID = p_searchHeaderInfo.SEARCH_ID; item.SEARCH_OBJECT = p_searchHeaderInfo.Object_Search; } _searchBL.SEARCH_DETAIL_DELETE(p_searchHeaderInfo.SEARCH_ID); _rel = _searchBL.SEARCH_DETAIL_INSERT(p_SearchObject_Detail_Info); if (_rel < 0) { goto Commit_Transaction; } } //Thêm thông tin class if (pAppClassInfo != null) { _rel = _searchBL.Search_Class_Delete(p_searchHeaderInfo.SEARCH_ID, AppsCommon.GetCurrentLang()); _rel = _searchBL.Search_Class_InsertBatch(pAppClassInfo, p_searchHeaderInfo.SEARCH_ID, AppsCommon.GetCurrentLang()); } if (_rel < 0) { goto Commit_Transaction; } // thông tin thằng fee List <Search_Fix_Info> _lstFee = new List <Search_Fix_Info>(); string _keyFee = ""; foreach (var item in p_SearchObject_Detail_Info) { Search_Fix_Info _Search_Fix_Info = new Search_Fix_Info(); _Search_Fix_Info.Search_Object = item.SEARCH_OBJECT; _Search_Fix_Info.Search_Type = item.SEARCH_TYPE; _Search_Fix_Info.Country_Id = p_searchHeaderInfo.Country_Id; if (pAppClassInfo != null) { List <Search_Class_Info> list = pAppClassInfo .GroupBy(a => a.Code) .Select(g => g.First()) .ToList(); _Search_Fix_Info.Number_Of_Class = list.Count(); } else { _Search_Fix_Info.Number_Of_Class = 0; } _keyFee = p_searchHeaderInfo.Country_Id.ToString() + "_" + item.SEARCH_OBJECT.ToString() + "_" + item.SEARCH_TYPE.ToString(); if (MemoryData.c_dic_FeeBySearch.ContainsKey(_keyFee)) { if (_Search_Fix_Info.Number_Of_Class == 0) { _Search_Fix_Info.Amount = MemoryData.c_dic_FeeBySearch[_keyFee].Amount; _Search_Fix_Info.Amount_usd = MemoryData.c_dic_FeeBySearch[_keyFee].Amount_usd; } else { _Search_Fix_Info.Amount = MemoryData.c_dic_FeeBySearch[_keyFee].Amount * _Search_Fix_Info.Number_Of_Class; _Search_Fix_Info.Amount_usd = MemoryData.c_dic_FeeBySearch[_keyFee].Amount_usd * _Search_Fix_Info.Number_Of_Class; } } else { _Search_Fix_Info.Amount = 0; } _lstFee.Add(_Search_Fix_Info); } _rel = _searchBL.Search_Fee_Delete(p_searchHeaderInfo.SEARCH_ID, AppsCommon.GetCurrentLang()); if (_lstFee.Count > 0) { _rel = _searchBL.Search_Fee_InsertBatch(_lstFee, p_searchHeaderInfo.SEARCH_ID, AppsCommon.GetCurrentLang()); } //end Commit_Transaction: if (_rel < 0) { Transaction.Current.Rollback(); } else { scope.Complete(); } } return(Json(new { success = _rel })); } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { success = _rel })); }
string Export_Billing(string p_case_code) { try { Billing_BL _obj_bl = new Billing_BL(); SearchObject_Header_Info SearchObject_Header_Info = new SearchObject_Header_Info(); List <Billing_Detail_Info> _lst_billing_detail = new List <Billing_Detail_Info>(); Billing_Header_Info _Billing_Header_Info = _obj_bl.Billing_Search_GetBy_Code(p_case_code, AppsCommon.GetCurrentLang(), ref SearchObject_Header_Info, ref _lst_billing_detail); foreach (Billing_Detail_Info item in _lst_billing_detail) { item.Total_Fee = item.Nation_Fee + item.Represent_Fee + item.Service_Fee; } string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Biling_Search_Report.doc"); //if (_ApplicationHeaderInfo.Customer_Country != Common.Common.Country_VietNam_Id) // _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Biling_Report_EN.doc"); DocumentModel document = DocumentModel.Load(_fileTemp); // Fill export_header string fileName_exp = "/Content/Export/" + "Biling_Search_Report" + p_case_code + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"; string fileName_exp_doc = "/Content/Export/" + "Biling_Search_Report" + p_case_code + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc"; string fileName = System.Web.HttpContext.Current.Server.MapPath(fileName_exp); string fileName_doc = System.Web.HttpContext.Current.Server.MapPath(fileName_exp_doc); document.MailMerge.FieldMerging += (sender, e) => { if (e.IsValueFound) { if (e.FieldName == "Text") { ((Run)e.Inline).Text = e.Value.ToString(); } } }; document.MailMerge.Execute(new { DateNo = DateTime.Now.ToString("dd-MM-yyyy") }); document.MailMerge.Execute(new { Case_Name = SearchObject_Header_Info.CASE_NAME }); document.MailMerge.Execute(new { Client_Reference = SearchObject_Header_Info.CLIENT_REFERENCE }); document.MailMerge.Execute(new { Case_Code = SearchObject_Header_Info.CASE_CODE }); document.MailMerge.Execute(new { Master_Name = SearchObject_Header_Info.Customer_Name }); //document.MailMerge.Execute(new { App_No = SearchObject_Header_Info.App_No }); document.MailMerge.Execute(new { Customer_Country_Name = SearchObject_Header_Info.Customer_Country_Name }); document.MailMerge.Execute(new { Bill_Code = _Billing_Header_Info.Case_Code }); document.MailMerge.Execute(new { Total_Amount = _Billing_Header_Info.Total_Amount.ToString("#,##0.##") }); document.MailMerge.Execute(new { Total_Pre_Tex = _Billing_Header_Info.Total_Pre_Tex.ToString("#,##0.##") }); document.MailMerge.Execute(new { Tex_Fee = _Billing_Header_Info.Tex_Fee.ToString("#,##0.##") }); document.MailMerge.Execute(new { Currency = _Billing_Header_Info.Currency }); document.MailMerge.Execute(new { Deadline = _Billing_Header_Info.Deadline.ToString("dd/MM/yyyy") }); document.MailMerge.Execute(new { Billing_Date = _Billing_Header_Info.Billing_Date.ToString("dd/MM/yyyy") }); // lấy thông tin người dùng UserBL _UserBL = new UserBL(); UserInfo userInfo = _UserBL.GetUserByUsername(SearchObject_Header_Info.CREATED_BY); if (userInfo != null) { document.MailMerge.Execute(new { Contact_Person = userInfo.Contact_Person + " " + userInfo.FullName }); 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 = "" }); } DataTable dtDetail = new DataTable(); dtDetail = ConvertData.ConvertToDatatable <Billing_Detail_Info>(_lst_billing_detail); document.MailMerge.Execute(dtDetail, "TEMP"); document.Save(fileName, SaveOptions.PdfDefault); //document.Save(fileName_doc, SaveOptions.DocxDefault); 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); return(fileName_exp); } catch (Exception ex) { Logger.LogException(ex); return(""); } }