示例#1
0
        //Creates an appropriate message and boolean, based on if the url was able to be processed successfully
        public GuidResult GenerateGuidPayload(bool ableToProcess, ServiceConstants.UrlFileDlEnums resultEnum)
        {
            String errormessage = "";

            Guid   code = Guid.NewGuid();
            String guid = code.ToString();

            GuidResult responsePayload = new GuidResult();

            switch (resultEnum)
            {
            case ServiceConstants.UrlFileDlEnums.FileIncorrectFormat:
                errormessage            = Sulfur.Resource.FileIncorrectFormat;
                responsePayload.success = "false";
                responsePayload.error   = errormessage;
                return(responsePayload);

            case ServiceConstants.UrlFileDlEnums.WebUrlIsNotValid:
                errormessage            = Sulfur.Resource.InvalidWebUrl;
                responsePayload.success = "false";
                responsePayload.error   = errormessage;
                return(responsePayload);
            }

            responsePayload.Id      = guid;
            responsePayload.success = "true";
            responsePayload.error   = errormessage;
            return(responsePayload);
        }
示例#2
0
        //Creates an appropriate message and boolean, based on if the url was able to be processed successfully
        public GuidResult GenerateGuidPayload(bool ableToProcess, UrlFileDlEnums resultEnum)
        {
            //Whats ableToProcess variable for ?

            string errormessage = string.Empty;

            Guid   code = Guid.NewGuid();
            string guid = code.ToString();

            GuidResult responsePayload = new GuidResult();

            switch (resultEnum)
            {
            case UrlFileDlEnums.FileIncorrectFormat:
                errormessage            = Resource.FileIncorrectFormat;
                responsePayload.Success = "false";
                responsePayload.Error   = errormessage;
                return(responsePayload);

            case UrlFileDlEnums.WebUrlIsNotValid:
                errormessage            = Resource.InvalidWebUrl;
                responsePayload.Success = "false";
                responsePayload.Error   = errormessage;
                return(responsePayload);

            default:
                responsePayload.Id      = guid;
                responsePayload.Success = "true";
                responsePayload.Error   = errormessage;
                return(responsePayload);
            }
        }
示例#3
0
        /// <summary>
        /// creates user data
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <GuidResult> CreateGuid(CredentialModel model)
        {
            var result = new GuidResult {
                ValidationResults = model.Validate()
            };

            if (result.ValidationResults.Count == 0)
            {
                var randomGuid = new Guid();

                if (string.IsNullOrEmpty(model.UserId))
                {
                    randomGuid   = Guid.NewGuid();
                    model.UserId = randomGuid.ToString();
                    model.Expire = string.IsNullOrEmpty(model.Expire) ? "2629743" : model.Expire;
                }

                var entity = model.MapToEntity();

                await _userCredRepository.Add(entity);

                result.CredentialModel = entity.MapToModel();

                return(result);
            }
            return(result);
        }
示例#4
0
        /// <summary>
        /// updates user data
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <GuidResult> Update(CredentialModel model)
        {
            var result = new GuidResult {
                ValidationResults = model.Validate()
            };

            if (result.ValidationResults.Count == 0)
            {
                var entity = await _userCredRepository.GetById(new Guid(model.UserId));

                result.CredentialModel = entity.MapToModel();

                if (entity != null)
                {
                    entity.Username = string.IsNullOrEmpty(model.Username) ? entity.Username : model.Username;
                    entity.Expire   = string.IsNullOrEmpty(model.Expire) ? entity.Expire : model.Expire;
                    entity.UserId   = new Guid(model.UserId);
                    await _userCredRepository.AddOrUpdate(entity);
                }

                result.CredentialModel = entity.MapToModel();
                return(result);
            }
            return(result);
        }
示例#5
0
        public void GenerateGuidWhenUrlIsInvalid()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(false, ServiceConstants.UrlFileDlEnums.WebUrlIsNotValid);

            Assert.True(String.IsNullOrEmpty(resultPayload.Id));
            Assert.False(Boolean.Parse(resultPayload.success));
            Assert.Equal(resultPayload.error, Sulfur.Resource.InvalidWebUrl);
        }
        public void GenerateGuidWhenUrlIsInvalid()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(false, UrlFileDlEnums.WebUrlIsNotValid);

            Assert.True(string.IsNullOrEmpty(resultPayload.Id));
            Assert.False(bool.Parse(resultPayload.Success));
            Assert.Equal(resultPayload.Error, Resource.InvalidWebUrl);
        }
示例#7
0
        public void GenerateGuidWhenUrlIsValidAndTorrentFileExists()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(true, ServiceConstants.UrlFileDlEnums.Success);

            Assert.False(String.IsNullOrEmpty(resultPayload.Id));
            Assert.True(Boolean.Parse(resultPayload.success));
            Assert.True(String.IsNullOrEmpty(resultPayload.error));
        }
        public void GenerateGuidWhenFileIsIncorrectFormat()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(false, UrlFileDlEnums.FileIncorrectFormat);

            Assert.True(string.IsNullOrEmpty(resultPayload.Id));
            Assert.False(bool.Parse(resultPayload.Success));
            Assert.Equal(resultPayload.Error, Resource.FileIncorrectFormat);
        }
示例#9
0
        public void GenerateGuidWhenFileIsIncorrectFormat()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(false, ServiceConstants.UrlFileDlEnums.FileIncorrectFormat);

            Assert.True(String.IsNullOrEmpty(resultPayload.Id));
            Assert.False(Boolean.Parse(resultPayload.success));
            Assert.Equal(resultPayload.error, Sulfur.Resource.FileIncorrectFormat);
        }
示例#10
0
        public void GenerateGuidWhenUrlIsValidAndTorrentFileExists()
        {
            GuidResult resultPayload = actionService.GenerateGuidPayload(true, UrlFileDlEnums.Success);

            Assert.False(string.IsNullOrEmpty(resultPayload.Id));
            Assert.True(bool.Parse(resultPayload.Success));
            Assert.True(string.IsNullOrEmpty(resultPayload.Error));
        }
示例#11
0
文件: Guid.cs 项目: Amortless/corert
        public static Guid ParseExact(String input, String format)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }

            if (format.Length != 1)
            {
                // all acceptable format strings are of length 1
                throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
            }

            GuidStyles style;
            char       formatCh = format[0];

            if (formatCh == 'D' || formatCh == 'd')
            {
                style = GuidStyles.DigitFormat;
            }
            else if (formatCh == 'N' || formatCh == 'n')
            {
                style = GuidStyles.NumberFormat;
            }
            else if (formatCh == 'B' || formatCh == 'b')
            {
                style = GuidStyles.BraceFormat;
            }
            else if (formatCh == 'P' || formatCh == 'p')
            {
                style = GuidStyles.ParenthesisFormat;
            }
            else if (formatCh == 'X' || formatCh == 'x')
            {
                style = GuidStyles.HexFormat;
            }
            else
            {
                throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
            }

            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.AllButOverflow);
            if (TryParseGuid(input, style, ref result))
            {
                return(result._parsedGuid);
            }
            else
            {
                throw result.GetGuidParseException();
            }
        }
示例#12
0
        public static Guid ParseExact(string input, string format)
        {
            GuidStyles digitFormat;

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }
            if (format.Length != 1)
            {
                throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
            }
            char ch = format[0];

            switch (ch)
            {
            case 'D':
            case 'd':
                digitFormat = GuidStyles.DigitFormat;
                break;

            case 'N':
            case 'n':
                digitFormat = GuidStyles.None;
                break;

            case 'B':
            case 'b':
                digitFormat = GuidStyles.BraceFormat;
                break;

            case 'P':
            case 'p':
                digitFormat = GuidStyles.ParenthesisFormat;
                break;

            default:
                if ((ch != 'X') && (ch != 'x'))
                {
                    throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
                }
                digitFormat = GuidStyles.HexFormat;
                break;
            }
            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.AllButOverflow);
            if (!TryParseGuid(input, digitFormat, ref result))
            {
                throw result.GetGuidParseException();
            }
            return(result.parsedGuid);
        }
示例#13
0
        /// <summary>
        /// delete user data by guid
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public async Task <GuidResult> DeleteGuid(string guid)
        {
            var result = new GuidResult {
                ValidationResults = guid.ValidateGuid(_userCredRepository)
            };

            if (result.ValidationResults.Count == 0)
            {
                await _userCredRepository.Delete(x => x.UserId == new Guid(guid));
            }
            return(result);
        }
示例#14
0
文件: Guid.cs 项目: Amortless/corert
        public static bool TryParseExact(String input, String format, out Guid result)
        {
            if (format == null || format.Length != 1)
            {
                result = Guid.Empty;
                return(false);
            }

            GuidStyles style;
            char       formatCh = format[0];

            if (formatCh == 'D' || formatCh == 'd')
            {
                style = GuidStyles.DigitFormat;
            }
            else if (formatCh == 'N' || formatCh == 'n')
            {
                style = GuidStyles.NumberFormat;
            }
            else if (formatCh == 'B' || formatCh == 'b')
            {
                style = GuidStyles.BraceFormat;
            }
            else if (formatCh == 'P' || formatCh == 'p')
            {
                style = GuidStyles.ParenthesisFormat;
            }
            else if (formatCh == 'X' || formatCh == 'x')
            {
                style = GuidStyles.HexFormat;
            }
            else
            {
                // invalid guid format specification
                result = Guid.Empty;
                return(false);
            }

            GuidResult parseResult = new GuidResult();

            parseResult.Init(GuidParseThrowStyle.None);
            if (TryParseGuid(input, style, ref parseResult))
            {
                result = parseResult._parsedGuid;
                return(true);
            }
            else
            {
                result = Guid.Empty;
                return(false);
            }
        }
示例#15
0
        public static bool TryParse(string input, out Guid result)
        {
            GuidResult result2 = new GuidResult();

            result2.Init(GuidParseThrowStyle.None);
            if (TryParseGuid(input, GuidStyles.Any, ref result2))
            {
                result = result2.parsedGuid;
                return(true);
            }
            result = Empty;
            return(false);
        }
示例#16
0
        public static bool TryParseExact(string input, string format, out Guid result)
        {
            GuidStyles digitFormat;

            if ((format == null) || (format.Length != 1))
            {
                result = Empty;
                return(false);
            }
            switch (format[0])
            {
            case 'D':
            case 'd':
                digitFormat = GuidStyles.DigitFormat;
                break;

            case 'N':
            case 'n':
                digitFormat = GuidStyles.None;
                break;

            case 'B':
            case 'b':
                digitFormat = GuidStyles.BraceFormat;
                break;

            case 'P':
            case 'p':
                digitFormat = GuidStyles.ParenthesisFormat;
                break;

            case 'X':
            case 'x':
                digitFormat = GuidStyles.HexFormat;
                break;

            default:
                result = Empty;
                return(false);
            }
            GuidResult result2 = new GuidResult();

            result2.Init(GuidParseThrowStyle.None);
            if (TryParseGuid(input, digitFormat, ref result2))
            {
                result = result2.parsedGuid;
                return(true);
            }
            result = Empty;
            return(false);
        }
示例#17
0
        public static Guid Parse(string input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.AllButOverflow);
            if (!TryParseGuid(input, GuidStyles.Any, ref result))
            {
                throw result.GetGuidParseException();
            }
            return(result.parsedGuid);
        }
示例#18
0
文件: Guid.cs 项目: Amortless/corert
        public static bool TryParse(String input, out Guid result)
        {
            GuidResult parseResult = new GuidResult();

            parseResult.Init(GuidParseThrowStyle.None);
            if (TryParseGuid(input, GuidStyles.Any, ref parseResult))
            {
                result = parseResult._parsedGuid;
                return(true);
            }
            else
            {
                result = Guid.Empty;
                return(false);
            }
        }
示例#19
0
        public Guid(string g)
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            this = Empty;
            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.All);
            if (!TryParseGuid(g, GuidStyles.Any, ref result))
            {
                throw result.GetGuidParseException();
            }
            this = result.parsedGuid;
        }
示例#20
0
        /// <summary>
        /// gets user data by guid
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public async Task <GuidResult> ReadGuid(string guid)
        {
            var result = new GuidResult {
                ValidationResults = guid.ValidateGuid(_userCredRepository)
            };

            if (result.ValidationResults.Count == 0)
            {
                var entity = await _userCredRepository.GetById(new Guid(guid));

                result.CredentialModel = entity.MapToModel();
                return(result);
            }

            return(result);
        }
        /// <summary>
        /// 临床指南接口测试
        /// </summary>
        /// <returns></returns>
        public ReturnValueModel GuidTest()
        {
            ReturnValueModel rvm        = new ReturnValueModel();
            string           BegoreDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            long             startTime  = ConvertDateTimeToInt(Convert.ToDateTime(BegoreDate + " 00:00:00"));
            long             endTime    = ConvertDateTimeToInt(Convert.ToDateTime(BegoreDate + " 23:59:59"));
            string           guidurl    = GuidUrl + "projectId=" + GuidProjectId + "&startTime=1555653009128&endTime=1555903191541&start=1&num=50";
            //获取临床指南返回的数据
            string guidback = HttpService.Get(guidurl);

            guidback = HttpUtility.UrlDecode(guidback);

            string KeyWord = "JstoBn29LpomgYk9";
            string iv      = guidback.Substring(0, 16);

            string guiddata = EncryptHelper.DecodeAES(guidback, KeyWord, iv);

            guiddata = guiddata.Substring(guiddata.IndexOf('{'), guiddata.LastIndexOf('}') - guiddata.IndexOf('{') + 1);
            GuidResult model = JsonConvert.DeserializeObject <GuidResult>(guiddata);

            rvm.Success = false;
            if (model.success)
            {
                rvm.Success = true;
                foreach (GuidItem guidItem in model.data.items)
                {
                    string abc = guidItem.guideName;
                    _rep.Insert(new GuidVisit()
                    {
                        Id         = Guid.NewGuid().ToString(),
                        userid     = guidItem.uid,
                        ActionType = guidItem.actionType,
                        GuideId    = guidItem.guideId,
                        GuideName  = guidItem.guideName,
                        GuideType  = guidItem.guideType,
                        CreateTime = DateTime.Now.AddDays(-1),
                        UpdateTime = DateTime.Now,
                        IsEnabled  = 0,
                        IsDeleted  = 0
                    });
                    _rep.SaveChanges();
                }
            }
            return(rvm);
        }
示例#22
0
文件: Guid.cs 项目: Amortless/corert
        public static Guid Parse(String input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            Contract.EndContractBlock();

            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.AllButOverflow);
            if (TryParseGuid(input, GuidStyles.Any, ref result))
            {
                return(result._parsedGuid);
            }
            else
            {
                throw result.GetGuidParseException();
            }
        }
示例#23
0
        public ActionResult <GuidResult> PostUrlPayload(UrlPayload url)
        {
            //Access HTTP Header
            string headerAuthToken = Request.Headers["Authorization"];

            //Checks if it is possible to bind the values in the request to the model.
            //If url is null, means it was unable to bind the model
            if (!ModelState.IsValid || !_urlActionService.SuccessfulMatchOnHeaderToken(headerAuthToken))
            {
                //Returns a 400 bad request
                return(BadRequest(ModelState));
            }

            //process the url using the urlfiledownload service
            var tupleResponse = _urlFileDownloadService.ProcessUrl(url.Url);

            //pass success or fail to urlactionservice and get back guid payload
            GuidResult result = _urlActionService.GenerateGuidPayload(tupleResponse.Item1, tupleResponse.Item2);

            return(result);
        }
示例#24
0
文件: Guid.cs 项目: Amortless/corert
        // Creates a new guid based on the value in the string.  The value is made up
        // of hex digits speared by the dash ("-"). The string may begin and end with
        // brackets ("{", "}").
        //
        // The string must be of the form dddddddd-dddd-dddd-dddd-dddddddddddd. where
        // d is a hex digit. (That is 8 hex digits, followed by 4, then 4, then 4,
        // then 12) such as: "CA761232-ED42-11CE-BACD-00AA0057B223"
        //
        public Guid(String g)
        {
            if (g == null)
            {
                throw new ArgumentNullException(nameof(g));
            }
            Contract.EndContractBlock();
            this = Guid.Empty;

            GuidResult result = new GuidResult();

            result.Init(GuidParseThrowStyle.All);
            if (TryParseGuid(g, GuidStyles.Any, ref result))
            {
                this = result._parsedGuid;
            }
            else
            {
                throw result.GetGuidParseException();
            }
        }
示例#25
0
        static void Main(string[] args)
        {
            DateTime JudgmentDay;

            if (args.Length < 1)
            {
                Console.WriteLine("USAGE: fromParsec2SQL <DD.MM.YYYY/TODAY/YESTERDAY>");
                return;
            }
            else if (args[0].ToUpper().StartsWith("TODAY"))
            {
                JudgmentDay = DateTime.Today;
            }
            else if (args[0].ToUpper().StartsWith("YESTERDAY"))
            {
                JudgmentDay = DateTime.Today.AddDays(-1);
            }
            else if (!DateTime.TryParse(args[0], out JudgmentDay))
            {
                Console.WriteLine("USAGE: pFillDayEvents <DD.MM.YYYY/TODAY/YESTERDAY>");
                return;
            }
            //штатное время выхода и входа для заданной даты
            DateTime proposedExit = (JudgmentDay.DayOfWeek.ToString() == "Friday") ?
                                    new DateTime(JudgmentDay.Year, JudgmentDay.Month, JudgmentDay.Day, 17, 0, 0)
                : new DateTime(JudgmentDay.Year, JudgmentDay.Month, JudgmentDay.Day, 18, 15, 0);
            DateTime proposedEnter = new DateTime(JudgmentDay.Year, JudgmentDay.Month, JudgmentDay.Day, 9, 0, 0);

            var connectionString = ConfigurationManager.ConnectionStrings["ParsecReport"].ConnectionString;

            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                checkTable(sqlCon);
                sqlCon.Close();
            }

            IntegrationService igServ         = new IntegrationService();
            string             parsecdomain   = ConfigurationManager.AppSettings.Get("domain");
            string             parsecuser     = ConfigurationManager.AppSettings.Get("user");
            string             parsecpassword = ConfigurationManager.AppSettings.Get("password");
            string             turniketString = ConfigurationManager.AppSettings.Get("turniket");
            Guid          turniket            = new Guid(turniketString);
            SessionResult res = igServ.OpenSession(parsecdomain, parsecuser, parsecpassword);

            if (res.Result != 0)
            {
                Console.WriteLine("Can not open session to Parsek");
                return;
            }
            Guid sessionID = res.Value.SessionID;

            BaseObject[]            hierarhyList = igServ.GetOrgUnitsHierarhyWithPersons(sessionID);
            EventHistoryQueryParams param        = new EventHistoryQueryParams();

            param.StartDate         = JudgmentDay.ToUniversalTime();
            param.EndDate           = JudgmentDay.AddDays(1).ToUniversalTime();
            param.Territories       = new Guid[] { turniket };
            param.EventsWithoutUser = false;
            param.TransactionTypes  = new uint[] { 590144, 590152, 65867, 590165, 590145, 590153, 65866, 590166 };
            param.MaxResultSize     = (10000);

            EventHistoryFields constants = new EventHistoryFields();
            List <Guid>        fields    = new List <Guid>();

            fields.Add(EventHistoryFields.EVENT_DATE_TIME);
            fields.Add(EventHistoryFields.EVENT_CODE_HEX);

            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();

                int i = 0;
                for (i = hierarhyList.Length - 1; i >= 0; i--)
                {
                    if (hierarhyList[i] == null)
                    {
                        continue;
                    }
                    Person personItem = hierarhyList[i] as Person;
                    if (personItem != null)
                    {
                        Guid          userid = personItem.ID;
                        List <string> hlist  = new List <string>();
                        param.Users = new Guid[] { personItem.ID };
                        GuidResult ev = igServ.OpenEventHistorySession(sessionID, param);
                        if (ev.Result != 0)
                        {
                            continue;
                        }
                        Guid eventSessionID = ev.Value;

                        DateTime?     enter = null, exit = null, lastEventTime = null;
                        DateTime      tmptime;
                        bool          lastEventWasEnter = false;
                        int           eventscount = 0, totalworktime = 0, totalouttime = 0;
                        EventObject[] events = null;
                        events = igServ.GetEventHistoryResult(sessionID, eventSessionID, fields.ToArray(), 0, 10000);
                        for (int ii = 0; ii < events.Length; ii++)
                        {
                            switch ((string)events[ii].Values[1])
                            {
                            case "90140":
                            case "90148":
                            case "1014B":
                            case "90155":      //КОДЫ ВХОДА
                                eventscount++;
                                hlist.Add("Вход: " + events[ii].Values[0].ToString() + "<br>");
                                if (DateTime.TryParse(events[ii].Values[0].ToString(), out tmptime))
                                {
                                    enter             = (enter == null || tmptime < enter) ? tmptime : enter;
                                    totalouttime     += (lastEventWasEnter || lastEventTime == null) ? 0 : (int)(tmptime - (DateTime)lastEventTime).TotalMinutes;
                                    lastEventWasEnter = true;
                                    lastEventTime     = tmptime;
                                }
                                break;

                            case "90141":
                            case "90149":
                            case "90142":
                            case "901A4":
                            case "90156":
                            case "901A5":      //КОДЫ ВЫХОДА
                                eventscount++;
                                hlist.Add("Выход: " + events[ii].Values[0].ToString() + "<br>");
                                if (DateTime.TryParse(events[ii].Values[0].ToString(), out tmptime))
                                {
                                    exit              = (exit == null || tmptime > exit) ? tmptime : exit;
                                    totalworktime    += (!lastEventWasEnter || lastEventTime == null) ? 0 : (int)(tmptime - (DateTime)lastEventTime).TotalMinutes;
                                    lastEventWasEnter = false;
                                    lastEventTime     = tmptime;
                                }
                                break;
                            }
                        }

                        DateTime renter, rexit;
                        if (enter == null || exit == null)
                        {
                            continue;
                        }
                        else
                        {
                            renter = enter ?? DateTime.Now;
                            rexit  = exit ?? DateTime.Now;
                        }

                        int opozd = (int)(renter - proposedEnter).TotalMinutes;
                        int zader = (int)(rexit - proposedExit).TotalMinutes;
                        //                        hlist.Reverse();
                        string history = String.Concat(hlist);
                        string sqlc    = "if not exists "
                                         + "(select * from ParsecOrgHistory where id = @id and sysdate = @sysdate) "
                                         + " insert into ParsecOrgHistory "
                                         + " (id, sysdate, date, enter,eexit, eventscount, totalworktime, totalouttime, opozd, zader, history) "
                                         + " values (@id, @sysdate, @date, @enter,@eexit, @eventscount, @totalworktime,@totalouttime, @opozd, @zader, @history)"
                        ;
                        using (SqlCommand sqlCmd1 = new SqlCommand {
                            CommandText = sqlc, Connection = sqlCon
                        })
                        {
                            sqlCmd1.Parameters.AddWithValue("@id", userid.ToString());
                            sqlCmd1.Parameters.AddWithValue("@sysdate", JudgmentDay);
                            sqlCmd1.Parameters.AddWithValue("@date", JudgmentDay.ToString("dd-MM-yyyy"));
                            sqlCmd1.Parameters.AddWithValue("@enter", renter.ToString("HH-mm"));
                            sqlCmd1.Parameters.AddWithValue("@eexit", rexit.ToString("HH-mm"));
                            sqlCmd1.Parameters.AddWithValue("@eventscount", eventscount);
                            sqlCmd1.Parameters.AddWithValue("@totalworktime", totalworktime);
                            sqlCmd1.Parameters.AddWithValue("@totalouttime", totalouttime);
                            sqlCmd1.Parameters.AddWithValue("@opozd", opozd);
                            sqlCmd1.Parameters.AddWithValue("@zader", zader);
                            sqlCmd1.Parameters.AddWithValue("@history", history);
                            sqlCmd1.ExecuteNonQuery();
                        }
                    }
                }

                sqlCon.Close();
            }
        }
示例#26
0
文件: Guid.cs 项目: Amortless/corert
        // Check if it's of the form [{|(]dddddddd-dddd-dddd-dddd-dddddddddddd[}|)]
        private static bool TryParseGuidWithDashes(String guidString, ref GuidResult result)
        {
            int  startPos = 0;
            int  temp;
            long templ;
            int  currentPos = 0;

            // check to see that it's the proper length
            if (guidString[0] == '{')
            {
                if (guidString.Length != 38 || guidString[37] != '}')
                {
                    result.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidInvLen));
                    return(false);
                }
                startPos = 1;
            }
            else if (guidString[0] == '(')
            {
                if (guidString.Length != 38 || guidString[37] != ')')
                {
                    result.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidInvLen));
                    return(false);
                }
                startPos = 1;
            }
            else if (guidString.Length != 36)
            {
                result.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidInvLen));
                return(false);
            }

            if (guidString[8 + startPos] != '-' ||
                guidString[13 + startPos] != '-' ||
                guidString[18 + startPos] != '-' ||
                guidString[23 + startPos] != '-')
            {
                result.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidDashes));
                return(false);
            }

            currentPos = startPos;
            if (!StringToInt(guidString, ref currentPos, 8, ParseNumbers.NoSpace, out temp, ref result))
            {
                return(false);
            }
            result._parsedGuid._a = temp;
            ++currentPos; //Increment past the '-';

            if (!StringToInt(guidString, ref currentPos, 4, ParseNumbers.NoSpace, out temp, ref result))
            {
                return(false);
            }
            result._parsedGuid._b = (short)temp;
            ++currentPos; //Increment past the '-';

            if (!StringToInt(guidString, ref currentPos, 4, ParseNumbers.NoSpace, out temp, ref result))
            {
                return(false);
            }
            result._parsedGuid._c = (short)temp;
            ++currentPos; //Increment past the '-';

            if (!StringToInt(guidString, ref currentPos, 4, ParseNumbers.NoSpace, out temp, ref result))
            {
                return(false);
            }
            ++currentPos; //Increment past the '-';
            startPos = currentPos;

            if (!StringToLong(guidString, ref currentPos, ParseNumbers.NoSpace, out templ, ref result))
            {
                return(false);
            }

            if (currentPos - startPos != 12)
            {
                result.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidInvLen));
                return(false);
            }
            result._parsedGuid._d = (byte)(temp >> 8);
            result._parsedGuid._e = (byte)(temp);
            temp = (int)(templ >> 32);
            result._parsedGuid._f = (byte)(temp >> 8);
            result._parsedGuid._g = (byte)(temp);
            temp = (int)(templ);
            result._parsedGuid._h = (byte)(temp >> 24);
            result._parsedGuid._i = (byte)(temp >> 16);
            result._parsedGuid._j = (byte)(temp >> 8);
            result._parsedGuid._k = (byte)(temp);

            return(true);
        }
示例#27
0
文件: Guid.cs 项目: Amortless/corert
        private static unsafe bool StringToLong(String str, ref int parsePos, int flags, out long result, ref GuidResult parseResult)
        {
            result = 0;

            try
            {
                result = ParseNumbers.StringToLong(str, 16, flags, ref parsePos);
            }
            catch (OverflowException ex)
            {
                if (parseResult._throwStyle == GuidParseThrowStyle.All)
                {
                    throw;
                }
                else if (parseResult._throwStyle == GuidParseThrowStyle.AllButOverflow)
                {
                    throw new FormatException(SR.Format_GuidUnrecognized, ex);
                }
                else
                {
                    parseResult.SetFailure(ex);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                if (parseResult._throwStyle == GuidParseThrowStyle.None)
                {
                    parseResult.SetFailure(ex);
                    return(false);
                }
                else
                {
                    throw;
                }
            }
            return(true);
        }
示例#28
0
文件: Guid.cs 项目: Amortless/corert
        private static bool StringToInt(String str, ref int parsePos, int requiredLength, int flags, out int result, ref GuidResult parseResult)
        {
            result = 0;

            int currStart = parsePos;

            try
            {
                result = ParseNumbers.StringToInt(str, 16, flags, ref parsePos);
            }
            catch (OverflowException ex)
            {
                if (parseResult._throwStyle == GuidParseThrowStyle.All)
                {
                    throw;
                }
                else if (parseResult._throwStyle == GuidParseThrowStyle.AllButOverflow)
                {
                    throw new FormatException(SR.Format_GuidUnrecognized, ex);
                }
                else
                {
                    parseResult.SetFailure(ex);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                if (parseResult._throwStyle == GuidParseThrowStyle.None)
                {
                    parseResult.SetFailure(ex);
                    return(false);
                }
                else
                {
                    throw;
                }
            }

            //If we didn't parse enough characters, there's clearly an error.
            if (requiredLength != -1 && parsePos - currStart != requiredLength)
            {
                parseResult.SetFailure(ParseFailureKind.Format, nameof(SR.Format_GuidInvalidChar));
                return(false);
            }
            return(true);
        }
示例#29
0
文件: Guid.cs 项目: Amortless/corert
        private static bool StringToInt(String str, int requiredLength, int flags, out int result, ref GuidResult parseResult)
        {
            int parsePos = 0;

            return(StringToInt(str, ref parsePos, requiredLength, flags, out result, ref parseResult));
        }
示例#30
0
文件: Guid.cs 项目: Amortless/corert
        private static bool StringToShort(String str, ref int parsePos, int requiredLength, int flags, out short result, ref GuidResult parseResult)
        {
            result = 0;
            int  x;
            bool retValue = StringToInt(str, ref parsePos, requiredLength, flags, out x, ref parseResult);

            result = (short)x;
            return(retValue);
        }