示例#1
0
        public App_Detail_PLD01_HDCN_Info GetByID(decimal p_app_header_id, string p_language_code,
                                                  ref ApplicationHeaderInfo applicationHeaderInfo,
                                                  ref List <AppDocumentInfo> appDocumentInfos, ref List <AppFeeFixInfo> appFeeFixInfos)
        {
            try
            {
                var     objData = new App_Detail_PLD01_HDCN_DA();
                DataSet dataSet = objData.GetByID(p_app_header_id, p_language_code);
                App_Detail_PLD01_HDCN_Info _App_Detail_PLB02_CGD_Info = CBO <App_Detail_PLD01_HDCN_Info> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 4)
                {
                    applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]);

                    appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]);

                    appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]);
                }

                return(_App_Detail_PLB02_CGD_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new App_Detail_PLD01_HDCN_Info());
            }
        }
        public ActionResult ExportData_IU(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail,
                                          List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();

                // Fill export_header
                string fileName_docx = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VI_" + TradeMarkAppCode.AppCode_TM_4C2_PLD_01_HDCN + ".docx");

                AppsCommon.Prepare_Data_Export_D01(ref pDetail, pInfo, pAppDocumentInfo, pFeeFixInfo);

                List <App_Detail_PLD01_HDCN_Info> _lst = new List <App_Detail_PLD01_HDCN_Info>();
                _lst.Add(pDetail);

                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLD01_HDCN_Info>(_lst, false);
                _ds_all.Tables[0].TableName = "Table_4c2";

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile    = "TM_PLD01_HDCN.rpt";
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                if (language == Language.LangVI)
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf";
                }
                else
                {
                    _tempfile    = "TM_PLD01_HDCN_EN.rpt"; // tiếng anh
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf";
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));
                //oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), "TM_PLD01_HDCN.rpt"));

                if (_ds_all != null)
                {
                    oRpt.SetDataSource(_ds_all);
                }
                oRpt.Refresh();

                Response.Buffer = false;
                Response.ClearContent();
                Response.ClearHeaders();

                System.IO.Stream oStream   = oRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[]           byteArray = new byte[oStream.Length];
                oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
                System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq

                return(Json(new { success = 0 }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = 0 }));
            }
        }
示例#3
0
        public int UpDate(App_Detail_PLD01_HDCN_Info pInfo)
        {
            try
            {
                var paramReturn = new OracleParameter("p_return", OracleDbType.Int32, ParameterDirection.Output);
                OracleHelper.ExecuteNonQuery(Configuration.connectionString, CommandType.StoredProcedure, "pkg_app_detail_pld01_hdcn.Proc_Update",
                                             new OracleParameter("p_app_header_id", OracleDbType.Decimal, pInfo.App_Header_Id, ParameterDirection.Input),
                                             new OracleParameter("p_appcode", OracleDbType.Varchar2, pInfo.Appcode, ParameterDirection.Input),
                                             new OracleParameter("p_language_code", OracleDbType.Varchar2, pInfo.Language_Code, ParameterDirection.Input),

                                             new OracleParameter("p_master_type", OracleDbType.Decimal, pInfo.Master_Type, ParameterDirection.Input),
                                             new OracleParameter("p_second_name", OracleDbType.Varchar2, pInfo.Second_Name, ParameterDirection.Input),
                                             new OracleParameter("p_second_address", OracleDbType.Varchar2, pInfo.Second_Address, ParameterDirection.Input),
                                             new OracleParameter("p_second_phone", OracleDbType.Varchar2, pInfo.Second_Phone, ParameterDirection.Input),
                                             new OracleParameter("p_second_fax", OracleDbType.Varchar2, pInfo.Second_Fax, ParameterDirection.Input),
                                             new OracleParameter("p_second_email", OracleDbType.Varchar2, pInfo.Second_Email, ParameterDirection.Input),
                                             new OracleParameter("p_customer_code", OracleDbType.Varchar2, pInfo.Customer_Code, ParameterDirection.Input),

                                             new OracleParameter("p_object_contract_type", OracleDbType.Decimal, pInfo.Object_Contract_Type, ParameterDirection.Input),
                                             new OracleParameter("p_object_contract_no", OracleDbType.Varchar2, pInfo.Object_Contract_No, ParameterDirection.Input),
                                             paramReturn);
                var result = Convert.ToInt32(paramReturn.Value.ToString());
                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(ErrorCode.Error);
            }
        }
示例#4
0
 public int Update(App_Detail_PLD01_HDCN_Info pInfo)
 {
     try
     {
         App_Detail_PLD01_HDCN_DA objData = new App_Detail_PLD01_HDCN_DA();
         return(objData.UpDate(pInfo));
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(ErrorCode.Error);
     }
 }
示例#5
0
 public decimal Insert(App_Detail_PLD01_HDCN_Info pInfo)
 {
     try
     {
         App_Detail_PLD01_HDCN_DA objData = new App_Detail_PLD01_HDCN_DA();
         return(objData.Insert(pInfo));
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(ErrorCode.Error);
     }
 }
        public ActionResult GetFee(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_D01(pDetail, pFeeFixInfo);
                ViewBag.LstFeeFix = _lstFeeFix;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            var PartialTableListFees = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Patent/Views/Shared/_PartialTableListFees.cshtml");
            var json = Json(new { success = 1, PartialTableListFees });

            return(json);
        }
        public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();
                ApplicationHeaderInfo      applicationHeaderInfo = new ApplicationHeaderInfo();
                App_Detail_PLD01_HDCN_Info app_Detail            = new App_Detail_PLD01_HDCN_Info();
                List <AppFeeFixInfo>       appFeeFixInfos        = new List <AppFeeFixInfo>();
                List <AppDocumentInfo>     appDocumentInfos      = new List <AppDocumentInfo>();

                App_Detail_PLD01_HDCN_BL objBL = new App_Detail_PLD01_HDCN_BL();
                app_Detail = objBL.GetByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref appFeeFixInfos);

                string        _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/AppForms/D01_VI.docx");
                DocumentModel document  = DocumentModel.Load(_fileTemp);

                AppsCommon.Prepare_Data_Export_D01(ref app_Detail, applicationHeaderInfo, appDocumentInfos, appFeeFixInfos);

                List <App_Detail_PLD01_HDCN_Info> _lst = new List <App_Detail_PLD01_HDCN_Info>();
                _lst.Add(app_Detail);

                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLD01_HDCN_Info>(_lst, false);
                _ds_all.Tables[0].TableName = "Table_4c2";
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string _tempfile    = "TM_PLD01_HDCN.rpt";
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                if (p_View_Translate == 1)
                {
                    // nếu là tiếng việt thì xem bản tiếng anh và ngược lại
                    if (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        _tempfile    = "TM_PLD01_HDCN_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf";
                    }
                }
                else
                {
                    if (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        _tempfile    = "TM_PLD01_HDCN_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf";
                    }
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));
                if (_ds_all != null)
                {
                    oRpt.SetDataSource(_ds_all);
                }
                oRpt.Refresh();

                Response.Buffer = false;
                Response.ClearContent();
                Response.ClearHeaders();

                System.IO.Stream oStream   = oRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[]           byteArray = new byte[oStream.Length];
                oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
                System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq

                return(Json(new { success = 0 }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = 0 }));
            }
        }
        public ActionResult Translate_PLD01_HDCN_4C2(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail,
                                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL    objBL        = new Application_Header_BL();
                AppFeeFixBL              objFeeFixBL  = new AppFeeFixBL();
                App_Detail_PLD01_HDCN_BL objDetail_BL = new App_Detail_PLD01_HDCN_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;
                decimal pIDHeaderoot = pInfo.Id;
                string  prefCaseCode = "";
                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;

                    //TRA RA ID CUA BANG KHI 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);
                    }


                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code     = prefCaseCode;
                        pReturn = objDetail_BL.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix   = Call_Fee.CallFee_D01(pDetail, pFeeFixInfo);
                    AppFeeFixBL          _AppFeeFixBL = new AppFeeFixBL();
                    pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, prefCaseCode);
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            pReturn = objDoc.AppDocumentTranslate(language, pIDHeaderoot, pAppHeaderID);
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }
                    #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 Register_PLD01_HDCN_4C2(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail,
                                                    List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL    objBL        = new Application_Header_BL();
                AppFeeFixBL              objFeeFixBL  = new AppFeeFixBL();
                App_Detail_PLD01_HDCN_BL objDetail_BL = new App_Detail_PLD01_HDCN_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;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";

                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
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);

                    // 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_BL.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }

                    #region Phí cố định

                    #region Phí thẩm định hồ sơ đăng ký hợp đồng chuyển nhượng
                    List <AppFeeFixInfo> _lstFeeFix      = new List <AppFeeFixInfo>();
                    AppFeeFixInfo        _AppFeeFixInfo1 = new AppFeeFixInfo();
                    _AppFeeFixInfo1.Fee_Id = 1;
                    _AppFeeFixInfo1.Isuse  = 1;
                    //_AppFeeFixInfo1.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo1.Number_Of_Patent = pDetail.Object_Contract_No.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 = 230000 * _AppFeeFixInfo1.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo1);
                    #endregion

                    #region Phí tra cứu nhãn hiệu liên kết phục vụ việc thẩm định hồ sơ đăng ký hợp đồng chuyển nhượng
                    AppFeeFixInfo _AppFeeFixInfo2 = new AppFeeFixInfo();
                    _AppFeeFixInfo2.Fee_Id = 2;
                    _AppFeeFixInfo2.Isuse  = 1;
                    //_AppFeeFixInfo2.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo2.Number_Of_Patent = pDetail.Object_Contract_No.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 = 180000 * _AppFeeFixInfo2.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo2);
                    #endregion

                    #region Phí thẩm định đơn
                    AppFeeFixInfo _AppFeeFixInfo3 = new AppFeeFixInfo();
                    _AppFeeFixInfo3.Fee_Id = 3;
                    _AppFeeFixInfo3.Isuse  = pFeeFixInfo[0].Isuse;
                    //_AppFeeFixInfo3.App_Header_Id = pInfo.Id;
                    if (_AppFeeFixInfo3.Isuse == 1)
                    {
                        _AppFeeFixInfo3.Number_Of_Patent = 1;
                    }
                    else
                    {
                        _AppFeeFixInfo3.Number_Of_Patent = 0;
                    }

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo3.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo3.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo3.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo3.Amount = 180000 * _AppFeeFixInfo3.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo3);
                    #endregion

                    #region Lệ phí cấp Giấy chứng nhận đăng ký nhãn hiệu
                    AppFeeFixInfo _AppFeeFixInfo4 = new AppFeeFixInfo();
                    _AppFeeFixInfo4.Fee_Id = 4;
                    _AppFeeFixInfo4.Isuse  = pFeeFixInfo[1].Isuse;
                    //_AppFeeFixInfo4.App_Header_Id = pInfo.Id;
                    if (_AppFeeFixInfo4.Isuse == 1)
                    {
                        _AppFeeFixInfo4.Number_Of_Patent = 1;
                    }
                    else
                    {
                        _AppFeeFixInfo4.Number_Of_Patent = 0;
                    }

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo4.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo4.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo4.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo4.Amount = 120000 * _AppFeeFixInfo4.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo4);
                    #endregion

                    #region Phí đăng bạ quyết định ghi nhận chuyển nhượng quyền SHCN
                    AppFeeFixInfo _AppFeeFixInfo5 = new AppFeeFixInfo();
                    _AppFeeFixInfo5.Fee_Id = 5;
                    _AppFeeFixInfo5.Isuse  = 1;
                    //_AppFeeFixInfo5.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo5.Number_Of_Patent = pDetail.Object_Contract_No.Split(';').Length;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo5.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo5.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo5.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo5.Amount = 120000 * _AppFeeFixInfo5.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo5);
                    #endregion

                    #region Phí công bố quyết định ghi nhận chuyển nhượng quyền SHCN
                    AppFeeFixInfo _AppFeeFixInfo6 = new AppFeeFixInfo();
                    _AppFeeFixInfo6.Fee_Id = 6;
                    _AppFeeFixInfo6.Isuse  = 1;
                    //_AppFeeFixInfo6.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo6.Number_Of_Patent = 1;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo6.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo6.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo6.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo6.Amount = 120000 * _AppFeeFixInfo6.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo6);
                    #endregion

                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            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;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }
                    #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_PLD01_HDCN_4C2(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail,
                                                List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL    objBL       = new Application_Header_BL();
                AppFeeFixBL              objFeeFixBL = new AppFeeFixBL();
                App_Detail_PLD01_HDCN_BL objDetail   = new App_Detail_PLD01_HDCN_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 hồ sơ đăng ký hợp đồng chuyển nhượng
                    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.Object_Contract_No.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 = 230000 * _AppFeeFixInfo1.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo1);
                    #endregion

                    #region Phí tra cứu nhãn hiệu liên kết phục vụ việc thẩm định hồ sơ đăng ký hợp đồng chuyển nhượng
                    AppFeeFixInfo _AppFeeFixInfo2 = new AppFeeFixInfo();
                    _AppFeeFixInfo2.Fee_Id = 2;
                    _AppFeeFixInfo2.Isuse  = 1;
                    //_AppFeeFixInfo2.App_Header_Id = pInfo.Id;
                    _AppFeeFixInfo2.Number_Of_Patent = pDetail.Object_Contract_No.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 = 180000 * _AppFeeFixInfo2.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo2);
                    #endregion

                    #region Phí thẩm định đơn
                    AppFeeFixInfo _AppFeeFixInfo3 = new AppFeeFixInfo();
                    _AppFeeFixInfo3.Fee_Id = 3;
                    _AppFeeFixInfo3.Isuse  = pFeeFixInfo[0].Isuse;
                    if (_AppFeeFixInfo3.Isuse == 1)
                    {
                        _AppFeeFixInfo3.Number_Of_Patent = 1;
                    }
                    else
                    {
                        _AppFeeFixInfo3.Number_Of_Patent = 0;
                    }
                    //_AppFeeFixInfo3.App_Header_Id = pInfo.Id;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo3.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo3.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo3.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo3.Amount = 180000 * _AppFeeFixInfo3.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo3);
                    #endregion

                    #region Lệ phí cấp Giấy chứng nhận đăng ký nhãn hiệu
                    AppFeeFixInfo _AppFeeFixInfo4 = new AppFeeFixInfo();
                    _AppFeeFixInfo4.Fee_Id = 4;
                    _AppFeeFixInfo4.Isuse  = pFeeFixInfo[1].Isuse;
                    //_AppFeeFixInfo4.App_Header_Id = pInfo.Id;
                    if (_AppFeeFixInfo4.Isuse == 1)
                    {
                        _AppFeeFixInfo4.Number_Of_Patent = 1;
                    }
                    else
                    {
                        _AppFeeFixInfo4.Number_Of_Patent = 0;
                    }

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo4.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo4.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo4.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo4.Amount = 120000 * _AppFeeFixInfo4.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo4);
                    #endregion

                    #region Phí đăng bạ quyết định ghi nhận chuyển nhượng quyền SHCN
                    AppFeeFixInfo _AppFeeFixInfo5 = new AppFeeFixInfo();
                    _AppFeeFixInfo5.Fee_Id = 5;
                    _AppFeeFixInfo5.Isuse  = 1;
                    //_AppFeeFixInfo5.App_Header_Id = pInfo.Id;
                    _AppFeeFixInfo5.Number_Of_Patent = pDetail.Object_Contract_No.Split(';').Length;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo5.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo5.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo5.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo5.Amount = 120000 * _AppFeeFixInfo5.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo5);
                    #endregion

                    #region Phí công bố quyết định ghi nhận chuyển nhượng quyền SHCN
                    AppFeeFixInfo _AppFeeFixInfo6 = new AppFeeFixInfo();
                    _AppFeeFixInfo6.Fee_Id = 6;
                    _AppFeeFixInfo6.Isuse  = 1;
                    //_AppFeeFixInfo6.App_Header_Id = pInfo.Id;
                    _AppFeeFixInfo6.Number_Of_Patent = 1;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo6.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo6.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo6.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo6.Amount = 120000 * _AppFeeFixInfo6.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo6);
                    #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 }));
            }
        }