/// <summary> /// Register new project data /// </summary> /// <param name="Cond"></param> /// <returns></returns> public string RegisterData(doRegisterProjectData Cond) { using (TransactionScope scope = new TransactionScope()) { try { ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IProjectHandler hand = ServiceContainer.GetService <IProjectHandler>() as IProjectHandler; string ProjectCode = hand.GenerateProjectCode(); #region prepare_do Cond.doTbt_Project.ProjectCode = ProjectCode; Cond.doTbt_Project.ProjectStatus = ProjectStatus.C_PROJECT_STATUS_PROCESSING; if (Cond.doTbt_ProjectExpectedInstrumentDetail != null) { foreach (tbt_ProjectExpectedInstrumentDetails i in Cond.doTbt_ProjectExpectedInstrumentDetail) { i.ProjectCode = ProjectCode; } } if (Cond.doTbt_ProjectOtherRalatedCompany != null) { foreach (tbt_ProjectOtherRalatedCompany i in Cond.doTbt_ProjectOtherRalatedCompany) { i.ProjectCode = ProjectCode; } } //============================================================================================================================ if (Cond.doTbt_ProjectPurchaserCustomer != null) { if (!CommonUtil.IsNullOrEmpty(Cond.doTbt_ProjectPurchaserCustomer.CustCode)) { string CustCode = Cond.doTbt_ProjectPurchaserCustomer.CustCode; Cond.doTbt_ProjectPurchaserCustomer = null; Cond.doTbt_ProjectPurchaserCustomer = new tbt_ProjectPurchaserCustomer(); Cond.doTbt_ProjectPurchaserCustomer.CustCode = CustCode; } Cond.doTbt_ProjectPurchaserCustomer.ProjectCode = ProjectCode; } if (Cond.doTbt_ProjectSupportStaffDetails != null) { foreach (tbt_ProjectSupportStaffDetails i in Cond.doTbt_ProjectSupportStaffDetails) { i.ProjectCode = ProjectCode; } } if (Cond.doTbt_ProjectSystemDetails != null) { foreach (tbt_ProjectSystemDetails i in Cond.doTbt_ProjectSystemDetails) { i.ProjectCode = ProjectCode; } } #endregion if (Cond.doTbt_Project.OverallBudgetAmountCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { Cond.doTbt_Project.OverallBudgetAmountUsd = Cond.doTbt_Project.OverallBudgetAmount; Cond.doTbt_Project.OverallBudgetAmount = null; } else { Cond.doTbt_Project.OverallBudgetAmountUsd = null; } if (Cond.doTbt_Project.ReceivedBudgetAmountCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { Cond.doTbt_Project.ReceivedBudgetAmountUsd = Cond.doTbt_Project.ReceivedBudgetAmount; Cond.doTbt_Project.ReceivedBudgetAmount = null; } else { Cond.doTbt_Project.ReceivedBudgetAmountUsd = null; } hand.CreateProjectData(Cond); ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; //comHand.UpdateFlagAttachFile(AttachmentModule.Project, Session.SessionID, ProjectCode); //================= Update Attach ====================== string temp = Path.Combine(comHand.GetTemporaryAttachFilePath(), GetCurrentKey()); if (Directory.Exists(temp)) { chandler.UpdateFlagAttachFile(AttachmentModule.Project, GetCurrentKey(), ProjectCode); } //====================================================== scope.Complete(); return(ProjectCode); } catch (Exception) { throw; } } }