Пример #1
0
        internal void CreatePicklistValue(string tenantCode, PicklistValue picklistValue)
        {
            try
            {
                var cmd = CreateProcedureCommand("dbo.PicklistValue_Create");
                cmd.AppendXSmallText("@strTenantCode", tenantCode);
                cmd.AppendGuid("@guidId", picklistValue.Values.Id);
                cmd.AppendSmallInt("@intPicklistId", picklistValue.Values.PicklistId);
                cmd.AppendSmallText("@strKey", picklistValue.Values.Key);
                cmd.AppendMediumText("@strText", picklistValue.Values.Text);
                cmd.AppendBit("@bitActive", picklistValue.Values.Active);
                cmd.AppendBit("@bitIsDeletetd", picklistValue.Values.IsDeleteted);
                cmd.AppendBit("@bitFlagged", picklistValue.Values.Flagged);
                cmd.AppendGuid("@guidUpdatedBy", picklistValue.Values.UpdatedBy);

                SqlParameter retvalue = cmd.AppendInt("@intReturn");
                ExecuteCommand(cmd);
                if ((int)retvalue.Value == 1)
                {
                    throw new VPCException(DbErrorCode.Duplicate);
                }
            }
            catch (SqlException e)
            {
                _log.Error(e);
                throw ReportAndTranslateException(e, "PicklistValue::Create");
            }
        }
Пример #2
0
 internal bool UpdatePicklistValue(string tenantCode, Guid id, PicklistValue picklistValue)
 {
     try
     {
         var cmd = CreateProcedureCommand("dbo.PicklistValue_Update");
         cmd.AppendXSmallText("@strTenantCode", tenantCode);
         cmd.AppendGuid("@guidId", picklistValue.Values.Id);
         cmd.AppendSmallText("@strKey", picklistValue.Values.Key);
         cmd.AppendMediumText("@strText", picklistValue.Values.Text);
         cmd.AppendBit("@bitActive", picklistValue.Values.Active);
         cmd.AppendBit("@bitIsDeletetd", picklistValue.Values.IsDeleteted);
         cmd.AppendBit("@bitFlagged", picklistValue.Values.Flagged);
         cmd.AppendGuid("@guidUpdatedBy", picklistValue.Values.UpdatedBy);
         ExecuteCommand(cmd);
         return(true);
     }
     catch (SqlException e)
     {
         _log.Error(e);
         throw ReportAndTranslateException(e, "PicklistValue::Update");
     }
 }
Пример #3
0
 public void SetUp()
 {
     _testEntity    = new PicklistValue();
     _privateObject = new PrivateObject(_testEntity);
 }