Beispiel #1
0
        /// <summary>
        /// 按时间,科室获得门诊就医时长的表格(按科室分组)
        /// </summary>
        /// <param name="sTime"></param>
        /// <param name="eTime"></param>
        /// <param name="depts">专科ID</param>
        /// <param name="hospitalDistrict"></param>
        /// <returns></returns>
        public List <DeptAverageTreatmentTime> GetDeptTreatmentAverageTime(DateTime sTime, DateTime eTime, Int32[] depts,
                                                                           params string[] hospitalDistrict)
        {
            var hd = String.Join(",", hospitalDistrict);
            var dp = String.Join(",", depts);
            var detpAvgTreatment = new List <DeptAverageTreatmentTime>();
            var command          = "SELECT ZKID,TO_CHAR(AVG(YYSC))  AS YYSC,TO_CHAR(AVG(HZSC))  AS HZSC,TO_CHAR(AVG(JZSC))  AS JZSC,TO_CHAR(AVG(JFSC))  AS JFSC,TO_CHAR(AVG(QYSC))  AS QYSC FROM YZCX_MZJZGCXX "
                                   + " WHERE TJRQ>=TO_DATE('" + sTime.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS') "
                                   + " AND TJRQ<=TO_DATE('" + eTime.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS')  AND ZKID IN (" + dp + ") AND  YQDM IN (" + hd + ")"
                                   + " GROUP BY ZKID ORDER BY ZKID";
            var queryCommand = db.GetSqlStringCommand(command);

            using (var reader = db.ExecuteReader(queryCommand))
            {
                while (reader.Read())
                {
                    var att = new DeptAverageTreatmentTime();

                    att.SpecialistId      = reader.GetInt32(0);
                    att.SpecialistName    = specialists[att.SpecialistId];
                    att.Appointment       = StringHandler.GetDoubleByString(reader.IsDBNull(1)?"0":reader.GetString(1), 1);
                    att.AwaitingDiagnosis = StringHandler.GetDoubleByString(reader.IsDBNull(2) ? "0" : reader.GetString(2), 1);
                    att.Diagnosis         = StringHandler.GetDoubleByString(reader.IsDBNull(3) ? "0" : reader.GetString(3), 1);
                    att.PayFees           = StringHandler.GetDoubleByString(reader.IsDBNull(4) ? "0" : reader.GetString(4), 1);
                    att.MedicineReceiving = StringHandler.GetDoubleByString(reader.IsDBNull(5) ? "0" : reader.GetString(5), 1);
                    detpAvgTreatment.Add(att);
                }
            }
            return(detpAvgTreatment);
        }
        //private Boolean IsNumeric (System.Object Expression)
        //{
        //    if(Expression == null || Expression is DateTime)
        //        return false;

        //    if(Expression is Int16 || Expression is Int32 || Expression is Int64 || Expression is Decimal || Expression is Single || Expression is Double || Expression is Boolean)
        //        return true;

        //    try
        //    {
        //        if(Expression is string)
        //            Double.Parse(Expression as string);
        //        else
        //            Double.Parse(Expression.ToString());
        //            return true;
        //        } catch {} // just dismiss errors but return false
        //        return false;
        //    }
        //}

        public string saveStatus(string message, ref string status)
        {//"AONAON" or "AOFFAOFF" or "AON" or "AOFF"
            //statusMessage = first occurance of "AON"
            try
            {
                if (message.Length < 3)
                {
                    Logging.LogMessageToFile(this.ToString() + "-" + "message not okay => " + message, "ALL");
                    return(message);
                }

                string commandOn  = firstDeviceGroup.ToString() + "ON";
                string commandOff = firstDeviceGroup.ToString() + "OFF";

                if (StringHandler.Left(message, 0, 3) == commandOn)
                {
                    status = "ON";
                    //Debug.Print("Status = " + status);
                    return(message.Substring(3, message.Length - 3));
                }
                if (StringHandler.Left(message, 0, 4) == commandOff)
                {
                    status = "OFF";
                    //Debug.Print("Status = " + status);
                    return(message.Substring(4, message.Length - 4));
                }
                Logging.LogMessageToFile(this.ToString() + " - saveStatus - " + "error in message " + message + "[Should be A01A01AONAON for example]", "ALL");
                return("");
            }
            catch (Exception e)
            {
                Logging.LogMessageToFile(this.ToString() + " saveStatus - Catch " + e.Message, "ALL");
                return("");
            }
        }
 public TransactionListener(ObjectHandler <Transaction> eventSucceed, StringHandler eventFailed, VoidHandler eventCancelled)
     : base("com.fuji.fujisdk.payment.listener.TransactionListener")
 {
     this.eventSucceed   = eventSucceed;
     this.eventFailed    = eventFailed;
     this.eventCancelled = eventCancelled;
 }
Beispiel #4
0
        /// <summary>
        /// 获得上月门诊平均时长(预约,候诊,就诊,缴费,取药)
        /// </summary>
        /// <returns></returns>
        public double[] GetOutPatientIndicatorLastMonth()
        {
            var start   = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day);
            var end     = DateTime.Now.AddDays(-DateTime.Now.Day);
            var result  = new Double[5];
            var command = "SELECT TO_CHAR(AVG(YYSC))  AS YYSC, TO_CHAR(AVG(HZSC))  AS HZSC,TO_CHAR(AVG(JZSC))  AS JZSC,TO_CHAR(AVG(JFSC))  AS JFSC, TO_CHAR(AVG(QYSC))  QYSC FROM YZCX_MZJZGCXX "
                          + " WHERE TJRQ>=TO_DATE('" + start.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS') "
                          + " AND TJRQ<=TO_DATE('" + end.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS')  ";

            var queryCommand = db.GetSqlStringCommand(command);

            using (var reader = db.ExecuteReader(queryCommand))
            {
                while (reader.Read())
                {
                    result[0] = StringHandler.GetDoubleByString(reader.IsDBNull(0)?"0":reader.GetString(0), 2);
                    result[1] = StringHandler.GetDoubleByString(reader.IsDBNull(1) ? "0" : reader.GetString(1), 2);
                    result[2] = StringHandler.GetDoubleByString(reader.IsDBNull(2) ? "0" : reader.GetString(2), 2);
                    result[3] = StringHandler.GetDoubleByString(reader.IsDBNull(3) ? "0" : reader.GetString(3), 2);
                    result[4] = StringHandler.GetDoubleByString(reader.IsDBNull(4) ? "0" : reader.GetString(4), 2);
                }
            }

            return(result);
        }
Beispiel #5
0
        private void GetContractInfo(string key)
        {
            string contactno = this.key;

            this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno);
            if (submodel.AddDate < Convert.ToDateTime("2016-3-11"))
            {
                companyName = "广东俊特团贷网络信息服务股份有限公司";
            }
            else
            {
                companyName = "东莞团贷网互联网科技服务有限公司";
            }
            this.subBasicModel  = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //基本信息
            this.proModel       = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value);         //标信息
            this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value);

            var Params = new Dapper.DynamicParameters();

            Params.Add("@ProjectId", proModel.Id);
            string selSQL = @"select * from fq_ItemSetsProject with(nolock) where ProjectId=@ProjectId";

            itemProjectInfo = PublicConn.QuerySingle <Fq_ItemSetsProjectInfo>(selSQL, ref Params);

            RepaymentTypeDesc = ToolStatus.ConvertRepaymentType(proModel.RepaymentType.Value);

            if (WebUserAuth.UserId == publisherModel.Id)
            {
                this.subBasicModel.RealName     = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人
                this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard);  //出借人身份证号
            }
            else
            {
                this.itemProjectInfo.RealName     = StringHandler.MaskStartPre(itemProjectInfo.RealName, 1); //借款人
                this.itemProjectInfo.IdentityCard = StringHandler.MaskCardNo(itemProjectInfo.IdentityCard);  //出借人身份证号
            }

            UserEnterpriseInfo userEnterprise = new Common.Contract().GetBorrowerGuaranteeEnterprise(proModel.UserId.Value, proModel.AddDate.Value, proModel.Type.Value);

            if (userEnterprise != null)
            {
                assureModel = new Common.Contract().GetAssureOrganizationByUserId(userEnterprise.UserId);
            }
            else
            {
                int gid = 0;
                int.TryParse(proModel.Guarantors, out gid);
                assureModel = new Common.Contract().GetAssureOrganizationById(gid);
                if (gid == 1 && DateTime.Now < DateTime.Parse("2013-11-27"))
                {
                    assureModel.FullName = "东莞市俊特团贷网络信息服务有限公司";
                }
            }

            //印章小图片
            if (assureModel != null)
            {
                this.assureModel.image = this.GetSmallImage(this.assureModel.image);
            }
        }
Beispiel #6
0
 public void ImportDeltas(string pipscsv, StringHandler msgCallback)
 {
     if ((pipscsv != null) && (pipscsv != string.Empty))
     {
         try {
             available = false;
             string inserts = Path.ChangeExtension(pipscsv, "inserts");
             string deletes = Path.ChangeExtension(pipscsv, "deletes");
             if (File.Exists(inserts) || File.Exists(deletes))
             {
                 ImportDeltaDeletes(pipscsv, deletes, msgCallback);
                 ImportDeltaInserts(pipscsv, inserts, msgCallback);
             }
             foreach (HotListDataFile df in this.dataFiles)
             {
                 df.HotList.Reindex();
             }
         } finally {
             available = true;
         }
     }
     GC.WaitForPendingFinalizers();
     GC.Collect(0, GCCollectionMode.Forced);
     GC.Collect(1, GCCollectionMode.Forced);
     GC.Collect(2, GCCollectionMode.Forced);
 }
Beispiel #7
0
        public void recoveryTest()
        {
            StringHandler target = new StringHandler();
            string        str    = target.protectMixedQuotes("test \"str1\" - 'str2' data");

            Assert.AreEqual("test \"str1\" - 'str2' data", target.recovery(str));
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Give a word");
            string        line = Console.ReadLine();
            string        help;
            int           operInt = 0;
            Moderator     mod     = new Moderator();
            StringHandler handler = new StringHandler(mod.Upperer);
            string        result;

            while (true)
            {
                Console.WriteLine("Give an operation, you can give multiple operations at once (eg. '123'):");
                Console.WriteLine("1. Change word to Upper case");
                Console.WriteLine("2. Change word to Lower case");
                Console.WriteLine("3. Change word to Headline");
                Console.WriteLine("4. Change word to Palidrome");
                Console.WriteLine("0. exit the program");
                help = Console.ReadLine();
                char[] oper = help.ToCharArray();

                for (int i = 0; i < oper.Length; i++)
                {
                    operInt = int.Parse(oper[i].ToString());

                    switch (operInt)
                    {
                    case 1:
                        result = handler(line);
                        Console.WriteLine("{0} is changed to {1}", line, result);
                        break;

                    case 2:
                        handler = new StringHandler(mod.Lowerer);
                        result  = handler(line);
                        Console.WriteLine("{0} is changed to {1}", line, result);
                        break;

                    case 3:
                        handler = new StringHandler(mod.Capitalize);
                        result  = handler(line);
                        Console.WriteLine("{0} is changed to {1}", line, result);
                        break;

                    case 4:
                        handler = new StringHandler(mod.Palindrome);
                        result  = handler(line);
                        Console.WriteLine("{0} is changed to {1}", line, result);
                        break;

                    case 0:
                        break;
                    }
                }
                if (operInt == 0)
                {
                    break;
                }
            }
        }
        public static SpecialFolderContent LoadSpecialFolder(string pathData)
        {
            if (!StringHandler.IsSpecialFolder(pathData))
            {
                return(null);
            }

            var folderContent = new SpecialFolderContent(pathData);

            if (System.String.Compare(pathData, "$" + VideoFolderName, System.StringComparison.Ordinal) == 0)
            {
                var folders = (NonFileSystemKnownFolder)KnownFolders.VideosLibrary;
                LoadSpecialFolder(folders, folderContent);
            }
            else if (System.String.Compare(pathData, "$" + MusicFolderName, System.StringComparison.Ordinal) == 0)
            {
                var folders = (NonFileSystemKnownFolder)KnownFolders.MusicLibrary;
                LoadSpecialFolder(folders, folderContent);
            }
            else if (System.String.Compare(pathData, "$" + DownloadFolderName, System.StringComparison.Ordinal) == 0)
            {
                var folders = (FileSystemKnownFolder)KnownFolders.Downloads;
                LoadSpecialFolder(folders, folderContent);
            }
            return(folderContent);
        }
Beispiel #10
0
 public void Save(StringHandler msgCallback)
 {
     if (this.Table is HotListsDataTable)
     {
         (this.Table as HotListsDataTable).Save(this, msgCallback);
     }
 }
Beispiel #11
0
    public GuiConsoleForm(string caption, string cmdPrompt, StringHandler h)
    {
        Text             = caption;
        prompt           = cmdPrompt;
        stringHandler    = h;
        textBox          = new ConsoleTextBox(this);
        textBox.Dock     = DockStyle.Fill;
        textBox.Font     = new Font("Tahoma", 10, FontStyle.Bold);
        textBox.WordWrap = false;

        Width = 750;
        Size  = new Size(467, 400);

        timer.Interval = 50;
        timer.Tick    += new EventHandler(Execute);

        this.Controls.Add(textBox);

        // quick interaction with code, including realtime right mouse drag
        textBox.MouseDown += Images.Form1.TMouseDownCode;
        textBox.MouseMove += Images.Form1.TMouseMoveCode;  // get changes on screen
        textBox.MouseMove += (s, e) => { if (e.Button == MouseButtons.Right)
                                         {
                                             textBox.ExecuteSelectionLine(true);
                                         }
        };                                                                                                          // and executed
        textBox.DoubleClick += (s, e) => textBox.ExecuteSelectionLine(false);
    }
Beispiel #12
0
 /// <summary>
 /// Extension Method Example: Add extra implementation to an object
 /// despite the behaviour(method) not being present in the class itself.
 /// </summary>
 /// <param name="b">The class to add an extension method to.</param>
 /// <param name="text">Text to print.</param>
 /// <param name="x">No. of times to print text.</param>
 public static void PrintXTimes(this StringHandler b, string text, int x)
 {
     for (int i = 0; i < x; i++)
     {
         Console.WriteLine(text);
     }
 }
Beispiel #13
0
        private string ReadString()
        {
            Builder.Clear();

            int  NextCharacter;
            char LastCharacter = char.MinValue;

            while ((NextCharacter = Reader.Read()) >= 0)
            {
                var CharacterRead = Convert.ToChar(NextCharacter);

                if (NextCharacter == '"' && LastCharacter != '\\')
                {
                    break;
                }
                else if (LastCharacter == '\\')
                {
                    if (CharacterRead == 'n')
                    {
                        CharacterRead = '\n';
                    }
                }

                LastCharacter = CharacterRead;
                if (CharacterRead != '\\')
                {
                    Builder.Append(CharacterRead);
                }
            }

            return(StringHandler.ReadString(Builder.ToString()));
        }
Beispiel #14
0
        /// <summary>
        /// Updates the items in find list.
        /// </summary>
        public void UpdateItems()
        {
            if (SearchActive)
            {
                Array.Resize(ref findlist, items.Count);

                var added = 0;
                for (var i = 0; i < items.Count; i++)
                {
                    var found = items[i].NeverFilter || StringHandler.FindFound(items[i].PresentText, findWords);

                    if (!found)
                    {
                        continue;
                    }
                    findlist[added] = i;
                    added++;
                }
                Array.Resize(ref findlist, added);
            }
            else
            {
                findlist = null;
            }
            SeekSelectedIndex();
            ListSizeChanged(true);
        }
        public void InsertSpacesTestValid()
        {
            string source   = "   SonicScrewdriver";
            string expected = "Sonic Screwdriver";

            Assert.AreEqual(expected, StringHandler.InsertSpaces(source));
        }
Beispiel #16
0
 private void addToTable(string cityName)
 {
     try
     {
         LocationForecast lf = forecast.getLocationForecast(cityName);
         if (table != null)
         {
             table.initializeTableRows();
             table.fillListBox();
         }
         customNotifier.notifier.ShowSuccess($"The city {StringHandler.capitalize(lf.Name)} was added to the table!");
     }
     catch
     {
         if (cityName == "")
         {
             customNotifier.notifier.ShowWarning("You did not enter a city name!");
         }
         else
         {
             customNotifier.notifier.ShowWarning($"City '{StringHandler.capitalize(cityName)}' does not exist!");
         }
     }
     searchText.Clear();
 }
        private bool LoadSubDirectories(DirectoryLoadOptions options, string path)
        {
            DirectoryInfo[] folderinfos;
            if (StringHandler.IsSpecialFolder(path))
            {
                var specialFolder = SpecialFolderLoader.LoadSpecialFolder(path);
                folderinfos = new DirectoryInfo[specialFolder.FolderPaths.Count];
                for (int i = 0; i < specialFolder.FolderPaths.Count; i++)
                {
                    folderinfos[i] = new DirectoryInfo(specialFolder.FolderPaths[i]);
                }
            }
            else
            {
                try
                {
                    var directoryInfo = new DirectoryInfo(path);

                    folderinfos = directoryInfo.GetDirectories();
                }
                catch (Exception e)
                {
                    ImpError error = new ImpError(ErrorType.FailedToOpenFolder, e.Message);
                    mainC.EventC.ShowError(error);
                    return(true);
                }
            }


            foreach (var folderinfo in folderinfos)
            {
                AddFolderToPlayList(options, folderinfo.FullName);
            }
            return(false);
        }
Beispiel #18
0
        private void GetContractInfo(string key)
        {
            string contactno = key;

            this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno);
            if (submodel.AddDate < Convert.ToDateTime("2016-3-11"))
            {
                companyName = "广东俊特团贷网络信息服务股份有限公司";
            }
            else
            {
                companyName = "东莞团贷网互联网科技服务有限公司";
            }


            this.subBasicModel  = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息
            this.proModel       = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value);
            this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value);          //借款人信息

            //印章小图片
            //this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image);

            RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0);

            if (WebUserAuth.UserId == publisherModel.Id)
            {
                this.subBasicModel.RealName     = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人
                this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard);  //出借人身份证号
            }
            else
            {
                this.publisherModel.RealName     = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人
                this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard);  //借款人身份证号
            }
        }
Beispiel #19
0
        public Json.Token Read()
        {
            if (Reader.BaseStream.Position >= Reader.BaseStream.Length)
            {
                return(Token = Json.Token.EndOfFile);
            }

            Token = (Json.Token)Reader.ReadByte();

            if (Token == Json.Token.ObjectKey || Token == Json.Token.String)
            {
                Value = StringHandler.ReadString(Reader.ReadString());
            }
            else if (Token == Json.Token.Float)
            {
                Value = Reader.ReadSingle();
            }
            else if (Token == Json.Token.Integer)
            {
                Value = Reader.ReadInt32();
            }
            else if (Token == Json.Token.Boolean)
            {
                Value = Reader.ReadBoolean();
            }
            else if (Token == Json.Token.Null)
            {
                Value = null;
            }

            return(Token);
        }
Beispiel #20
0
        /// <summary>
        /// Gets right operand as a Level object.
        /// </summary>
        /// <param name="data">raw data</param>
        /// <param name="handler">Handler of string if used.</param>
        /// <returns></returns>
        protected ILevel getRightOperand(string data, StringHandler handler = null)
        {
            if (String.IsNullOrWhiteSpace(data))
            {
                return(new Level()
                {
                    Type = LevelType.RightOperandEmpty
                });
            }

            Match m = Regex.Match(data, @"^\s*(=|:)(.*)$", RegexOptions.Singleline);

            if (!m.Success)
            {
                throw new SyntaxIncorrectException("PM - getRightOperand: incorrect data '{0}'", data);
            }

            string type = m.Groups[1].Value;
            string raw  = m.Groups[2].Value;

            string ldata = (handler == null)? raw : handler.recovery(raw);

            if (type == ":")
            {
                return(new Level()
                {
                    Type = LevelType.RightOperandColon, Data = eval(EvalType.RightOperandColon, ldata)
                });
            }
            return(new Level()
            {
                Type = LevelType.RightOperandStd, Data = eval(EvalType.RightOperandStd, ldata)
            });
        }
Beispiel #21
0
        /// <summary>
        /// 选中最多5中检查类型,查看对应的信息对比
        /// </summary>
        /// <param name="startDateTime"></param>
        /// <param name="endDateTime"></param>
        /// <param name="hospitalDistrict"></param>
        /// <returns></returns>
        public List <SpecialInspection> GetSpecialInspectionsGroupByTime(DateTime startDateTime, DateTime endDateTime, String[] inspactTypes, params String[] hospitalDistrict)
        {
            var specialInspections = new List <SpecialInspection>();
            var command            = GetSpecialCommandGroupByTime(startDateTime, endDateTime, inspactTypes, hospitalDistrict);
            var queryCommand       = db.GetSqlStringCommand(command);

            using (var reader = db.ExecuteReader(queryCommand))
            {
                while (reader.Read())
                {
                    var si = new SpecialInspection();
                    si.TimeStamp      = reader.GetString(0);
                    si.InspectionType = reader.GetString(1);


                    si.AppointmentDuration = StringHandler.GetDoubleByString(reader.IsDBNull(2) ? "0" : reader.GetString(2), 1);
                    si.ReportDuration      = StringHandler.GetDoubleByString(reader.IsDBNull(3) ? "0" : reader.GetString(3), 1);
                    si.ActualInspectNum    = StringHandler.GetDoubleByString(reader.IsDBNull(4) ? "0" : reader.GetString(4), 1);
                    si.BreakNum            = StringHandler.GetDoubleByString(reader.IsDBNull(5) ? "0" : reader.GetString(5), 1);

                    specialInspections.Add(si);
                }
            }
            return(specialInspections);
        }
        /// <summary>
        /// Handling spaces
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        protected string Spaces(string data)
        {
            Match m = Regex.Match
                      (
                data.Trim(), // // ->" data  "<- or ->data<-
                string.Format
                (
                    @"(?:
                        {0}   #1 - with space protection
                    |
                        (.*)  #2 - without
                    )?",
                    Pattern.DoubleQuotesContent
                ),
                RegexOptions.IgnorePatternWhitespace
                      );

            if (!m.Success)
            {
                throw new IncorrectSyntaxException($"Failed ConditionComponent->spaces - '{data}'");
            }

            if (m.Groups[1].Success)
            {
                return(StringHandler.Normalize(m.Groups[1].Value));
            }
            return(m.Groups[2].Value.Trim());
        }
Beispiel #23
0
        /// <summary>
        /// 表格呈现以检查类型分组的特检信息表
        /// </summary>
        /// <param name="startDateTime"></param>
        /// <param name="endDateTime"></param>
        /// <param name="hospitalDistrict"></param>
        /// <returns></returns>
        public List <SpecialInspection> GetSpecialInspections(DateTime startDateTime, DateTime endDateTime, params String[] hospitalDistrict)
        {
            var specialInspections = new List <SpecialInspection>();
            var hd      = String.Join(",", hospitalDistrict);
            var command = "SELECT JCLX,TO_CHAR(AVG(YYJCSC))  AS YYJCSC,TO_CHAR(AVG(JCBGSC))  AS JCBGSC,TO_CHAR(SUM(JCRS))  AS JCRS,TO_CHAR(SUM(SYRS))  AS SYRS FROM TJBG3.TJ_JCQKB "
                          + " WHERE JCRQ>=TO_DATE('" + startDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS') "
                          + " AND JCRQ<=TO_DATE('" + startDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS')  AND  YQDM IN (" + hd + ")"
                          + " GROUP BY JCLX ";

            var queryCommand = db.GetSqlStringCommand(command);

            using (var reader = db.ExecuteReader(queryCommand))
            {
                while (reader.Read())
                {
                    var si = new SpecialInspection();
                    si.InspectionType      = reader.GetString(0);
                    si.AppointmentDuration = StringHandler.GetDoubleByString(reader.IsDBNull(1)?"0":reader.GetString(1), 1);
                    si.ReportDuration      = StringHandler.GetDoubleByString(reader.IsDBNull(2) ? "0" : reader.GetString(2), 1);
                    si.ActualInspectNum    = StringHandler.GetDoubleByString(reader.IsDBNull(3) ? "0" : reader.GetString(3), 1);
                    si.BreakNum            = StringHandler.GetDoubleByString(reader.IsDBNull(4) ? "0" : reader.GetString(4), 1);

                    specialInspections.Add(si);
                }
            }
            return(specialInspections);
        }
Beispiel #24
0
        /// <summary>
        /// 增加空格,以变换行
        /// </summary>
        /// <param name="mess"></param>
        private string AddSapce(string mess)
        {
            string strRet         = string.Empty;
            int    pixofchar      = 7;                                                  //每个字符点6个像素点
            int    chLen          = System.Text.Encoding.Default.GetBytes(mess).Length; //显示的字符个数
            int    showWidth      = this.Width - 30;                                    //显示宽度
            int    firstRowShows  = (showWidth - (4 * 2 + 1) * pixofchar) / pixofchar;  //第一行显示的字符数
            int    secondRowShows = showWidth / pixofchar;                              //第二行开始显示的字符数
            string subStr         = string.Empty;

            if (chLen < firstRowShows)
            {
                return(mess);
            }
            strRet += StringHandler.SubString(mess, firstRowShows);
            mess    = mess.Substring(strRet.Length);
            chLen  -= System.Text.Encoding.Default.GetBytes(strRet).Length;
            while (chLen >= 0)
            {
                if (chLen <= secondRowShows)
                {
                    strRet += " " + mess;
                    break;
                }

                subStr  = StringHandler.SubString(mess, secondRowShows);
                strRet += " " + subStr;
                chLen  -= System.Text.Encoding.Default.GetBytes(subStr).Length;
                mess    = mess.Substring(subStr.Length);
            }
            return(strRet);
        }
Beispiel #25
0
        public void ImportDeltasBof2(string pipscsv, string filename, StringHandler msgCallback)
        {
            if (string.IsNullOrEmpty(pipscsv))
            {
                return;
            }
            try
            {
                if (pipscsv.EndsWith("_ins.pips"))
                {
                    ImportDeltaInserts(filename, pipscsv, msgCallback);
                }

                else if (pipscsv.EndsWith("_del.pips"))
                {
                    ImportDeltaDeletes(filename, pipscsv, msgCallback);
                }

                foreach (HotListDataFile df in this.dataFiles)
                {
                    df.HotList.Reindex();
                }
            }
            catch (Exception ex)
            {
                //PIPS.Logger.Exception(ex);
            }
        }
Beispiel #26
0
 public LoginListener(VoidHandler eventSucceed, StringHandler eventFailed, VoidHandler eventCancelled)
     : base("com.fuji.fujisdk.oauth.listener.LoginListener")
 {
     this.eventSucceed   = eventSucceed;
     this.eventFailed    = eventFailed;
     this.eventCancelled = eventCancelled;
 }
Beispiel #27
0
 private void setCurrentCityInformation()
 {
     currentCity.Content         = StringHandler.toUTFString(currentCityWeather.name);
     temmCurrentLocation.Content = currentCityWeather.main.getCelsius();
     icon.Content         = currentCityWeather.weather[0].getIcon();
     measuredTime.Content = DateTime.Now.ToString("hh:mm tt");
 }
Beispiel #28
0
        /// <summary>
        /// 以时间来分组获取各科室各阶段的就诊时长
        /// 跨年按年,跨天按天,跨月按月
        /// </summary>
        /// <param name="sTime"></param>
        /// <param name="eTime"></param>
        ///
        /// <param name="depts"></param>
        /// <param name="hospitalDistrict"></param>
        public List <DeptAverageTreatmentTime> GetDeptTreatmentAverageTimeGroupByTime(DateTime sTime, DateTime eTime, Int32[] depts,
                                                                                      params string[] hospitalDistrict)
        {
            var hd = String.Join(",", hospitalDistrict);
            var dp = String.Join(",", depts);

            var detpAvgTreatment = new List <DeptAverageTreatmentTime>();
            var command          = GetCommandGroupByTime(sTime, eTime, depts, hospitalDistrict);
            var queryCommand     = db.GetSqlStringCommand(command);

            using (var reader = db.ExecuteReader(queryCommand))
            {
                while (reader.Read())
                {
                    var att = new DeptAverageTreatmentTime();
                    att.StaticsTime    = reader.GetString(0);
                    att.SpecialistId   = reader.GetInt32(1);
                    att.SpecialistName = specialists[att.SpecialistId];

                    att.Appointment       = StringHandler.GetDoubleByString(reader.IsDBNull(2) ? "0" : reader.GetString(2), 1);
                    att.AwaitingDiagnosis = StringHandler.GetDoubleByString(reader.IsDBNull(3) ? "0" : reader.GetString(3), 1);
                    att.Diagnosis         = StringHandler.GetDoubleByString(reader.IsDBNull(4) ? "0" : reader.GetString(4), 1);
                    att.PayFees           = StringHandler.GetDoubleByString(reader.IsDBNull(5) ? "0" : reader.GetString(5), 1);
                    att.MedicineReceiving = StringHandler.GetDoubleByString(reader.IsDBNull(6) ? "0" : reader.GetString(6), 1);
                    detpAvgTreatment.Add(att);
                }
            }

            return(detpAvgTreatment);
        }
Beispiel #29
0
        public void protectTest()
        {
            StringHandler target = new StringHandler();
            string        actual = target.protectMixedQuotes("test \"str1\" - 'str2' data");

            Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace));
            Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace));
        }
Beispiel #30
0
        public Thread newListener(StringHandler handler)
        {
            strHandler = handler;

            Thread listener = new Thread(new ThreadStart(listen));
            listener.Start();
            return listener;
        }
    public static void Main(string[] args)
    {
        var integerHandler = new IntegerHandler();
        var stringHandler  = new StringHandler();

        ValidateHandler(integerHandler);
        ValidateHandler(stringHandler);
    }
        private IEnumerable<Unicorn> ApplQueryToHandler(string queryValue)
        {
            var handler = new StringHandler<Unicorn>();
            var prop = Unicorns.GetProperty(u => u.Name);

            var q = PropertyQuery.Create(prop.Name, queryValue);

            return handler.ApplyQuery(Unicorns.All, prop, q);
        }
Beispiel #33
0
 public Layout(String origin, LayoutType type)
 {
     var stringHandler = new StringHandler(origin);
     this.type = type;
     if (type == LayoutType.Simple || type == LayoutType.Code || type == LayoutType.Image)
         this.origin = origin;
     else
         insideLayouts = stringHandler.Convert();
 }
 public static void ShouldMoveIteratorInWord(String testedWord, int movesCount,
     LayoutType expectedType, String expectedWord, int expectedLastIndex)
 {
     var temp = new StringHandler(testedWord);
     for (int i = 0; i < movesCount; ++i)
         temp.MoveIterator();
     var result = temp.oneLevel.GetLastPair();
     Assert.AreEqual(expectedType, result.Item1);
     Assert.AreEqual(expectedWord, result.Item2);
     Assert.AreEqual(expectedLastIndex, temp._iterator);
 }
Beispiel #35
0
    public GuiConsoleForm(string caption, string cmdPrompt, StringHandler h) 
    {        
        Text = caption;
        prompt = cmdPrompt;
        stringHandler = h;
        textBox = new ConsoleTextBox(this);
        textBox.Dock = DockStyle.Fill;
        textBox.Font = new Font("Tahoma",10,FontStyle.Bold);
        textBox.WordWrap = false;
        
        Width = 750;
        Size = new Size(467, 400);

        timer.Interval = 50;
        timer.Tick += new EventHandler(Execute);
        
        this.Controls.Add(textBox);
    }
Beispiel #36
0
        public Form1()
        {
            InitializeComponent();

            isSearchTextBoxEmpty = true;
            isChatTextBoxNotFocusedAndEmpty = true;
            isMyNameNotFocusedAndEmpty = true;

            isIDAvailable = false;
            isRegister = false;

            backgroundColor = System.Drawing.Color.PaleTurquoise;
            lightColor = System.Drawing.Color.Azure;
            darkColor = System.Drawing.Color.LightSeaGreen;
            //loadTheme();

            emoticonButtonNum = 32;
            emoticonImages = new System.Drawing.Image[emoticonButtonNum];
            for (int i = 0; i < emoticonButtonNum; ++i)
            {
                emoticonImages[i] = (Image)Properties.Resources.ResourceManager.GetObject("_" + (i+1).ToString());
            }
            genEmoticonButtons();

            defaultUserImage = global::chatRoomClient.Properties.Resources.defaultImage;
            chatImage = global::chatRoomClient.Properties.Resources.chatBlack;
            folderImage = global::chatRoomClient.Properties.Resources.folder;
            micImage = global::chatRoomClient.Properties.Resources.mic;

            msgHandler = parseReceiveMessage;

            client = chatSocket.connect();
            client.newListener(parseReceiveMessage);

            userListTable.Visible = false;
            this.ActiveControl = myNameTextBox;     //focus on myName
        }
Beispiel #37
0
 public void RegisterDirectory(string dir, StringHandler callBack)
 {
     OpenDirectories.Add(dir, callBack);
     StringSent += OpenDirectories[dir];
 }
Beispiel #38
0
 private StringShim(StringHandler callback)
 {
     m_target += callback;
 }
 public static void ShouldRightDetermineTypeOfWord(String testedWord, int index, 
     LayoutType expectedType, String expectedWord, int expectedLastIndex)
 {
     var temp = new StringHandler(testedWord);
     var result = temp.GetNextUnderbar(index);
     Assert.AreEqual(expectedType ,result.Type);
     Assert.AreEqual(expectedWord ,result.CleanedWord);
     Assert.AreEqual(expectedLastIndex, result.LastIndex);
 }
Beispiel #40
0
        public roomForm()
        {
            InitializeComponent();

            msgHandler = updateMessage;
        }
Beispiel #41
0
 static CrossFire()
 {
     NewData += new StringHandler(CrossFire_NewData);
     SendCommandTimeOut = new System.Timers.Timer(4000);
     SendCommandTimeOut.Elapsed += new System.Timers.ElapsedEventHandler(SendCommandTimeOut_Elapsed);
 }
Beispiel #42
0
 public static StringHandler Create(StringHandler target)
 {
     StringShim shim = new StringShim(target);
     return new StringHandler(shim.DoInvoke);
 }
 /// <summary>
 /// Handler of mixed data SBE-Scripts
 /// Format: https://bitbucket.org/3F/vssolutionbuildevent/issue/22/#comment-12739932
 /// </summary>
 /// <param name="data">mixed data</param>
 /// <param name="allowMSBuild">Allows post-processing with MSBuild or not.
 /// Some components can require immediate processing with evaluation, before passing control to next level.
 /// </param>
 /// <returns>prepared and evaluated data</returns>
 public string parse(string data, bool allowMSBuild)
 {
     lock(_lock)
     {
         _depthLevel = 0;
         postProcessingMSBuild = allowMSBuild;
         StringHandler hString = new StringHandler();
         return hString.recovery(parse(hString.protectMixedQuotes(data), _depthLevel, hString));
     }
 }
        /// <param name="data">Mixed data</param>
        /// <param name="level">Nesting level</param>
        /// <param name="hString">Handler of strings if exist</param>
        /// <returns>Prepared & evaluated data</returns>
        protected string parse(string data, int level, StringHandler hString = null)
        {
            if(level >= DEPTH_LIMIT) {
                _depthLevel = 0;
                throw new LimitException("Nesting level of '{0}' reached. Aborted.", DEPTH_LIMIT);
            }

            return Regex.Replace(data, ContainerPattern, delegate(Match m)
            {
                if(m.Groups[1].Value.Length > 1) { //escape
                    Log.Debug("SBEScripts: escape - '{0}'", m.Groups[2].Value);
                    return "#" + escapeMSBuildData(m.Groups[2].Value, true);
                }
                string raw = m.Groups[2].Value;

                Log.Trace("SBEScripts-data: to parse '{0}'", raw);
                if(hString != null) {
                    return selector(hString.recovery(raw));
                }
                return selector(raw);
            },
            RegexOptions.IgnorePatternWhitespace);
        }
Beispiel #45
0
        /// <summary>
        /// Handler for current data
        /// </summary>
        /// <param name="data">mixed data</param>
        /// <returns>prepared and evaluated data</returns>
        public override string parse(string data)
        {
            var hString = new StringHandler();

            Match m = CRule.Match(hString.protectMixedQuotes(data.Trim()));
            if(!m.Success) {
                throw new SyntaxIncorrectException("Failed TryComponent - '{0}'", data);
            }

            string blockTry     = hString.recovery(m.Groups[1].Value);
            string blockCatch   = hString.recovery(m.Groups[2].Value);
            string args         = (m.Groups["args"].Success)? hString.recovery(m.Groups["args"].Value) : null;

            try {
                return evaluate(blockTry);
            }
            catch(Exception ex) {
                return doCatch(blockCatch, ex, (new PM()).arguments(args));
            }
        }
        /// <summary>
        /// Handler for current data
        /// </summary>
        /// <param name="data">mixed data</param>
        /// <returns>prepared and evaluated data</returns>
        public override string parse(string data)
        {
            lock(_lock) {
                _hString = new StringHandler();
                _depthBracketsLevel = 0;
            }

            Match m = Regex.Match(_hString.protectMixedQuotes(data.Trim()),
                                    String.Format(@"^\[\s*
                                                    {0}            #1 - Condition
                                                    \s*
                                                    {1}            #2 - Body if true
                                                    (?:
                                                      \s*else\s*
                                                      {1}          #3 - Body if false (optional)
                                                    )?\s*\]",
                                                    RPattern.RoundBracketsContent,
                                                    RPattern.CurlyBracketsContent
                                                 ),
                                                 RegexOptions.IgnorePatternWhitespace);

            if(!m.Success) {
                throw new SyntaxIncorrectException("Failed ConditionComponent - '{0}'", data);
            }

            string condition    = m.Groups[1].Value;
            string bodyIfTrue   = _hString.recovery(m.Groups[2].Value);
            string bodyIfFalse  = (m.Groups[3].Success)? _hString.recovery(m.Groups[3].Value) : String.Empty;

            return parse(_hString.protectCores(condition), bodyIfTrue, bodyIfFalse);
        }
Beispiel #47
0
 public Layout(String origin)
 {
     var stringHandler = new StringHandler(origin);
     type = LayoutType.Simple;
     insideLayouts = stringHandler.Convert();
 }
 public static int[] ShouldSplitAnyCombinations(String tested)
 {
     var temp = new StringHandler(String.Empty);
     var result = temp.FindLastMark(tested);
     return new[] { result.Item1, result.Item2 };
 }
Beispiel #49
0
        /// <summary>
        /// Entry point of analyser.
        /// </summary>
        /// <param name="data">mixed data</param>
        protected void detect(string data)
        {
            Log.Trace("PM-detect: entered with '{0}'", data);

            StringHandler h = new StringHandler();
            data            = h.protectMixedQuotes(data);

            Match m = Regex.Match(data, Condition, RegexOptions.IgnorePatternWhitespace);
            if(!m.Success) {
                levels.Add(getRightOperand(data, h));
                return;
            }

            string method       = (m.Groups[1].Success)? m.Groups[1].Value : null;
            string arguments    = (m.Groups[2].Success)? m.Groups[2].Value : null;
            string property     = (m.Groups[3].Success)? m.Groups[3].Value : null;
            string operation    = m.Groups[4].Value;
            Log.Trace("PM-detect: found '{0}', '{1}', '{2}', '{3}'", property, method, arguments, operation);

            if(property != null)
            {
                levels.Add(new Level() {
                    Type = LevelType.Property,
                    Data = property,
                });
            }
            else
            {
                levels.Add(new Level() {
                    Type = LevelType.Method,
                    Data = method,
                    Args = extractArgs(h.recovery(arguments)),
                });
            }

            detect(h.recovery(operation));
        }
 public static String ShouldDeleteIgnoredLayouts(String input)
 {
     var temp = new StringHandler(String.Empty);
     return temp.SimplifyCodeLayout(input);
 }
Beispiel #51
0
        /// <summary>
        /// Extracts all arguments from line.
        /// </summary>
        /// <param name="data">Raw line with user arguments.</param>
        /// <returns>List of parsed arguments or null value if data is empty.</returns>
        /// <exception cref="SyntaxIncorrectException">If incorrect arguments line.</exception>
        protected Argument[] extractArgs(string data)
        {
            if(String.IsNullOrWhiteSpace(data)) {
                return new Argument[0];
            }

            StringHandler h = new StringHandler();
            string[] raw    = h.protectMixedQuotes(data).Split(',');

            Argument[] ret = new Argument[raw.Length];
            for(int i = 0; i < raw.Length; ++i)
            {
                string arg = h.recovery(raw[i]).Trim();
                if(arg.Length < 1) {
                    throw new SyntaxIncorrectException("PM - extractArgs: incorrect arguments line '{0}'", data);
                }
                ret[i] = detectArgument(arg);
            }
            return ret;
        }
Beispiel #52
0
        /// <summary>
        /// Gets right operand as a Level object.
        /// </summary>
        /// <param name="data">raw data</param>
        /// <param name="handler">Handler of string if used.</param>
        /// <returns></returns>
        protected Level getRightOperand(string data, StringHandler handler = null)
        {
            if(String.IsNullOrWhiteSpace(data)) {
                return new Level() { Type = LevelType.RightOperandEmpty };
            }

            Match m = Regex.Match(data, @"\s*(=|:)(.*)$");
            if(!m.Success) {
                throw new SyntaxIncorrectException("PM - getRightOperand: incorrect data '{0}'", data);
            }

            string type = m.Groups[1].Value;
            string raw  = m.Groups[2].Value;

            return new Level() {
                Type = (type == ":")? LevelType.RightOperandColon : LevelType.RightOperandStd,
                Data = (handler == null)? raw : handler.recovery(raw)
            };
        }