Beispiel #1
0
        private SqlGenerator(string tableName, SqlOperationType type, BaseForm form, BaseVM view, int id,
                             SqlQueryFormatter sqlQuery = null, List <string> condition = null, List <string> orderColumns = null)
        {
            this.OperationType = type;
            this.condition     = condition;
            this.orderColumns  = orderColumns;
            this.viewModel     = view;
            this.rowId         = id;

            if (type == SqlOperationType.GetById && id <= 0)
            {
                throw new ArgumentException("Id must provide to get the data");
            }
            this.sqlQuery = sqlQuery ?? new SqlQueryFormatter();

            var sqlParamsList = GetProperties(form);

            Parameters = PrepareSqlParams(sqlParamsList);
            Statement  = PrepareSqlStatement(tableName, type, sqlParamsList);
        }
Beispiel #2
0
 //public SqlParameterCollection SqlParams { get; set; }
 //tableName or StoredProcName
 public SqlGenerator(string tableName, SqlOperationType type, BaseForm form,
                     SqlQueryFormatter sqlQuery = null, List <string> condition = null)
     : this(tableName, type, form, null, 0, sqlQuery, condition)
 {
 }
Beispiel #3
0
 public SqlGenerator(string tableName, BaseForm form, BaseVM view,
                     SqlQueryFormatter sqlQuery = null, List <string> condition = null, List <string> orderColumns = null) :
     this(tableName, SqlOperationType.Get, form, view, 0, sqlQuery, condition, orderColumns)
 {
     //this.viewModel = view;
 }
Beispiel #4
0
 public SqlGenerator(string tableName, BaseVM view, int id, SqlQueryFormatter sqlQuery = null, List <string> condition = null) :
     this(tableName, SqlOperationType.GetById, null, view, id, sqlQuery, condition)
 {
 }
Beispiel #5
0
 public SqlGenerator(string storedProcName, BaseForm form, SqlQueryFormatter sqlQuery = null, List <string> condition = null) :
     this(storedProcName, SqlOperationType.StoredProc, form, null, 0, sqlQuery, condition)
 {
 }