Beispiel #1
0
        public ucToolEmpSum()
        {
            InitializeComponent();

            luProject.Properties.DataSource   = Project.AccessibleList().Select(p => new { Project = p.Name, Code = p.Code, MatchId = p.MatchId, DisplayName = p.DisplayName });
            luLemNumber.Properties.DataSource = LemHeader.GetAllLemNumber().Select(x => new { LemNum = x });

            Func <string, string, int, GridColumn> CreateColumn = new Func <string, string, int, GridColumn>((field, caption, visibleIndex) =>
            {
                GridColumn column   = gvSummary.Columns.AddVisible(field, caption);
                column.VisibleIndex = visibleIndex;
                return(column);
            });

            int visionIndex = 0;

            new List <string> {
                ColName.EmpNum, ColName.EmployeeName, ColName.WorkClass, ColName.Project
            }.ForEach(
                x => gvSummary.Columns[x].VisibleIndex = visionIndex++
                );

            foreach (var timecode in TimeCode.SubList(EnumValueType.Hours))
            {
                tableLabour.Columns.Add(ColName.BillRateI(timecode), Type.GetType("System.Decimal"));
                var rateCol = CreateColumn(ColName.BillRateI(timecode), $"{timecode.Desc} Bill Rate", visionIndex++);
                rateCol.DisplayFormat.FormatType   = FormatType.Numeric;
                rateCol.DisplayFormat.FormatString = "c2";
                rateCol.OptionsColumn.AllowEdit    = false;

                tableLabour.Columns.Add(ColName.EnterValueI(timecode), Type.GetType("System.Decimal"));
                var hourCol = CreateColumn(ColName.EnterValueI(timecode), $"{timecode.Desc} Hours", visionIndex++);
                hourCol.DisplayFormat.FormatType   = FormatType.Numeric;
                hourCol.DisplayFormat.FormatString = "n2";
                hourCol.OptionsColumn.AllowEdit    = false;
                hourCol.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
                    new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, hourCol.FieldName, "{0:n2}")
                });
            }

            foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Dollars))
            {
                tableLabour.Columns.Add(ColName.EnterValueI(timecode), Type.GetType("System.Decimal"));
                var amountCol = CreateColumn(ColName.EnterValueI(timecode), timecode.Desc, visionIndex++);
                amountCol.DisplayFormat.FormatType   = FormatType.Numeric;
                amountCol.DisplayFormat.FormatString = "c2";
                amountCol.OptionsColumn.AllowEdit    = false;
                amountCol.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
                    new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, amountCol.FieldName, "{0:c2}")
                });
            }

            gvSummary.Columns[ColName.TotalHours].VisibleIndex = visionIndex++;
            gvSummary.Columns[ColName.BillAmount].VisibleIndex = visionIndex++;
            gvSummary.BestFitColumns(true);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a List of ProfileColumn instances from the passed enumerable column names
        /// </summary>
        /// <param name="ColNames">an enumerable of column names</param>
        /// <returns>The List</returns>
        public static List <ProfileColumn> MakeColList(IEnumerable <string> ColNames)
        {
            List <ProfileColumn> ColList = new List <ProfileColumn>();

            foreach (string ColName in ColNames)
            {
                ColList.Add(new ProfileColumn(ColName.Trim()));
            }
            return(ColList);
        }
Beispiel #3
0
        /// <summary>
        /// 内部方法:根据数据表行记录构建实体类型
        /// </summary>
        /// <param name="TabInfo"></param>
        /// <param name="dr"></param>
        /// <returns></returns>
        public static T Generate <T>(T ModelObj, TableDefinition TabInfo, DataRow dr)
        {
            int DefineColsCount = TabInfo.ORMColList.Count;
            int ResultColsCount = dr.ColumnNames.Count;

            if (DefineColsCount > ResultColsCount)
            {
                foreach (string ColumnName in dr.ColumnNames)
                {
                    TabInfo.ORM_TypePropDic[ColumnName.ToUpper()].SetValue(ModelObj, dr[ColumnName]);
                }
            }
            else
            {
                foreach (string ColName in TabInfo.ORMColList)
                {
                    if (dr.ColumnNames.Contains(ColName))
                    {
                        if (dr[ColName] != DBNull.Value)
                        {
                            var          ColVal = dr[ColName];
                            PropertyInfo Prop   = TabInfo.ORM_TypePropDic[ColName.ToUpper()];
                            if (Prop.PropertyType == typeof(int))
                            {
                                Prop.SetValue(ModelObj, Convert.ToInt32(ColVal));
                            }
                            else if (Prop.PropertyType == typeof(long))
                            {
                                Prop.SetValue(ModelObj, Convert.ToInt64(ColVal));
                            }
                            else if (Prop.PropertyType == typeof(decimal))
                            {
                                Prop.SetValue(ModelObj, Convert.ToDecimal(ColVal));
                            }
                            else if (Prop.PropertyType == typeof(DateTime))
                            {
                                Prop.SetValue(ModelObj, Convert.ToDateTime(ColVal));
                            }
                            else if (Prop.PropertyType == typeof(string))
                            {
                                Prop.SetValue(ModelObj, Convert.ToString(ColVal));
                            }
                            else
                            {
                                Prop.SetValue(ModelObj, ColVal);
                            }
                        }
                    }
                }
            }
            return(ModelObj);
        }
        public static DataTable ReadExcel(ExcelPackage Excel)
        {
            //Console.Write("Enter The Ecel File Path:");
            /*string ExcelPath=Console.ReadLine();*/
            var WorkSheet = Excel.Workbook.Worksheets[0];

            int       rowCount = WorkSheet.Dimension.End.Row;
            int       colCount = WorkSheet.Dimension.End.Column;
            DataTable Dt       = new DataTable();
            DataRow   row;

            for (int i = 1; i <= rowCount; i++)
            {
                row = Dt.NewRow();
                for (int j = 1; j <= colCount; j++)
                {
                    string ColName;
                    if (i == 1)
                    {
                        ColName = WorkSheet.Cells[i, j].Value.ToString();
                        if (ColName.StartsWith("Title"))
                        {
                            TitleColumns.Add(ColName);
                        }
                        DataColumn column = new DataColumn(ColName);
                        Dt.Columns.Add(column);
                    }
                    else
                    {
                        ColName = WorkSheet.Cells[1, j].Value.ToString();

                        /* if (WorkSheet.Cells[i, j].Value != null)
                         *   row[ColName] = WorkSheet.Cells[i, j].Value.ToString();*/
                        string val = WorkSheet.Cells[i, j].Value.ToString().TrimStart('\\');
                        val          = val.Replace(OldTeamProject, ProjectName);
                        row[ColName] = val;
                    }
                }
                if (i != 1)
                {
                    Dt.Rows.Add(row);
                }
            }
            return(Dt);
        }
Beispiel #5
0
        public override int GetHashCode()
        {
            int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this

            hashCode = hashCode * 23 + Id.GetHashCode();
            hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode());
            hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode());
            hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode());
            hashCode = hashCode * 23 + Dr.GetHashCode();
            hashCode = hashCode * 23 + Ts.GetHashCode();
            hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode());
            hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode());
            hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode());
            hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode());
            hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode());
            hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode());
            hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode());
            hashCode = hashCode * 23 + (ColName == null ? 0 : ColName.GetHashCode());
            hashCode = hashCode * 23 + (ColComment == null ? 0 : ColComment.GetHashCode());
            hashCode = hashCode * 23 + (ColDefault == null ? 0 : ColDefault.GetHashCode());
            hashCode = hashCode * 23 + (ColType == null ? 0 : ColType.GetHashCode());
            hashCode = hashCode * 23 + ColProperty.GetHashCode();
            hashCode = hashCode * 23 + ColLength.GetHashCode();
            hashCode = hashCode * 23 + DisplayWidth.GetHashCode();
            hashCode = hashCode * 23 + ColOrder.GetHashCode();
            hashCode = hashCode * 23 + ColPrecision.GetHashCode();
            hashCode = hashCode * 23 + NullAble.GetHashCode();
            hashCode = hashCode * 23 + ShowAble.GetHashCode();
            hashCode = hashCode * 23 + IsDefaultCol.GetHashCode();
            hashCode = hashCode * 23 + (CtrlType == null ? 0 : CtrlType.GetHashCode());
            hashCode = hashCode * 23 + (RefTable == null ? 0 : RefTable.GetHashCode());
            hashCode = hashCode * 23 + (RefID == null ? 0 : RefID.GetHashCode());
            hashCode = hashCode * 23 + (RefCode == null ? 0 : RefCode.GetHashCode());
            hashCode = hashCode * 23 + (RefName == null ? 0 : RefName.GetHashCode());
            hashCode = hashCode * 23 + (RefCondition == null ? 0 : RefCondition.GetHashCode());
            hashCode = hashCode * 23 + (RefCols == null ? 0 : RefCols.GetHashCode());
            hashCode = hashCode * 23 + (RefType == null ? 0 : RefType.GetHashCode());
            hashCode = hashCode * 23 + (MainTable == null ? 0 : RefType.GetHashCode());
            hashCode = hashCode * 23 + (MainTableCol == null ? 0 : MainTableCol.GetHashCode());
            hashCode = hashCode * 23 + (CalculationExpr == null ? 0 : CalculationExpr.GetHashCode());
            return(hashCode);
        }
Beispiel #6
0
        /// <summary>
        /// Narrows each header in the passed Dictionary to match the width of the dictionary entry. Replaces
        /// the dictionary with a new dictionary.
        /// </summary>
        /// <param name="Cols">A dictionary in which each key is a column name and each value
        /// is the max width of that column</param>

        public static void NarrowHeaders(Dictionary <string, ColHeader> Cols)
        {
            // first, narrow the headers. This could create dups
            foreach (string ColName in Cols.Keys)
            {
                Cols[ColName].TruncatedColName = ColName.Left(Cols[ColName].FieldWidth);
            }

            int Safety = 10000;

            // now try to shorten
            string[] TruncatedColNames = GetTruncatedColNames(Cols);
            while (new HashSet <string>(TruncatedColNames).Count != TruncatedColNames.Length)
            {
                foreach (string ColName in Cols.Keys)
                {
                    List <string> Dups;
                    if ((Dups = GetDups(Cols, ColName)).Count != 0)
                    {
                        MakeUnique(Cols, ColName, Dups);
                    }
                }
                if (--Safety < 0)
                {
                    throw new ExportException("Failed to narrow column headers");
                }
                TruncatedColNames = GetTruncatedColNames(Cols);
            }

            //Dictionary<string, ColHeader> NewCols = new Dictionary<string, ColHeader>();
            //foreach (string ColName in Cols.Keys)
            //{
            //    Cols[ColName].TruncatedColName =
            //    //NewCols.Add(ColHeader, new ColHeader(ColHeader.Length);
            //}
            //Cols = NewCols;
        }
Beispiel #7
0
        static void ExtractAllMenu2()
        {
            HtmlDocument document = new HtmlWeb().Load("https://www.premierleague.com/clubs/131/Brighton-and-Hove-Albion/squad");

            string xPath       = "//*[@id='mainContent']/div[3]/div/ul/li[*]";
            var    nodes       = document.DocumentNode.SelectNodes(xPath).ToArray();
            var    teamPlayers = new List <Dictionary <string, string> >();
            string result      = string.Empty;

            foreach (HtmlNode node in nodes)
            {
                var    playerInfo = new Dictionary <string, string>();
                string output     = "0" + node.InnerText.Trim().Replace("View Player", string.Empty);
                result = string.Empty;
                Regex regex = new Regex(@"\b[\S]*[\s]{0,1}[\S]*[\s]{0,1}[\S]*[\s]{0,1}[\S]*\b");

                Match m     = regex.Match(output);
                int   count = 0;


                while (m.Success)
                {
                    result = m.Value;

                    if (result != "" && result != "Nationality" && result != "Appearances" && result != "Clean sheets" && result != "Goals" && result != "Assists")
                    {
                        ColName colStr = (ColName)count;

                        if (count <= 4)
                        {
                            playerInfo.Add(colStr.ToString(), result);
                        }
                        else
                        {
                            switch (playerInfo["POSITION"])
                            {
                            case "Goalkeeper":
                                if (count == 6 || count == 7)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Defender":
                                if (count == 7)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Midfielder":
                                if (count == 5)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Forward":
                                if (count == 5)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;
                            }
                        }
                        count++;
                    }
                    m = m.NextMatch();
                }
                teamPlayers.Add(playerInfo);
            }
            foreach (var item in teamPlayers)
            {
                foreach (var item2 in item)
                {
                    Console.WriteLine(item2.Key + " : " + item2.Value);
                }
                Console.WriteLine();
            }
            Console.ReadLine();
            //return teamPlayers;
        }
Beispiel #8
0
        public void SetData(List <LemHeader> headerList)
        {
            tableLabour.Clear();

            var table = LemHeader.GetCostCodeSummary(headerList.Select(x => x.Id).ToList());
            var list  = table.Select().Select(r => new
            {
                EmpNum        = Convert.ToInt32(r["EmpNum"]),
                WorkClassCode = Convert.ToString(r["WorkClassCode"]),
                Billable      = Convert.ToBoolean(r["Billable"]),
                ProjectId     = Convert.ToInt32(r["ProjectId"]),
                ChangeOrderId = ConvertEx.ToNullable <int>(r["ChangeOrderId"]),
                Level1Id      = ConvertEx.ToNullable <int>(r["Level1Id"]),
                Level2Id      = ConvertEx.ToNullable <int>(r["Level2Id"]),
                Level3Id      = ConvertEx.ToNullable <int>(r["Level3Id"]),
                Level4Id      = ConvertEx.ToNullable <int>(r["Level4Id"]),
                TimeCodeId    = Convert.ToInt32(r["TimeCodeId"]),
                SumWorkHour   = ConvertEx.ToNullable <decimal>(r["SumWorkHour"]),
                SumAmount     = ConvertEx.ToNullable <decimal>(r["SumAmount"]),
            });

            var groupList = list.ToLookup(x => new
            {
                x.EmpNum,
                x.WorkClassCode,
                x.Billable,
                x.ProjectId,
                x.ChangeOrderId,
                x.Level1Id,
                x.Level2Id,
                x.Level3Id,
                x.Level4Id,
                EmpName     = Employee.GetEmployee(x.EmpNum)?.DisplayName,
                WorkClass   = WorkClass.GetWorkClass(x.WorkClassCode).DisplayName,
                Project     = Project.GetProject(x.ProjectId),
                ChangeOrder = ChangeOrder.GetChangeOrder(x.ProjectId, x.ChangeOrderId)?.DisplayName,
                Level1      = LevelOneCode.GetLevelCode(x.Level1Id)?.DisplayName,
                Level2      = LevelTwoCode.GetLevelCode(x.Level2Id)?.DisplayName,
                Level3      = LevelThreeCode.GetLevelCode(x.Level3Id)?.DisplayName,
                Level4      = LevelFourCode.GetLevelCode(x.Level4Id)?.DisplayName
            }).OrderBy(x => x.Key.Level1).ThenBy(x => x.Key.Level2).ThenBy(x => x.Key.Level3).ThenBy(x => x.Key.Level4).ThenBy(x => x.Key.EmpName).ThenBy(x => x.Key.Project).ThenBy(x => x.Key.ChangeOrder).ThenBy(x => x.Key.WorkClass).ThenBy(x => x.Key.Billable).ToList();

            groupList.ForEach(g =>
            {
                DataRow row = tableLabour.Rows.Add(
                    g.Key.EmpNum,
                    g.Key.EmpName,
                    g.Key.WorkClass,
                    g.Key.Project,
                    g.Key.ChangeOrder,
                    g.Key.Level1,
                    g.Key.Level2,
                    g.Key.Level3,
                    g.Key.Level4,
                    g.Key.Billable,
                    null,
                    null);

                decimal?billRate;
                decimal totalHours  = 0;
                decimal billAmounts = 0;
                foreach (var timecode in TimeCode.ListForCompany())
                {
                    if (timecode.ValueType == EnumValueType.Hours)
                    {
                        billRate = ProjectWorkClass.GetBillRate(g.Key.ProjectId, timecode.MatchId, g.Key.WorkClassCode);
                        row[ColName.BillRateI(timecode)] = (object)billRate ?? DBNull.Value;

                        decimal hours = g.Where(x => x.TimeCodeId == timecode.MatchId).Sum(x => x.SumWorkHour) ?? 0;
                        row[ColName.EnterValueI(timecode)] = hours != 0 ? (object)hours : DBNull.Value;

                        totalHours  += hours;
                        billAmounts += (billRate ?? 0) * hours;
                    }
                    else
                    {
                        decimal amount = g.Where(x => x.TimeCodeId == timecode.MatchId).Sum(x => x.SumAmount) ?? 0;
                        row[ColName.EnterValueI(timecode)] = amount != 0 ? (object)amount : DBNull.Value;
                        billAmounts += amount;
                    }

                    row[ColName.TotalHours] = totalHours != 0 ? (object)totalHours : DBNull.Value;
                    row[ColName.BillAmount] = billAmounts != 0 ? (object)billAmounts : DBNull.Value;
                }
            });
        }
Beispiel #9
0
 public override int GetHashCode()
 {
     return((DBName != null ? DBName.GetHashCode() : 0) + (ColName != null ? ColName.GetHashCode() : 0) + (this.NodeInfo != null ? NodeInfo.GetHashCode() : 0));
 }
        public DataTable CreateTableReportSub_QCNghe(DataTable dtDiem, DataTable dtThanhPhanDiem, int ColStart, int IDKQHT_ThanhPhanTBHS)
        {
            DataTable dtReport = new DataTable();

            dtReport.Columns.Add("MaSinhVien", typeof(string));
            dtReport.Columns.Add("HoVa", typeof(string));
            dtReport.Columns.Add("Ten", typeof(string));
            for (int i = 1; i <= 6; i++)
            {
                dtReport.Columns.Add("DK_" + i.ToString(), typeof(double));
                //dtReport.Columns.Add("HS2_" + i.ToString(), typeof(double));
            }
            for (int i = 1; i <= 3; i++)
            {
                dtReport.Columns.Add("THI_" + i.ToString(), typeof(double));
                dtReport.Columns.Add("TK_" + i.ToString(), typeof(double));
            }
            dtReport.Columns.Add("TBHS", typeof(double));
            dtReport.Columns.Add("SoTietHocLai", typeof(int));
            //dtReport.Columns.Add("CoLyDo", typeof(int));
            //dtReport.Columns.Add("KhongLyDo", typeof(int));
            dtReport.Columns.Add("GhiChu", typeof(string));

            //Thực hiện đưa điểm từ bảng điểm vào bảng report
            DataRow drNew;
            string  ColName;

            foreach (DataRow dr in dtDiem.Rows)
            {
                drNew = dtReport.NewRow();

                drNew["MaSinhVien"]   = dr["MaSinhVien"];
                drNew["HoVa"]         = dr["HoVa"];
                drNew["Ten"]          = dr["TenSV"];
                drNew["SoTietHocLai"] = dr["SoTietHocLai"];
                //drNew["CoLyDo"] = dr["CoLyDo"];
                //drNew["KhongLyDo"] = dr["KhongLyDo"];
                for (int i = ColStart; i < dtDiem.Columns.Count; i++)
                {
                    ColName = dtDiem.Columns[i].ColumnName;
                    if (ColName.IndexOf('_') > 0 && ColName.IndexOf("IDKQHT_XepLoai") < 0)
                    {
                        string[] arrStr = ColName.Split('_');
                        if (int.Parse(arrStr[1]) <= 4)
                        {
                            if (arrStr[0] == "DiemTK")
                            {
                                drNew[ColName] = dr[ColName];
                            }
                            else if (arrStr[0] == IDKQHT_ThanhPhanTBHS.ToString())
                            {
                                if ("" + dr[ColName] != "")
                                {
                                    drNew["TBHS"] = dr[ColName];
                                }
                            }
                            else
                            {
                                DataRow[] arrDr = dtThanhPhanDiem.Select("KQHT_ThanhPhanDiemID = " + arrStr[0]);
                                if (arrDr.Length > 0)
                                {
                                    drNew[arrDr[0]["KyHieu"].ToString() + "_" + arrStr[1]] = dr[ColName];
                                }
                            }
                        }
                    }
                }
                dtReport.Rows.Add(drNew);
            }
            return(dtReport);
        }
        /// <summary>
        /// 通过Sql文的Where条件和列名称来获取Query条件
        /// </summary>
        /// <param name="SqlContent">Where条件</param>
        /// <param name="ColumnNameLst">列名称</param>
        /// <returns></returns>
        private static List <DataFilter.QueryConditionInputItem> SetQueryCondition(String SqlContent, List <String> ColumnNameLst)
        {
            List <DataFilter.QueryConditionInputItem> Conditionlst = new List <DataFilter.QueryConditionInputItem>();

            // (a=1 or b="A") AND c="3" => ( a = 1 or b = "A" ) and c = "3"
            //1. 除了引号里面的文字,全部小写
            String[] KeyWord = new String[] { "(", ")", "=", "or", "and", ">", ">=", "<", "<=", "<>" };
            foreach (String Keyitem in KeyWord)
            {
                SqlContent = SqlContent.Replace(Keyitem, " " + Keyitem + " ");
            }
            while (SqlContent.Contains("  "))
            {
                SqlContent = SqlContent.Replace("  ", " ");
            }
            SqlContent = SqlContent.Trim();
            //从左到右  ( a = 1 or
            //           b = "A" ) and
            //           c = "3"
            String[] Token = SqlContent.Split(" ".ToCharArray());
            DataFilter.QueryConditionInputItem mQueryConditionInputItem = new DataFilter.QueryConditionInputItem();
            mQueryConditionInputItem.StartMark = String.Empty;
            mQueryConditionInputItem.EndMark   = String.Empty;

            for (int i = 0; i < Token.Length; i++)
            {
                String strToken = Token[i].Replace("&nbsp;", " ");
                switch (strToken)
                {
                case "(":
                    mQueryConditionInputItem.StartMark = "(";
                    break;

                case "=":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.EQ;
                    break;

                case ">":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.GT;
                    break;

                case "<":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.LT;
                    break;

                case ">=":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.GTE;
                    break;

                case "<=":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.LTE;
                    break;

                case "<>":
                    mQueryConditionInputItem.Compare = DataFilter.CompareEnum.NE;
                    break;

                case "or":
                    mQueryConditionInputItem.EndMark = EndMark_OR;
                    Conditionlst.Add(mQueryConditionInputItem);
                    mQueryConditionInputItem           = new DataFilter.QueryConditionInputItem();
                    mQueryConditionInputItem.StartMark = String.Empty;
                    mQueryConditionInputItem.EndMark   = String.Empty;

                    break;

                case "and":
                    mQueryConditionInputItem.EndMark = EndMark_AND;
                    Conditionlst.Add(mQueryConditionInputItem);
                    mQueryConditionInputItem           = new DataFilter.QueryConditionInputItem();
                    mQueryConditionInputItem.StartMark = String.Empty;
                    mQueryConditionInputItem.EndMark   = String.Empty;

                    break;

                case ")":
                    mQueryConditionInputItem.EndMark = ")";

                    if (i == Token.Length - 1)
                    {
                        mQueryConditionInputItem.EndMark = EndMark_T;
                    }
                    else
                    {
                        if (Token[i + 1] == "or")
                        {
                            mQueryConditionInputItem.EndMark = EndMark_OR_T;
                            i++;
                        }
                        else
                        {
                            if (Token[i + 1] == "and")
                            {
                                mQueryConditionInputItem.EndMark = EndMark_AND_T;
                                i++;
                            }
                        }
                    }

                    Conditionlst.Add(mQueryConditionInputItem);
                    mQueryConditionInputItem           = new DataFilter.QueryConditionInputItem();
                    mQueryConditionInputItem.StartMark = String.Empty;
                    mQueryConditionInputItem.EndMark   = String.Empty;

                    break;

                default:
                    if (mQueryConditionInputItem.ColName == null)
                    {
                        foreach (String ColName in ColumnNameLst)
                        {
                            if (ColName.ToLower() == strToken.ToLower())
                            {
                                //小写的复原
                                mQueryConditionInputItem.ColName = ColName;
                                break;
                            }
                        }
                    }
                    else
                    {
                        //类型设置
                        if (strToken.StartsWith("\"") & strToken.EndsWith("\""))
                        {
                            mQueryConditionInputItem.Value = new BsonValueEx(new BsonString(strToken.Replace("\"", "")));
                        }
                        else
                        {
                            mQueryConditionInputItem.Value = new BsonValueEx(new BsonInt32(Convert.ToInt16(strToken)));
                        }
                    }
                    break;
                }
            }
            if (Token[Token.Length - 1] != ")")
            {
                Conditionlst.Add(mQueryConditionInputItem);
            }
            return(Conditionlst);
        }
Beispiel #12
0
        public override bool Equals(object obj)
        {
            LoggingIdentity other = obj as LoggingIdentity;

            if (other != null)
            {
                if (DBName != null && DBName.Equals(other.DBName) && ColName != null && ColName.Equals(other.ColName) && BucketID == other.BucketID)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #13
0
 public override int GetHashCode()
 {
     return((DBName != null ? DBName.GetHashCode() : 0) + (ColName != null ? ColName.GetHashCode() : 0) + BucketID.GetHashCode());
 }
Beispiel #14
0
        public static List <Dictionary <string, string> > GetActress(string bUrl)
        {
            HtmlDocument document = new HtmlWeb().Load(_FURL + bUrl);

            string xPath       = "//*[@id='mainContent']/div[3]/div/ul/li[*]";
            var    nodes       = document.DocumentNode.SelectNodes(xPath).ToArray();
            var    teamPlayers = new List <Dictionary <string, string> >();
            string result      = string.Empty;

            foreach (HtmlNode node in nodes)
            {
                var    playerInfo = new Dictionary <string, string>();
                string output     = "0" + node.InnerText.Trim().Replace("View Player", string.Empty);
                result = string.Empty;
                Regex regex = new Regex(@"\b[\S]*[\s]{0,1}[\S]*[\s]{0,1}[\S]*[\s]{0,1}[\S]*\b");

                Match m     = regex.Match(output);
                int   count = 0;

                while (m.Success)
                {
                    result = m.Value;

                    if (result != "" && result != "Nationality" && result != "Appearances" && result != "Clean sheets" && result != "Goals" && result != "Assists")
                    {
                        ColName colStr = (ColName)count;

                        if (count == 0)
                        {
                            result = String.Format($"{Convert.ToInt32(result):D2}");
                        }

                        if (count <= 4)
                        {
                            playerInfo.Add(colStr.ToString(), result);
                        }
                        else
                        {
                            switch (playerInfo["POSITION"])
                            {
                            case "Goalkeeper":
                                if (count == 6 || count == 7)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Defender":
                                if (count == 7)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Midfielder":
                                if (count == 5)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;

                            case "Forward":
                                if (count == 5)
                                {
                                    playerInfo.Add(colStr.ToString(), string.Empty);
                                    colStr = (ColName)(++count);
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                else
                                {
                                    playerInfo.Add(colStr.ToString(), result);
                                }
                                break;
                            }
                        }
                        count++;
                    }
                    m = m.NextMatch();
                }
                teamPlayers.Add(playerInfo);
            }
            return(teamPlayers);
        }