예제 #1
0
        public ActionResult Register_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;
                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;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    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     = p_case_code;

                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        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;
                                }
                                info.App_Header_Id = pAppHeaderID;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                            }
                        }
                    }

                    #region hình công bố
                    if (pReturn >= 0 && pLstImagePublic != null)
                    {
                        if (pLstImagePublic.Count > 0)
                        {
                            int check = 0;
                            foreach (var info in pLstImagePublic)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    info.Filename = _url;
                                    check         = 1;
                                }
                                info.App_Header_Id = pAppHeaderID;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                AppImageBL _AppImageBL = new AppImageBL();
                                pReturn = _AppImageBL.AppImageInsertBatch(pLstImagePublic);
                            }
                        }
                    }
                    #endregion

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C01(pDetail, pAppDocumentInfo, pLstImagePublic);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        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;
                                }
                                info.App_Header_Id = pAppHeaderID;
                                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)
                        {
                            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);
                        }
                    }
                    #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 }));
            }
        }
예제 #2
0
        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 }));
            }
        }
예제 #3
0
        public ActionResult Register(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();
                AppDocumentBL objDoc = new AppDocumentBL();
                Other_Master_BL _Other_Master_BL = new Other_Master_BL();
                Author_BL _Author_BL = new Author_BL();
                AppClassDetailBL objClassDetail = new AppClassDetailBL();
                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;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    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 = p_case_code;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        pReturn = objDetail.Insert(pDetail);


                        if (pReturn < 0)
                            goto Commit_Transaction;
                        // thêm thông tin class
                        pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pAppHeaderID, language);
                        if (pReturn < 0)
                            goto Commit_Transaction;
                    }

                    if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0)
                    {
                        foreach (var item in pOther_MasterInfo)
                        {
                            item.Case_Code = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }

                        decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo);
                        if (_re <= 0)
                            goto Commit_Transaction;
                    }


                    //tai lieu khac 
                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        #region Tài liệu khác
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            string _keyfileupload = "";
                            if (info.keyFileUpload != null)
                            {
                                _keyfileupload = info.keyFileUpload;
                            }
                            if (SessionData.CurrentUser.chashFile.ContainsKey(_keyfileupload))
                            {
                                var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                if (_updateitem.GetType() == typeof(string))
                                {
                                    string _url = (string)_updateitem;
                                    info.Filename = _url;
                                    check = 1;
                                }


                            }
                            info.App_Header_Id = pAppHeaderID;
                            info.Language_Code = language;
                        }
                        if (check == 1)
                        {
                            pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                        }
                        #endregion
                    }



                    #region tính phí
                    List<AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C07(pDetail, pAppClassInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                            goto Commit_Transaction;
                    }
                    #endregion

                    #region Tai lieu dinh kem 
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                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;
                                    }
                                }
                                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 AppDonDangKyInsert(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo,
                                               List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo)
        {
            try
            {
                //List<AppFeeFixInfo> pFeeFixInfo
                Application_Header_BL objBL          = new Application_Header_BL();
                AppDetail06DKQT_BL    objDetailBL    = new AppDetail06DKQT_BL();
                AppClassDetailBL      objClassDetail = new AppClassDetailBL();
                AppDocumentBL         objDoc         = new AppDocumentBL();
                AppFeeFixBL           objFeeFixBL    = new AppFeeFixBL();
                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;
                int    pReturn      = ErrorCode.Success;
                int    pAppHeaderID = 0;
                string p_case_code  = "";


                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;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }
                    pInfo.Created_Date = CreatedDate;
                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    //Gán lại khi lấy dl
                    if (pAppHeaderID >= 0)
                    {
                        pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, p_case_code);
                    }
                    else
                    {
                        Transaction.Current.Rollback();
                    }
                    if (pReturn >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.LANGUAGE_CODE = language;
                        pDetail.APP_HEADER_ID = pAppHeaderID;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        pReturn = objDetailBL.App_Detail_06TMDKQT_Insert(pDetail);
                        //Thêm thông tin class
                        if (pReturn >= 0)
                        {
                            pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pAppHeaderID, language);
                        }
                    }
                    //Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        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);
                        }
                    }

                    //tai lieu khac
                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        #region Tài liệu khác
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            string _keyfileupload = "";
                            if (info.keyFileUpload != null)
                            {
                                _keyfileupload = info.keyFileUpload;
                            }
                            if (SessionData.CurrentUser.chashFile.ContainsKey(_keyfileupload))
                            {
                                var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                if (_updateitem.GetType() == typeof(string))
                                {
                                    string _url = (string)_updateitem;
                                    info.Filename = _url;
                                    check         = 1;
                                }
                            }
                            info.App_Header_Id = pAppHeaderID;
                            info.Language_Code = language;
                        }
                        if (check == 1)
                        {
                            pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                        }
                        #endregion
                    }
                    //end
                    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 DichDonDangKy(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo,
                                          List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL          = new Application_Header_BL();
                AppDetail06DKQT_BL    objDetailBL    = new AppDetail06DKQT_BL();
                AppClassDetailBL      objClassDetail = new AppClassDetailBL();
                AppDocumentBL         objDoc         = new AppDocumentBL();
                AppFeeFixBL           objFeeFixBL    = new AppFeeFixBL();
                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;
                int     pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                decimal pIDHeaderoot = pInfo.Id;
                string  prefCaseCode = "";
                foreach (AppFeeFixInfo item in pFeeFixInfo)
                {
                    if (item.Amount == 0)
                    {
                        // fix là 2 củ
                        item.Amount = 2000000;
                    }
                }

                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;
                    }

                    //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);
                    }


                    //Gán lại khi lấy dl
                    if (pAppHeaderID >= 0)
                    {
                        pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, prefCaseCode);
                    }
                    else
                    {
                        Transaction.Current.Rollback();
                    }
                    if (pReturn >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.LANGUAGE_CODE = language;
                        pDetail.APP_HEADER_ID = pAppHeaderID;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        pReturn = objDetailBL.App_Detail_06TMDKQT_Insert(pDetail);
                        //Thêm thông tin class
                        if (pReturn >= 0)
                        {
                            pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pAppHeaderID, language);
                        }
                    }
                    //Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            pReturn = objDoc.AppDocumentTranslate(language, pIDHeaderoot, pAppHeaderID);
                        }
                    }
                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        if (pAppDocOtherInfo.Count > 0)
                        {
                            var listDocument = new List <AppDocumentOthersInfo>();
                            int check        = 0;
                            foreach (var info in pAppDocOtherInfo)
                            {
                                if (!string.IsNullOrEmpty(info.Documentname))
                                {
                                    check = 1;
                                    info.App_Header_Id = pInfo.Id;
                                    info.Language_Code = language;
                                    info.IdRef         = Convert.ToDecimal(info.keyFileUpload);
                                    listDocument.Add(info);
                                }
                            }
                            if (check == 1)
                            {
                                if (pInfo.Id_Vi > 0)
                                {
                                    pReturn = objDoc.AppDocumentOtherDeletedByApp(pInfo.Id_Vi, language);
                                }
                                pReturn = objDoc.AppDocumentOtherInsertBatch(listDocument);
                            }
                        }
                    }
                    //end
                    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 }));
            }
        }
예제 #6
0
        public ActionResult Translate_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_BL = new App_Detail_Plb02_CGD_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 = "";
                pInfo.Languague_Code = language;
                decimal pIDHeaderoot = 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
                    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

                    #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 = pAppHeaderID;
                    _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 = pAppHeaderID;
                    _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

                    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 }));
            }
        }
예제 #7
0
        public ActionResult Register_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_BL = 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;
                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 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 = pAppHeaderID;
                    _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 = pAppHeaderID;
                    _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

                    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 }));
            }
        }
예제 #8
0
        public ActionResult Register(ApplicationHeaderInfo pInfo,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                AppDocumentBL         objDoc      = new AppDocumentBL();
                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;

                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_E01(pInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        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);
                        }
                    }
                    #endregion

Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
            }

            catch (Exception ex)
            {
            }
            return(Json(new { status = 1 }));
        }
예제 #9
0
        public ActionResult Register(ApplicationHeaderInfo pInfo, B03_Info pDetail,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                B03_BL        objDetail           = new B03_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;

                    // lấy dữ liệu được fill lên từ A01
                    // get dữ liệu A01 qua code
                    string casecode = pDetail.App_Detail_Number;
                    ApplicationHeaderInfo _applicationheaderinfo = objBL.GetApp_By_Case_Code(casecode);



                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    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;
                        // thiếu thông tin chủ đơn
                        // thiếu mã đơn

                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_B03(pDetail, pAppDocumentInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        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);
                        }
                    }
                    #endregion


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 }));
            }
        }
예제 #10
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 }));
            }
        }
예제 #11
0
        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 }));
            }
        }
예제 #12
0
        public ActionResult Register(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();
                AppDocumentBL    objDoc           = new AppDocumentBL();
                Other_Master_BL  _Other_Master_BL = new Other_Master_BL();
                Author_BL        _Author_BL       = new Author_BL();
                AppClassDetailBL objClassDetail   = new AppClassDetailBL();
                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;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    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     = p_case_code;
                        pReturn = objDetail.Insert(pDetail);


                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    if (pAppAuthorsInfo != null && pAppAuthorsInfo.Count > 0)
                    {
                        foreach (var item in pAppAuthorsInfo)
                        {
                            item.Case_Code     = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }
                        decimal _re = _Author_BL.Insert(pAppAuthorsInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0)
                    {
                        foreach (var item in pOther_MasterInfo)
                        {
                            item.Case_Code     = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }

                        decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }


                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        #region Tài liệu khác
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            string _keyfileupload = "";
                            if (info.keyFileUpload != null)
                            {
                                _keyfileupload = info.keyFileUpload;
                            }
                            if (SessionData.CurrentUser.chashFile.ContainsKey(_keyfileupload))
                            {
                                var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                if (_updateitem.GetType() == typeof(string))
                                {
                                    string _url = (string)_updateitem;
                                    info.Filename = _url;
                                    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
                    if (pReturn >= 0 && pAppDocDesign != null)
                    {
                        if (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;
                                    }
                                }
                                info.App_Header_Id = pAppHeaderID;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocDesign);
                            }
                        }
                    }
                    #endregion

                    #region tính phí
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A02(pDetail, pAppDocumentInfo, pAppDocDesign);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                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;
                                    }
                                }
                                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 }));
            }
        }