using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebAPIBase.NetCore.BusinessCore
{
    public class SqlStruct
    {
        public string[] ParamsList;

        public string[] ColumnsList;

        public string[] SqlDbTypeList;

        public string[] OrderNameList;

        public string[] OrderSortList;

        public string SqlString;

        public string CommandType;

        public string GetSqlStringWithOrder()
        {
            StringBuilder stringBuilder = new StringBuilder("");
            int num = OrderNameList.Length;
            for (int i = 0; i < num; i++)
            {
                if (stringBuilder.ToString().Length > 0)
                {
                    stringBuilder.Append(", ");
                }
                else
                {
                    stringBuilder.Append(" Order By ");
                }
                stringBuilder.Append(" " + OrderNameList[i] + " " + OrderSortList[i] + " ");
            }
            return SqlString + stringBuilder.ToString();
        }

        public string GetSqlStringWithParams(string[] values)
        {
            string sqlString = SqlString;
            int length = ColumnsList.GetLength(0);
            for (int i = 0; i < length; i++)
            {
                sqlString.Replace(ParamsList[i], values[i]);
            }
            return sqlString;
        }
    }
}
