public ActionResult Edit_C01(ApplicationHeaderInfo pInfo, App_Detail_C01_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppDocumentOthersInfo> pLstImagePublic) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); App_Detail_C01_BL objDetail = new App_Detail_C01_BL(); AppDocumentBL objDoc = new AppDocumentBL(); if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; bool _IsOk = false; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = CreatedBy; pInfo.Modify_Date = CreatedDate; pInfo.Send_Date = DateTime.Now; pInfo.DDSHCN = ""; pInfo.MADDSHCN = ""; //TRA RA ID CUA BANG KHI INSERT pReturn = objBL.AppHeaderUpdate(pInfo); if (pReturn < 0) { goto Commit_Transaction; } // detail if (pReturn >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.Language_Code = language; pDetail.App_Header_Id = pInfo.Id; pDetail.Case_Code = pInfo.Case_Code; pReturn = objDetail.Update(pDetail); if (pReturn <= 0) { goto Commit_Transaction; } } #region hình công bố if (pReturn >= 0 && pLstImagePublic != null) { if (pLstImagePublic.Count > 0) { AppImageBL _AppImageBL = new AppImageBL(); List <AppDocumentOthersInfo> Lst_ImagePublic_Old = _AppImageBL.GetByAppHeader(pInfo.Id, language); Dictionary <decimal, AppDocumentOthersInfo> _dic_image = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_ImagePublic_Old) { _dic_image[item.Id] = item; } // xóa đi trước insert lại sau _AppImageBL.AppImageDeletedByApp(pInfo.Id, language); int check = 0; foreach (AppDocumentOthersInfo info in pLstImagePublic) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_image.ContainsKey(info.Id)) { info.Filename = _dic_image[info.Id].Filename; check = 1; } info.App_Header_Id = pInfo.Id; info.Language_Code = language; } if (check == 1) { pReturn = _AppImageBL.AppImageInsertBatch(pLstImagePublic); } } } #endregion #region Phí cố định // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pDetail.Case_Code, language); // insert lại fee List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C01(pDetail, pAppDocumentInfo, pLstImagePublic); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code); if (pReturn < 0) { goto Commit_Transaction; } } #endregion //tai lieu khac if (pReturn >= 0 && pAppDocOtherInfo != null) { List <AppDocumentOthersInfo> Lst_Doc_Others_Old = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language); Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old) { _dic_doc_others[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp(pInfo.Id, language); if (pAppDocOtherInfo.Count > 0) { int check = 0; foreach (var info in pAppDocOtherInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_doc_others.ContainsKey(info.Id)) { info.Filename = _dic_doc_others[info.Id].Filename; check = 1; } info.App_Header_Id = pInfo.Id; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo); } } } #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language); foreach (var info in pAppDocumentInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pInfo.Id; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = _AppDocumentBL.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id); } } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); return(Json(new { status = pReturn })); } else { scope.Complete(); _IsOk = true; } } // tự động update todo if (pInfo.UpdateToDo == 1 && _IsOk == true) { if (pInfo.Status == (int)CommonEnums.App_Status.ChoKHConfirm) { Application_Header_BL _obj_bl = new Application_Header_BL(); decimal _status = (decimal)CommonEnums.App_Status.KhacHangDaConfirm; string _note = "Xác nhận nộp đơn"; if (AppsCommon.GetCurrentLang() != "VI_VN") { _note = "confirmation for filing"; } int _ck = _obj_bl.AppHeader_Update_Status(pInfo.Case_Code, _status, _note, SessionData.CurrentUser.Username, DateTime.Now, AppsCommon.GetCurrentLang()); } } return(Json(new { status = pInfo.Id })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Translate_PLB_01_SDD(ApplicationHeaderInfo pInfo, App_Detail_PLB01_SDD_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); App_Detail_PLB01_SDD_BL objDetail = new App_Detail_PLB01_SDD_BL(); AppDocumentBL objDoc = new AppDocumentBL(); if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = ""; if (pInfo.Languague_Code == Language.LangVI) { language = Language.LangEN; } else { language = Language.LangVI; } var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; int pAppHeaderID = 0; string prefCaseCode = ""; decimal pIDHeaderRootLang = pInfo.Id; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "") { pInfo.Created_By = CreatedBy; } pInfo.Created_Date = CreatedDate; pInfo.Send_Date = DateTime.Now; //pInfo.Status = (decimal)CommonEnums.App_Status.DaGui_ChoPhanLoai; //TRA RA ID CUA BANG KHI INSERT //kiểm tra có rồi thì update, chưa có thì insert if (pInfo.Id_Vi > 0) { pInfo.Modify_By = CreatedBy; pInfo.Modify_Date = CreatedDate; pAppHeaderID = objBL.AppHeaderUpdate(pInfo); } else { //TRA RA ID CUA BANG KHI INSERT pInfo.Created_By = CreatedBy; pInfo.Created_Date = CreatedDate; pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref prefCaseCode); } if (pAppHeaderID < 0) { goto Commit_Transaction; } // detail if (pAppHeaderID >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.Language_Code = language; pDetail.App_Header_Id = pAppHeaderID; pDetail.Case_Code = prefCaseCode; pReturn = objDetail.Insert(pDetail); if (pReturn <= 0) { goto Commit_Transaction; } } #region Phí cố định // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(prefCaseCode, language); // insert lại fee List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_3B(pDetail); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, prefCaseCode); if (pReturn < 0) { goto Commit_Transaction; } } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { pReturn = objDoc.AppDocumentTranslate(language, pIDHeaderRootLang, pAppHeaderID); } } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); } else { scope.Complete(); } } return(Json(new { status = pAppHeaderID })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Edit(ApplicationHeaderInfo pInfo, C07_Info pDetail, List<AppDocumentInfo> pAppDocumentInfo, List<AppFeeFixInfo> pFeeFixInfo, List<Other_MasterInfo> pOther_MasterInfo, List<AppDocumentOthersInfo> pAppDocOtherInfo, List<AppClassDetailInfo> pAppClassInfo) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); C07_BL objDetail = new C07_BL(); AppClassDetailBL objClassDetail = new AppClassDetailBL(); if (pInfo == null || pDetail == null) return Json(new { status = ErrorCode.Error }); string language = AppsCommon.GetCurrentLang(); decimal pReturn = ErrorCode.Success; int pAppHeaderID = (int)pInfo.Id; string p_case_code = pInfo.Case_Code; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = SessionData.CurrentUser.Username; pInfo.Modify_Date = SessionData.CurrentUser.CurrentDate; pInfo.Send_Date = DateTime.Now; pInfo.DDSHCN = ""; pInfo.MADDSHCN = ""; //TRA RA ID CUA BANG KHI INSERT pReturn = objBL.AppHeaderUpdate(pInfo); if (pReturn < 0) goto Commit_Transaction; // detail if (pAppHeaderID >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.Language_Code = language; pDetail.App_Header_Id = pAppHeaderID; pDetail.Case_Code = p_case_code; if (pDetail.pfileLogo != null) { pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo); } else { pDetail.LOGOURL = pDetail.IMG_URLOrg; } pReturn = objDetail.UpDate(pDetail); if (pReturn < 0) goto Commit_Transaction; #region Thêm thông tin class if (pReturn >= 0 && pAppClassInfo != null) { //Xoa cac class cu di pReturn = objClassDetail.AppClassDetailDeleted(pInfo.Id, language); if (pReturn < 0) goto Commit_Transaction; pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pInfo.Id, language); if (pReturn < 0) goto Commit_Transaction; } #endregion } // ok Other_Master_BL _Other_Master_BL = new Other_Master_BL(); _Other_Master_BL.Deleted(pInfo.Case_Code, language); if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0) { foreach (var item in pOther_MasterInfo) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pAppHeaderID; } decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo); if (_re <= 0) goto Commit_Transaction; } //tai lieu khac #region Tài liệu khác AppDocumentBL objDoc = new AppDocumentBL(); List<AppDocumentOthersInfo> Lst_Doc_Others = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language); List<AppDocumentOthersInfo> Lst_Doc_Others_Old = Lst_Doc_Others.FindAll(m => m.FILETYPE == 1).ToList(); Dictionary<decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary<decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old) { _dic_doc_others[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 1); if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0) { int check = 0; foreach (var info in pAppDocOtherInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_doc_others.ContainsKey(info.Id)) { info.Filename = _dic_doc_others[info.Id].Filename; check = 1; } info.App_Header_Id = pAppHeaderID; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo); } } #endregion #region tính phí // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language); List<AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C07(pDetail, pAppClassInfo); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code); if (pReturn < 0) goto Commit_Transaction; } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null && pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List<AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language); Dictionary<string, AppDocumentInfo> dic_appDoc = new Dictionary<string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language); foreach (var info in pAppDocumentInfo) { info.App_Header_Id = pDetail.App_Header_Id; if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload]; if (_updateitem.GetType() == typeof(string)) { string _url = (string)_updateitem; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pAppHeaderID; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID); } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); return Json(new { status = -1 }); } else { scope.Complete(); } } return Json(new { status = pAppHeaderID }); } catch (Exception ex) { Logger.LogException(ex); return Json(new { status = ErrorCode.Error }); } }
public ActionResult Edit_TM06DKQT(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo) { try { pDetail.Id = pInfo.Id; pDetail.APP_HEADER_ID = pInfo.Id; pDetail.LANGUAGE_CODE = pInfo.Languague_Code; Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); AppDetail06DKQT_BL objDetail = new AppDetail06DKQT_BL(); AppDocumentBL objDoc = new AppDocumentBL(); AppClassDetailBL objClassDetail = new AppClassDetailBL(); bool _IsOk = false; if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; List <AppFeeFixInfo> pFeeFixInfo = CommonFunction.Call_Fee.CallFee_C06(pDetail); pDetail.LEPHI = (pFeeFixInfo[0] as AppFeeFixInfo).Amount; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = SessionData.CurrentUser.Username; pInfo.Modify_Date = SessionData.CurrentUser.CurrentDate; pInfo.Send_Date = DateTime.Now; pInfo.DDSHCN = ""; pInfo.MADDSHCN = ""; pInfo.Master_Type = ""; if (pDetail.pfileLogo != null) { pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo); } //TRA RA ID CUA BANG KHI INSERT int _re = objBL.AppHeaderUpdate(pInfo); // detail if (_re >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.LANGUAGE_CODE = language; pDetail.APP_HEADER_ID = pInfo.Id; pReturn = objDetail.App_Detail_06TMDKQT_Update(pDetail); } #region Phí cố định // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language); // insert lại fee pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, pInfo.Case_Code); if (pReturn < 0) { Transaction.Current.Rollback(); return(Json(new { status = -1 })); } #endregion //tai lieu khac #region Tài liệu khác objDoc = new AppDocumentBL(); List <AppDocumentOthersInfo> Lst_Doc_Others = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language); List <AppDocumentOthersInfo> Lst_Doc_Others_Old = Lst_Doc_Others.FindAll(m => m.FILETYPE == 1).ToList(); Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old) { _dic_doc_others[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 1); if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0) { int check = 0; foreach (var info in pAppDocOtherInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_doc_others.ContainsKey(info.Id)) { info.Filename = _dic_doc_others[info.Id].Filename; check = 1; } info.App_Header_Id = pInfo.Id; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo); } } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.APP_HEADER_ID, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.APP_HEADER_ID, language); foreach (var info in pAppDocumentInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pInfo.Id; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id); } } #endregion #region Thêm thông tin class if (pReturn >= 0 && pAppClassInfo != null) { //Xoa cac class cu di pReturn = objClassDetail.AppClassDetailDeleted(pInfo.Id, language); pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pInfo.Id, language); } //end #endregion if (pReturn < 0) { Transaction.Current.Rollback(); return(Json(new { status = -1 })); } else { scope.Complete(); _IsOk = true; } } // tự động update todo return(Json(new { status = pInfo.Id })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Edit_PLB_02_CGD(ApplicationHeaderInfo pInfo, App_Detail_PLB02_CGD_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); App_Detail_Plb02_CGD_BL objDetail = new App_Detail_Plb02_CGD_BL(); AppDocumentBL objDoc = new AppDocumentBL(); if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; bool _IsOk = false; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = CreatedBy; pInfo.Modify_Date = CreatedDate; pInfo.Send_Date = DateTime.Now; //TRA RA ID CUA BANG KHI INSERT int _re = objBL.AppHeaderUpdate(pInfo); // detail if (_re >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.Language_Code = language; pDetail.App_Header_Id = pInfo.Id; pDetail.Case_Code = pInfo.Case_Code; pReturn = objDetail.Update(pDetail); if (pReturn <= 0) { goto Commit_Transaction; } } else { goto Commit_Transaction; } #region Phí cố định #region Phí thẩm định yêu cầu sửa đổi đơn List <AppFeeFixInfo> _lstFeeFix = new List <AppFeeFixInfo>(); AppFeeFixInfo _AppFeeFixInfo1 = new AppFeeFixInfo(); _AppFeeFixInfo1.Fee_Id = 1; _AppFeeFixInfo1.Isuse = 1; //_AppFeeFixInfo1.App_Header_Id = pInfo.Id; _AppFeeFixInfo1.Number_Of_Patent = pDetail.Transfer_Appno.Split(',').Length; string _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo1.Fee_Id.ToString(); if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee)) { _AppFeeFixInfo1.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo1.Number_Of_Patent; } else { _AppFeeFixInfo1.Amount = 160000 * _AppFeeFixInfo1.Number_Of_Patent; } _lstFeeFix.Add(_AppFeeFixInfo1); #endregion #region Phí công bố thông tin đơn sửa đổi AppFeeFixInfo _AppFeeFixInfo2 = new AppFeeFixInfo(); _AppFeeFixInfo2.Fee_Id = 2; _AppFeeFixInfo2.Isuse = 1; //_AppFeeFixInfo2.App_Header_Id = pInfo.Id; _AppFeeFixInfo2.Number_Of_Patent = pDetail.Transfer_Appno.Split(',').Length; _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo2.Fee_Id.ToString(); if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee)) { _AppFeeFixInfo2.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo2.Number_Of_Patent; } else { _AppFeeFixInfo2.Amount = 160000 * _AppFeeFixInfo2.Number_Of_Patent; } _lstFeeFix.Add(_AppFeeFixInfo2); #endregion // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pDetail.Case_Code, language); // insert lại fee pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code); #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language); foreach (var info in pAppDocumentInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pInfo.Id; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id); } } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); } else { scope.Complete(); _IsOk = true; } } // tự động update todo if (pInfo.UpdateToDo == 1 && _IsOk == true) { if (pInfo.Status == (int)CommonEnums.App_Status.ChoKHConfirm) { Application_Header_BL _obj_bl = new Application_Header_BL(); decimal _status = (decimal)CommonEnums.App_Status.KhacHangDaConfirm; string _note = "Xác nhận nộp đơn"; if (AppsCommon.GetCurrentLang() != "VI_VN") { _note = "confirmation for filing"; } int _ck = _obj_bl.AppHeader_Update_Status(pInfo.Case_Code, _status, _note, SessionData.CurrentUser.Username, DateTime.Now, AppsCommon.GetCurrentLang()); } } return(Json(new { status = pInfo.Id })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Edit(ApplicationHeaderInfo pInfo, Pattent_Lao_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AuthorsInfo> pAppAuthorsInfo, List <Other_MasterInfo> pOther_MasterInfo, List <Inventor_Info> pInventor_Info, List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pLstImagePublic) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); Pattent_Lao_BL objDetail = new Pattent_Lao_BL(); if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = CreatedBy; pInfo.Modify_Date = CreatedDate; pInfo.Send_Date = DateTime.Now; //TRA RA ID CUA BANG KHI INSERT pReturn = objBL.AppHeaderUpdate(pInfo); if (pReturn < 0) { goto Commit_Transaction; } // detail if (pReturn >= 0) { pDetail.App_Header_Id = pInfo.Id; pReturn = objDetail.UpDate(pDetail); if (pReturn <= 0) { goto Commit_Transaction; } } Inventor_BL _Inventor_BL = new Inventor_BL(); _Inventor_BL.Deleted(pInfo.Case_Code, language); if (pInventor_Info != null && pInventor_Info.Count > 0) { foreach (var item in pInventor_Info) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pInfo.Id; } decimal _re = _Inventor_BL.Insert(pInventor_Info); if (_re <= 0) { goto Commit_Transaction; } } Other_Master_BL _Other_Master_BL = new Other_Master_BL(); _Other_Master_BL.Deleted(pInfo.Case_Code, language); if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0) { foreach (var item in pOther_MasterInfo) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pInfo.Id; } decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo); if (_re <= 0) { goto Commit_Transaction; } } // xóa đi trước insert lại sau Uu_Tien_BL _Uu_Tien_BL = new Uu_Tien_BL(); _Uu_Tien_BL.Deleted(pInfo.Case_Code, language); if (pUTienInfo != null && pUTienInfo.Count > 0) { foreach (var item in pUTienInfo) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pInfo.Id; } decimal _re = _Uu_Tien_BL.Insert(pUTienInfo); if (_re <= 0) { goto Commit_Transaction; } } //tai lieu khac if (pReturn >= 0 && pAppDocOtherInfo != null) { AppDocumentBL objDoc = new AppDocumentBL(); List <AppDocumentOthersInfo> Lst_Doc_Others_Old = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language); Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old) { _dic_doc_others[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp(pInfo.Id, language); if (pAppDocOtherInfo.Count > 0) { int check = 0; foreach (var info in pAppDocOtherInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_doc_others.ContainsKey(info.Id)) { info.Filename = _dic_doc_others[info.Id].Filename; check = 1; } info.App_Header_Id = pInfo.Id; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo); } } } // hình công bố if (pReturn >= 0 && pLstImagePublic != null) { if (pLstImagePublic.Count > 0) { AppImageBL _AppImageBL = new AppImageBL(); List <AppDocumentOthersInfo> Lst_ImagePublic_Old = _AppImageBL.GetByAppHeader(pInfo.Id, language); Dictionary <decimal, AppDocumentOthersInfo> _dic_image = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_ImagePublic_Old) { _dic_image[item.Id] = item; } // xóa đi trước insert lại sau _AppImageBL.AppImageDeletedByApp(pInfo.Id, language); int check = 0; foreach (AppDocumentOthersInfo info in pLstImagePublic) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_image.ContainsKey(info.Id)) { info.Filename = _dic_image[info.Id].Filename; check = 1; } info.App_Header_Id = pInfo.Id; info.Language_Code = language; } if (check == 1) { pReturn = _AppImageBL.AppImageInsertBatch(pLstImagePublic); } } } #region Phí cố định // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language); List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_PT_Lao(pDetail, pAppDocumentInfo, pUTienInfo, pLstImagePublic, pAppDocOtherInfo); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code); if (pReturn < 0) { goto Commit_Transaction; } } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language); foreach (var info in pAppDocumentInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pInfo.Id; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = _AppDocumentBL.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id); } } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); } else { scope.Complete(); } } return(Json(new { status = pReturn })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Edit(ApplicationHeaderInfo pInfo, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); if (pInfo == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); var CreatedBy = SessionData.CurrentUser.Username; var CreatedDate = SessionData.CurrentUser.CurrentDate; decimal pReturn = ErrorCode.Success; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = CreatedBy; pInfo.Modify_Date = CreatedDate; pInfo.Send_Date = DateTime.Now; //TRA RA ID CUA BANG KHI INSERT pReturn = objBL.AppHeaderUpdate(pInfo); if (pReturn < 0) { goto Commit_Transaction; } #region Phí cố định // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language); List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_E01(pInfo); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code); if (pReturn < 0) { goto Commit_Transaction; } } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null) { if (pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pInfo.Id, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pInfo.Id, language); foreach (var info in pAppDocumentInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pInfo.Id; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = _AppDocumentBL.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id); } } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); } else { scope.Complete(); } } return(Json(new { status = pReturn })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }
public ActionResult Edit(ApplicationHeaderInfo pInfo, A02_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AuthorsInfo> pAppAuthorsInfo, List <Other_MasterInfo> pOther_MasterInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppDocumentOthersInfo> pAppDocDesign) { try { Application_Header_BL objBL = new Application_Header_BL(); AppFeeFixBL objFeeFixBL = new AppFeeFixBL(); A02_BL objDetail = new A02_BL(); AppClassDetailBL objClassDetail = new AppClassDetailBL(); if (pInfo == null || pDetail == null) { return(Json(new { status = ErrorCode.Error })); } string language = AppsCommon.GetCurrentLang(); decimal pReturn = ErrorCode.Success; int pAppHeaderID = (int)pInfo.Id; string p_case_code = pInfo.Case_Code; using (var scope = new TransactionScope()) { // pInfo.Languague_Code = language; pInfo.Modify_By = SessionData.CurrentUser.Username; pInfo.Modify_Date = SessionData.CurrentUser.CurrentDate; pInfo.Send_Date = DateTime.Now; pInfo.DDSHCN = ""; pInfo.MADDSHCN = ""; //TRA RA ID CUA BANG KHI INSERT pReturn = objBL.AppHeaderUpdate(pInfo); if (pReturn < 0) { goto Commit_Transaction; } // detail if (pAppHeaderID >= 0) { pDetail.Appcode = pInfo.Appcode; pDetail.Language_Code = language; pDetail.App_Header_Id = pAppHeaderID; pDetail.Case_Code = p_case_code; pReturn = objDetail.UpDate(pDetail); if (pReturn <= 0) { goto Commit_Transaction; } } // ok Author_BL _Author_BL = new Author_BL(); _Author_BL.Deleted(pInfo.Case_Code, language); if (pAppAuthorsInfo != null && pAppAuthorsInfo.Count > 0) { foreach (var item in pAppAuthorsInfo) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pAppHeaderID; } decimal _re = _Author_BL.Insert(pAppAuthorsInfo); if (_re <= 0) { goto Commit_Transaction; } } // ok Other_Master_BL _Other_Master_BL = new Other_Master_BL(); _Other_Master_BL.Deleted(pInfo.Case_Code, language); if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0) { foreach (var item in pOther_MasterInfo) { item.Case_Code = pInfo.Case_Code; item.App_Header_Id = pAppHeaderID; } decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo); if (_re <= 0) { goto Commit_Transaction; } } // xóa đi trước insert lại sau -> ok Uu_Tien_BL _Uu_Tien_BL = new Uu_Tien_BL(); _Uu_Tien_BL.Deleted(pInfo.Case_Code, language); //tai lieu khac #region Tài liệu khác AppDocumentBL objDoc = new AppDocumentBL(); List <AppDocumentOthersInfo> Lst_Doc_Others = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language); List <AppDocumentOthersInfo> Lst_Doc_Others_Old = Lst_Doc_Others.FindAll(m => m.FILETYPE == 1).ToList(); Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old) { _dic_doc_others[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 1); if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0) { int check = 0; foreach (var info in pAppDocOtherInfo) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload]; info.Filename = _url; check = 1; } else if (_dic_doc_others.ContainsKey(info.Id)) { info.Filename = _dic_doc_others[info.Id].Filename; check = 1; } info.App_Header_Id = pAppHeaderID; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo); } } #endregion #region bộ tài liệu ảnh -> chưa sửa // chưa sửa List <AppDocumentOthersInfo> Lst_DocIndusDesign_Old = Lst_Doc_Others.FindAll(m => m.FILETYPE == 2).ToList(); Dictionary <decimal, AppDocumentOthersInfo> _dic_DocIndusDesign = new Dictionary <decimal, AppDocumentOthersInfo>(); foreach (AppDocumentOthersInfo item in Lst_DocIndusDesign_Old) { _dic_DocIndusDesign[item.Id] = item; } // xóa đi trước insert lại sau objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 2); if (pReturn >= 0 && pAppDocDesign != null && pAppDocDesign.Count > 0) { int check = 0; foreach (var info in pAppDocDesign) { if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload]; if (_updateitem.GetType() == typeof(AppDocumentInfo)) { HttpPostedFileBase pfiles = (_updateitem as AppDocumentInfo).pfiles; info.Filename = pfiles.FileName; info.Filename = AppLoadHelpers.convertToUnSign2(info.Filename); info.Filename = System.Text.RegularExpressions.Regex.Replace(info.Filename, "[^0-9A-Za-z.]+", "_"); info.Filename = "/Content/Archive/" + AppUpload.Document + "/" + pfiles.FileName; //info.IdRef = Convert.ToDecimal((_updateitem as AppDocumentInfo).refId); check = 1; } } else if (_dic_DocIndusDesign.ContainsKey(info.Id)) { info.Filename = _dic_DocIndusDesign[info.Id].Filename; //info.IdRef = _dic_doc_others[info.Id].IdRef; check = 1; } info.App_Header_Id = pAppHeaderID; info.Language_Code = language; } if (check == 1) { pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocDesign); } } #endregion #region tính phí // xóa đi AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL(); _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language); List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A02(pDetail, pAppDocumentInfo, pAppDocDesign); if (_lstFeeFix.Count > 0) { pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code); if (pReturn < 0) { goto Commit_Transaction; } } #endregion #region Tai lieu dinh kem if (pReturn >= 0 && pAppDocumentInfo != null && pAppDocumentInfo.Count > 0) { // Get ra để map sau đó xóa đi để insert vào sau AppDocumentBL _AppDocumentBL = new AppDocumentBL(); List <AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language); Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in Lst_AppDoc) { dic_appDoc[item.Document_Id] = item; } // xóa đi trước _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language); foreach (var info in pAppDocumentInfo) { info.App_Header_Id = pDetail.App_Header_Id; if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload)) { var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload]; if (_updateitem.GetType() == typeof(string)) { string _url = (string)_updateitem; string[] _arr = _url.Split('/'); string _filename = WebApps.Resources.Resource.FileDinhKem; if (_arr.Length > 0) { _filename = _arr[_arr.Length - 1]; } info.Filename = _filename; info.Url_Hardcopy = _url; info.Status = 0; } } else { if (dic_appDoc.ContainsKey(info.Document_Id)) { info.Filename = dic_appDoc[info.Document_Id].Filename; info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy; info.Status = dic_appDoc[info.Document_Id].Status; } } info.App_Header_Id = pAppHeaderID; info.Document_Filing_Date = CommonFuc.CurrentDate(); info.Language_Code = language; } pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID); } #endregion //end Commit_Transaction: if (pReturn < 0) { Transaction.Current.Rollback(); return(Json(new { status = -1 })); } else { scope.Complete(); } } return(Json(new { status = pAppHeaderID })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = ErrorCode.Error })); } }