示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = DataPropertyName.GetHashCode();
         hashCode = (hashCode * 397) ^ Visible.GetHashCode();
         hashCode = (hashCode * 397) ^ Sort;
         hashCode = (hashCode * 397) ^ Width;
         hashCode = (hashCode * 397) ^ DisplayIndex;
         hashCode = (hashCode * 397) ^ (Operator.GetHashCode());
         hashCode = (hashCode * 397) ^ (ValueText.GetHashCode());
         hashCode = (hashCode * 397) ^ ValueDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (ValueFilters != null ? ValueFilters.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#2
0
        public override KeyValuePair <string, SqlParameter[]>?GetFilter()
        {
            if (DataPropertyName.IsNullOrWhiteSpace())
            {
                throw new Exception(Title + ".DataPropertyName属性尚未初始化!");
            }

            if (txt.Text.Trim().Length == 0)
            {
                return(null);
            }

            string parmName = '@' + DataPropertyName.Replace(".", "");
            string filter   = string.Format("[{0}] {1} {2}", DataPropertyName.Replace(".", "].["), FilterOperator, parmName);

            SqlParameter[] parms = new SqlParameter[] { new SqlParameter(parmName, '%' + txt.Text + '%') };
            return(new KeyValuePair <string, SqlParameter[]>(filter, parms));
        }
示例#3
0
        public override KeyValuePair <string, SqlParameter[]>?GetFilter()
        {
            if (DataPropertyName.IsNullOrWhiteSpace())
            {
                throw new Exception(Title + ".DataPropertyName属性尚未初始化!");
            }

            if (!dtpStart.Checked && !dtpStop.Checked)
            {
                return(null);
            }

            string filter             = null;
            List <SqlParameter> parms = new List <SqlParameter>();
            string startParmName      = "@start" + DataPropertyName.Replace(".", "");
            string stopParmName       = "@stop" + DataPropertyName.Replace(".", "");

            if (dtpStart.Checked && dtpStop.Checked)
            {
                filter = string.Format("[{0}] >= {1} AND [{0}] < {2}", DataPropertyName.Replace(".", "].["), startParmName, stopParmName);
                parms.Add(new SqlParameter(startParmName, dtpStart.Value.Date));
                parms.Add(new SqlParameter(stopParmName, dtpStop.Value.AddDays(1).Date));
            }
            if (dtpStart.Checked && !dtpStop.Checked)
            {
                filter = string.Format("[{0}] >= {1}", DataPropertyName.Replace(".", "].["), startParmName);
                parms.Add(new SqlParameter(startParmName, dtpStart.Value.Date));
            }
            if (!dtpStart.Checked && dtpStop.Checked)
            {
                filter = string.Format("[{0}] < {1}", DataPropertyName.Replace(".", "].["), stopParmName);
                parms.Add(new SqlParameter(stopParmName, dtpStop.Value.AddDays(1).Date));
            }

            return(new KeyValuePair <string, SqlParameter[]>(filter, parms.ToArray()));
        }