/// <summary> /// Create QuoteActive的指令檔,quoteID必填,同時必須有對應的QuotationMaster資料 /// </summary> /// <param name="active"></param> /// <returns>true or false</returns> public static bool CreateQuoteActive(SiebelActive active) { if (string.IsNullOrEmpty(active.QuoteID)) { active.FailedLog = "eQuote ID is null"; return(false); } if (active.QuotationMaster == null) { active.FailedLog = "No QuotationMaster data!"; return(false); } active.ActiveSource = SiebelActiveSource.eQuotation.ToString(); active.ActiveType = SiebelActiveType.CreateActivity.ToString(); active.Status = SiebelActiveStatus.UnProcess.ToString(); active.CreatedDate = DateTime.Now; active.LastUpdatedDate = DateTime.Now; if (!SiebelDAL.CreateSiebelActive(active)) { return(false); //創建SiebelActive失敗,錯誤訊息紀錄在active.FailedLog內 } return(true); }
/// <summary> /// Update Opty的指令檔,quoteID必填,同時必須有對應的QuotationMaster資料 /// </summary> /// <param name="active"></param> /// <returns></returns> public static bool UpdateOpportunityCommand(SiebelActive active) { if (string.IsNullOrEmpty(active.OptyID) && string.IsNullOrEmpty(active.QuoteID)) { //eQuoteID有可能有null,因為有可能從MyAdvantech過來,所以改為QuoteID & OptyID 同時都是空時才報錯 active.FailedLog = "eQuote ID and Opportunity ID are all null"; return(false); } if (string.IsNullOrEmpty(active.OptyID) && active.QuotationMaster == null) { active.FailedLog = "No QuotationMaster data!"; return(false); } ////檢查 optyName (原本Business.vb的邏輯) //if (string.IsNullOrEmpty(active.OptyName)) //{ // if (active.QuotationMaster.Revision_Number != null && active.QuotationMaster.Revision_Number > 0) // { // active.OptyName = string.Format("{0}V{1}", active.SiebelOpty.optyName, active.QuotationMaster.Revision_Number); // } //} ////檢查Owner email (原本SiebelTools的邏輯) //if (string.IsNullOrEmpty(active.OptyOwnerEmail) && active.QuotationMaster != null) //{ // if (!string.IsNullOrEmpty(active.QuotationMaster.salesEmail)) // active.OptyOwnerEmail = active.QuotationMaster.salesEmail; // else if (!string.IsNullOrEmpty(active.QuotationMaster.createdBy)) // active.OptyOwnerEmail = active.QuotationMaster.createdBy; // else if (string.IsNullOrEmpty(active.QuotationMaster.attentionRowId)) // active.OptyOwnerEmail = active.QuotationMaster.attentionRowId; //} if (string.IsNullOrEmpty(active.ActiveSource)) { active.ActiveSource = SiebelActiveSource.eQuotation.ToString(); } if (string.IsNullOrEmpty(active.ActiveType)) { active.ActiveType = SiebelActiveType.UpdateOpportunity.ToString(); } if (string.IsNullOrEmpty(active.Status)) { active.Status = SiebelActiveStatus.UnProcess.ToString(); } active.CreatedDate = DateTime.Now; active.LastUpdatedDate = DateTime.Now; if (!SiebelDAL.CreateSiebelActive(active)) { return(false); //創建SiebelActive失敗,錯誤訊息紀錄在active.FailedLog內 } return(true); }
/// <summary> /// Create Opty的指令檔,quoteID必填,同時必須有對應的QuotationMaster資料 /// </summary> /// <param name="active"></param> /// <returns>true or false</returns> public static bool CreateOpportunityCommand(SiebelActive active) { if (string.IsNullOrEmpty(active.QuoteID)) { active.FailedLog = "eQuote ID is null"; return(false); } if (SiebelDAL.GetActiveListForCheck(SiebelActiveStatus.UnProcess, SiebelActiveType.CreateOpportunity, active.QuoteID, active.OptyName, 1).Count() > 0) { active.FailedLog = "Opportunity is already exists"; return(false); } if (active.QuotationMaster == null) { active.FailedLog = "No QuotationMaster data!"; return(false); } //2015/6/9 Add new rule to check opty owner email if (string.IsNullOrEmpty(active.OptyOwnerEmail)) { active.FailedLog = "No Opty owner email"; return(false); } //檢查 optyName (原本Business.vb的邏輯) if (string.IsNullOrEmpty(active.OptyName)) { if (active.QuotationMaster.Revision_Number != null && active.QuotationMaster.Revision_Number > 0) { active.OptyName = string.Format("{0}V{1}", active.SiebelOpty.optyName, active.QuotationMaster.Revision_Number); } } //檢查 optySate (原本Business.vs的邏輯) if (string.IsNullOrEmpty(active.OptyStage)) { active.OptyStage = "25% Proposing/Quoting"; } //檢查Owner email (原本SiebelTools的邏輯) 2015/6/9 This rule is still in Business.vb and it will prevent someone's eQutation ID is not equal to SIEBEL ID. //if (string.IsNullOrEmpty(active.OptyOwnerEmail)) //{ // if (!string.IsNullOrEmpty(active.QuotationMaster.salesEmail)) // active.OptyOwnerEmail = active.QuotationMaster.salesEmail; // else if (!string.IsNullOrEmpty(active.QuotationMaster.createdBy)) // active.OptyOwnerEmail = active.QuotationMaster.createdBy; // else if (string.IsNullOrEmpty(active.QuotationMaster.attentionRowId)) // active.OptyOwnerEmail = active.QuotationMaster.attentionRowId; //} active.ActiveSource = SiebelActiveSource.eQuotation.ToString(); active.ActiveType = SiebelActiveType.CreateOpportunity.ToString(); active.Status = SiebelActiveStatus.UnProcess.ToString(); active.CreatedDate = DateTime.Now; active.LastUpdatedDate = DateTime.Now; if (!SiebelDAL.CreateSiebelActive(active)) { return(false); //創建SiebelActive失敗,錯誤訊息紀錄在active.FailedLog內 } return(true); }