protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_MD_SCDD_1729 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here foreach (var dueDate in Parameter.DueDates) { #region NEW PARAMETER if (dueDate.ID == Guid.Empty) { if (dueDate.IsActive) { var newDueDateParameter = new ORM_CMN_CTR_Contract_Parameter(); newDueDateParameter.CMN_CTR_Contract_ParameterID = Guid.NewGuid(); newDueDateParameter.Contract_RefID = Parameter.ContractID; newDueDateParameter.Creation_Timestamp = DateTime.Now; newDueDateParameter.IfNumericValue_Value = dueDate.Value; newDueDateParameter.IsNumericValue = true; newDueDateParameter.Modification_Timestamp = DateTime.Now; newDueDateParameter.ParameterName = dueDate.Name; newDueDateParameter.Tenant_RefID = securityTicket.TenantID; newDueDateParameter.Save(Connection, Transaction); } } #endregion #region EDIT else { var existingParameter = ORM_CMN_CTR_Contract_Parameter.Query.Search(Connection, Transaction, new ORM_CMN_CTR_Contract_Parameter.Query() { CMN_CTR_Contract_ParameterID = dueDate.ID, Tenant_RefID = securityTicket.TenantID, IsDeleted = false }).SingleOrDefault(); if (existingParameter != null) { if (dueDate.IsActive) { existingParameter.IfNumericValue_Value = dueDate.Value; } else { existingParameter.IsDeleted = true; } existingParameter.Modification_Timestamp = DateTime.Now; existingParameter.Save(Connection, Transaction); } } #endregion } return returnValue; #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_MD_SCP_1754 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here var contract_parameter = ORM_CMN_CTR_Contract_Parameter.Query.Search(Connection, Transaction, new ORM_CMN_CTR_Contract_Parameter.Query() { Contract_RefID = Parameter.ContractID, ParameterName = Parameter.Name, Tenant_RefID = securityTicket.TenantID, IsDeleted = false }).SingleOrDefault(); if (contract_parameter == null) { contract_parameter = new ORM_CMN_CTR_Contract_Parameter(); contract_parameter.Tenant_RefID = securityTicket.TenantID; contract_parameter.ParameterName = Parameter.Name; contract_parameter.Contract_RefID = Parameter.ContractID; } if (Parameter.BooleanValue.HasValue) { contract_parameter.IsBooleanValue = true; contract_parameter.IfBooleanValue_Value = Parameter.BooleanValue.Value; } else if (Parameter.NumericValue.HasValue) { contract_parameter.IsNumericValue = true; contract_parameter.IfNumericValue_Value = Parameter.NumericValue.Value; } else { contract_parameter.IsStringValue = true; contract_parameter.IfStringValue_Value = Parameter.StringValue; } contract_parameter.Modification_Timestamp = DateTime.Now; contract_parameter.Save(Connection, Transaction); returnValue.Result = contract_parameter.CMN_CTR_Contract_ParameterID; return(returnValue); #endregion UserCode }