Exemplo n.º 1
0
        private string insertExcuse(string mac, string from_date, string to_date, string reason, string type_id, string latitude, string longitude)
        {
            string methodName = "insertExcuse()";

            log.DebugFormat("------------START---{0}-{1}-({2})-----------", className, methodName, "");

            log.DebugFormat("----------{0}-{1}-({2})-----------", className, methodName, "");

            string result = "";

            try
            {
                DateTime fdate = DateTime.Parse(from_date);
                DateTime tdate = DateTime.Parse(to_date);

                log.DebugFormat("------------DATA---{0}-{1}-({2})-----------", className, methodName, from_date + "|" + to_date + "|" + latitude + longitude);

                result = Excuse.insertExcuse(mac, fdate, tdate, reason, int.Parse(type_id), latitude, longitude);
            }
            catch (Exception ex) {
                log.Error(ex);
            }

            log.DebugFormat("------------END---{0}-{1}-({2})-----------", className, methodName, result);
            return(result);
        }
Exemplo n.º 2
0
        private string insertExcuse(string mac, string from_date, string to_date, string reason, string excuse_type, string latitude, string longitude)
        {
            string methodName = string.Format("insertExcuse({0},{1},{2},{3},{4},{5})", mac, from_date, to_date, reason, latitude, longitude);

            LogHelper.DebugFormat("{0}.{1}:--- start ---", className, methodName);

            log.DebugFormat("{0}.{1}:--- {2},{3}, {4}, {5}, {6} ---", className, methodName, mac, from_date, to_date, reason, excuse_type);

            string result = "";


            DateTime f_date  = DateTime.MinValue;
            DateTime t_date  = DateTime.MinValue;
            string   pattern = "yyyy-MM-dd HH:mm:ss";

            bool ok_fdate = DateTime.TryParseExact(from_date, pattern, null, DateTimeStyles.None, out f_date);
            bool ok_tdate = DateTime.TryParseExact(to_date, pattern, null, DateTimeStyles.None, out t_date);

            if (!ok_fdate)
            {
                pattern  = "yyyy-MM-dd";
                ok_fdate = DateTime.TryParseExact(from_date, pattern, null, DateTimeStyles.None, out f_date);
                ok_tdate = DateTime.TryParseExact(to_date, pattern, null, DateTimeStyles.None, out t_date);
            }

            if (ok_fdate && ok_tdate)
            {
                log.DebugFormat("{0}.{1}:--- end ---, pass parsing: f_date{2} , t_date{3}", className, methodName, f_date.ToString(), t_date.ToString());
                result = Excuse.insertExcuse(mac, f_date, t_date, reason, int.Parse(excuse_type), latitude, longitude);
            }

            LogHelper.DebugFormat("{0}.{1}:--- end ---", className, methodName);
            return(result);
        }