Ejemplo n.º 1
0
 public CostFillingModel(TextBox tBox, SummingType type, DateTime from, DateTime by)
 {
     TBox    = tBox;
     SumType = type;
     From    = from;
     By      = by;
 }
Ejemplo n.º 2
0
        public static SqlCommand SumByDateQuery(SummingType type, DateTime from, DateTime by, SqlConnection connect)
        {
            string sqlFrom = from.ToString("yyyy-MM-dd");
            string sqlBy   = by.AddDays(1).ToString("yyyy-MM-dd"); //HH:mm:ss

            return(new SqlCommand(@"SELECT SUM(Cost) FROM Журнал WHERE Date >=" + sqlFrom.BeQuoted() +
                                  " AND Date < " + sqlBy.BeQuoted() + GenerateInfTypeQueryPart(type), connect));
        }
Ejemplo n.º 3
0
 static string GenerateInfTypeQueryPart(SummingType type)
 {
     if (type == SummingType.MapCases)
     {
         return(" AND MapCasesCount > 0");
     }
     else if (type == SummingType.OtherInformation)
     {
         return(" AND MapCasesCount = 0");
     }
     else
     {
         return("");
     }
 }