示例#1
0
 protected SqlParameter CreateParemeter(ETT_Condition pETT_Field, int pIndex, ref string pParaName)
 {
     try
     {
         pParaName = "@" + pETT_Field.DBColumnName + pIndex.ToString();
         SqlParameter para = CreateParameter(pParaName, pETT_Field.Value, pETT_Field.DBDataType);
         return(para);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
 public virtual bool Insert()
 {
     try
     {
         _lstMessage = new List <string>();
         bool NotExists = true;
         foreach (ETT_Field properties in _lstProperties)
         {
             if (properties.IsUnique)
             {
                 List <ETT_Condition> lstCondition = new List <ETT_Condition>();
                 ETT_Condition        EqualValue   = new ETT_Condition(properties.DBColumnName);
                 EqualValue.Value = properties.Value;
                 lstCondition.Add(EqualValue);
                 if (Exists(lstCondition))
                 {
                     NotExists = false;
                     _lstMessage.Add("Exists " + properties.DisplayName + " = " + properties.Value.ToString());
                 }
             }
         }
         if (NotExists)
         {
             List <ETT_Field> Values = new List <ETT_Field>();
             foreach (ETT_Field ett in _lstProperties)
             {
                 if (!ett.IsAutoIncrease)
                 {
                     Values.Add(ett);
                 }
             }
             int effected = _dal.Insert(_TableName, Values);
             if (effected > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }