public void AddToSelectedObjects(System.Collections.Generic.IEnumerable <SongObject> songObjects)
    {
        var selectedObjectsList = new System.Collections.Generic.List <SongObject>(currentSelectedObjects);

        foreach (SongObject songObject in songObjects)
        {
            if (!selectedObjectsList.Contains(songObject))
            {
                int pos = SongObjectHelper.FindClosestPosition(songObject, selectedObjectsList);
                if (pos != SongObjectHelper.NOTFOUND)
                {
                    if (selectedObjectsList[pos] > songObject)
                    {
                        selectedObjectsList.Insert(pos, songObject);
                    }
                    else
                    {
                        selectedObjectsList.Insert(pos + 1, songObject);
                    }
                }
                else
                {
                    selectedObjectsList.Add(songObject);
                }
            }
        }

        currentSelectedObjects = selectedObjectsList;
    }
示例#2
0
            static bool Test2b()
            {
                System.Random ran = new System.Random(2134);

                {
//%%if IsEx==0 (
                    Gen::List <int> list2 = new System.Collections.Generic.List <int>();
//%%elif IsEx==1
                    Gen::List <TestElement> list2 = new System.Collections.Generic.List <TestElement>();
//%%)
                    const int N = 100000;
                    for (int i = 0; i < N; i++)
                    {
                        int idx = (int)(ran.NextDouble() * list2.Count);
//%%if IsEx==0 (
                        list2.Insert(idx, i);
//%%elif IsEx==1
                        TestElement e = new TestElement(i);
                        list2.Insert(idx, e);
//%%)
                    }

                    for (int i = 0; i < N / 2; i++)
                    {
                        int idx = (int)(ran.NextDouble() * list2.Count);
                        list2.RemoveAt(idx);
                    }
                }
                return(true);
            }
示例#3
0
        public override void ModifyTooltips(System.Collections.Generic.List <TooltipLine> Tooltips)
        {
            string      LeafRoll = Language.GetTextValue("Mods.Antiaris.LeafRoll");
            TooltipLine Tip      = new TooltipLine(mod, "Antiaris:Tooltip", LeafRoll + Uses + "/5");

            Tooltips.Insert(4, Tip);
        }
示例#4
0
        static int _m_Insert(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1);



                {
                    int    _index = LuaAPI.xlua_tointeger(L, 2);
                    string _item  = LuaAPI.lua_tostring(L, 3);

                    gen_to_be_invoked.Insert(
                        _index,
                        _item);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         TB_CarInfoService carInfoSer = new TB_CarInfoService();
         System.Collections.Generic.List <TB_CarInfo> carInfos = carInfoSer.GetListArray("");
         if (carInfos.Count > 0)
         {
             lblMess.Text += "<table cellpadding='0' cellspacing='0'  border='1'  width=50%'>";
             lblMess.Text += "<tr><td style='color:black'><font>车牌</font></td><td style='color:black'>年检时间</td><td style='color:black'>保险时间</td></tr>";
             for (int i = 0; i < carInfos.Count; i++)
             {
                 lblMess.Text += string.Format("<tr><td> {0}</td>  <td>{1}</td><td>{2}</td></tr>", carInfos[i].CarNo, carInfos[i].NianJian, carInfos[i].Baoxian);
             }
             lblMess.Text += "</table>";
         }
         carInfos.Insert(0, new TB_CarInfo());
         ddlCarNo.DataSource = carInfos;
         ddlCarNo.DataBind();
         ddlCarNo.DataTextField  = "CarNo";
         ddlCarNo.DataValueField = "CarNo";
         List <TB_BreakRulesCar> poseModels = new List <TB_BreakRulesCar>();
         this.gvList.DataSource = poseModels;
         this.gvList.DataBind();
     }
 }
示例#6
0
        private string[] BuildMonoAssembliesList()
        {
            filter = "";
            var result = new System.Collections.Generic.List <System.Type>();

            System.Reflection.Assembly[] AS = System.AppDomain.CurrentDomain.GetAssemblies();
            foreach (var A in AS)
            {
                System.Type[] types = A.GetTypes();
                foreach (var T in types)
                {
                    if (T.IsSubclassOf(typeof(MonoBehaviour)))
                    {
                        if (T.IsSubclassOf(typeof(UIBehaviour)))
                        {
                            continue;
                        }

                        result.Add(T);
                    }
                }
            }

            result.Sort(this.Compare);
            //result.Sort((typA, typB) => typA.Name.CompareTo(typB.Name));

            var   output      = new System.Collections.Generic.List <string>();
            float unusedCount = 0;

            foreach (var type in result)
            {
                string reportLine = type.Name + "     (" + type.FullName + ")";
                if (_monoBehaviorsInProject.ContainsKey(type))
                {
                    reportLine  = chk + reportLine;
                    reportLine += "     Used in: [";
                    foreach (GameObject gameObject in (ValueArray)_monoBehaviorsInProject[type])
                    {
                        reportLine += " " + gameObject.name;
                    }
                    reportLine += " ]";
                }
                else
                {
                    unusedCount++;
                    reportLine = exx + reportLine;
                }


                output.Add(reportLine);
            }

            output.Insert(0, "      UNUSED MONOBEHAVIOUR CLASSES = " + (100f * unusedCount / result.Count).ToString("0.0") + "%");

            return(output.ToArray());
        }
示例#7
0
        /// <summary>
        /// Writes generic function based on Instructions.
        ///
        /// The other WriteFunction() can figure out the return type automatically, so
        /// it is preferred over this more verbose version.
        /// </summary>
        /// <param name="S">Specification of algebra.</param>
        /// <param name="cgd">Results go into cgd.m_defSB, and so on</param>
        /// <param name="F">Function specification.</param>
        /// <param name="inline">When true, the code is inlined.</param>
        /// <param name="staticFunc">Static function?</param>
        /// <param name="returnType">The type to return (String, can also be e.g. <c>"code"</c>.</param>
        /// <param name="functionName">Name of generated function.</param>
        /// <param name="returnArgument">For use with the 'C' language, an extra argument can be used to return results.</param>
        /// <param name="arguments">Arguments of function (any `return argument' used for the C language is automatically generated).</param>
        /// <param name="instructions">List of GA-instructions which make up the function.</param>
        /// <param name="comment">Comment to go into generated code (used for decl only).</param>
        /// <param name="writeDecl">When false, no declaration is written</param>
        public static void WriteFunction(
            Specification S, G25.CG.Shared.CGdata cgd, G25.fgs F,
            bool inline, bool staticFunc, string returnType, string functionName,
            FuncArgInfo returnArgument, FuncArgInfo[] arguments,
            System.Collections.Generic.List <Instruction> instructions, Comment comment, bool writeDecl)
        {
            // where the definition goes:
            StringBuilder defSB = (inline) ? cgd.m_inlineDefSB : cgd.m_defSB;

            // declaration:
            if (writeDecl)
            {
                if (comment != null)
                {
                    comment.Write(cgd.m_declSB, S, 0);
                }
                bool inlineDecl = false; // never put inline keywords in declaration
                WriteDeclaration(cgd.m_declSB, S, cgd, inlineDecl, staticFunc, returnType, functionName, returnArgument, arguments);
                cgd.m_declSB.AppendLine(";");
            }

            if (S.OutputCSharpOrJava())
            {
                comment.Write(defSB, S, 0);
            }

            WriteDeclaration(defSB, S, cgd, inline, staticFunc, returnType, functionName, returnArgument, arguments);


            // open function
            defSB.AppendLine("");
            defSB.AppendLine("{");

            // add extra instruction for reporting usage of SMVs
            if (S.m_reportUsage)
            {
                instructions.Insert(0, ReportUsage.GetReportInstruction(S, F, arguments));
            }

            if (returnArgument != null)
            {
                int nbTabs = 1;
                instructions.Add(new VerbatimCodeInstruction(nbTabs, "return " + returnArgument.Name + ";"));
            }

            // write all instructions
            foreach (Instruction I in instructions)
            {
                I.Write(defSB, S, cgd);
            }



            // close function
            defSB.AppendLine("}");
        } // end of WriteFunction()
示例#8
0
        public void CreateMainMenuButton(OuiMainMenu menu, System.Collections.Generic.List <MenuButton> buttons)
        {
            MainMenuSmallButton btn = new MainMenuSmallButton("MODOPTIONS_RANDOMIZER_TOPMENU", "menu/randomizer", menu, Vector2.Zero, Vector2.Zero, () => {
                Audio.Play(SFX.ui_main_button_select);
                Audio.Play(SFX.ui_main_whoosh_large_in);
                menu.Overworld.Goto <OuiRandoSettings>();
            });

            buttons.Insert(1, btn);
        }
示例#9
0
 protected static void AddTotalIndirect(System.Collections.Generic.List <OrganizationBudget> indirectBudgets)
 {
     indirectBudgets.Insert(0, new OrganizationBudget
     {
         Id            = System.Guid.NewGuid().ToString(),
         CBSCode       = "001002",
         AccountAmount = 0m,
         BudgetAmount  = 0m,
         State         = "2"
     });
 }
示例#10
0
        private void ClipboardChanged(object sender, EventArgs e)
        {
            String clipboardText;

            try
            {
                // Handle your clipboard update here, debug logging example:
                if (Clipboard.ContainsText())
                {
                    clipboardText = Clipboard.GetText(TextDataFormat.UnicodeText);
                    if (!clipboardText.Equals(currentItem)) //make sure that if you click an item, it can differentiate from the item that was copied
                                                            // it goes into this multiple times after writing to clipboard, so that is how I stopped it
                    {
                        if (!actualClipboard.Contains(clipboardText))
                        { //if it has the thing already
                            actualClipboard.Insert(0, clipboardText);

                            if (actualClipboard.Count > 10)
                            {
                                actualClipboard.RemoveAt(10);
                            }
                        }
                        else
                        {
                            MoveToTop(actualClipboard.IndexOf(clipboardText));
                        }

                        Repopulate();
                    }
                }
                else
                {
                    justWroteToClipboard = false;
                }
            }
            catch (Exception err)
            {
                //do nothing
            }
        }
            int Insert(System.Collections.Generic.List <int> list, int value, int start, int end)
            {
                if (list.Count == 0)
                {
                    list.Insert(0, value);
                    return(0);
                }

                var first = list[start];

                if (value < first)
                {
                    list.Insert(start, value);
                    return(start);
                }

                var last = list[end - 1];

                if (value > last)
                {
                    list.Insert(end, value);
                    return(end);
                }

                var mid      = start + (end - start) / 2;
                var midV     = list[mid];
                var midLeftV = list[mid - 1];

                if (value > midLeftV && midV >= value)
                {
                    list.Insert(mid, value);
                    return(mid);
                }

                if (midV < value)
                {
                    return(Insert(list, value, mid + 1, end));
                }
                return(Insert(list, value, start, mid - 1));
            }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                TB_CarInfoService carInfoSer = new TB_CarInfoService();
                System.Collections.Generic.List <TB_CarInfo> carInfos = carInfoSer.GetListArray("");
                carInfos.Insert(0, new TB_CarInfo());
                ddlCarNo.DataSource = carInfos;
                ddlCarNo.DataBind();
                ddlCarNo.DataTextField  = "CarNo";
                ddlCarNo.DataValueField = "CarNo";
                if (base.Request["Id"] != null)
                {
                    this.btnAdd.Visible = false;
                    TB_BreakRulesCar model = this.breakRulesCarSer.GetModel(Convert.ToInt32(base.Request["Id"]));
                    txtBreakTime.Text = model.BreakTime.ToShortDateString();
                    txtAddress.Text   = model.Address;
                    txtDothing.Text   = model.Dothing;
                    txtRemark.Text    = model.Remark;
                    ddlState.Text     = model.State;
                    txtTotal.Text     = model.Total.ToString();
                    txtDriver.Text    = model.Driver;
                    txtJiGuan.Text    = model.JiGuan;
                    ddlCarNo.Text     = model.CarNo;
                    txtScore.Text     = model.Score.ToString();
                    if (model.CarNo != "")
                    {
                        TB_CarInfoService carSer = new TB_CarInfoService();

                        List <TB_CarInfo> car = carSer.GetListArray(string.Format(" 1=1 and CarNo='{0}'", model.CarNo));
                        if (car.Count > 0)
                        {
                            txtNianJian.Text = "";
                            txtBaoxian.Text  = "";
                            if (car[0].NianJian != null)
                            {
                                txtNianJian.Text = car[0].NianJian.Value.ToString();
                            }

                            if (car[0].Baoxian != null)
                            {
                                txtBaoxian.Text = car[0].Baoxian.Value.ToString();
                            }
                        }
                    }
                }
                else
                {
                    this.btnUpdate.Visible = false;
                }
            }
        }
 public void InsertAt(int j, GraduateStudent gs)
 {
     if (j >= grlist.Count)
     {
         gs.AddArticles();
         GraduateStundentAdded?.Invoke(this, new GraduateStudentListHandlerEventArgs(NameOfCollection, "Вставлен в конец", j));
     }
     else
     {
         grlist.Insert(j - 1, gs);
         GraduateStudentInserted?.Invoke(this, new GraduateStudentListHandlerEventArgs(NameOfCollection, "Вставлен перед элементом", j));
     }
 }
示例#14
0
        private static FoxLib.GrTexture.ReadFunctions[] GetReadFunctions(string filepath)
        {
            var filepathSansExtension = Path.GetDirectoryName(filepath) + "\\" + Path.GetFileNameWithoutExtension(filepath);

            int[]        textureIndices    = { 1, 2, 3, 4, 5, 6 };
            string[]     filepaths         = (from index in textureIndices select filepathSansExtension + "." + index + ".ftexs").ToArray();
            string[]     existingFilepaths = (from path in filepaths where File.Exists(path) select path).ToArray();
            FileStream[] streams           = (from path in existingFilepaths select new FileStream(path, FileMode.Open)).ToArray();
            System.Collections.Generic.List <BinaryReader> readers = ((from stream in streams select new BinaryReader(stream)).ToList());
            readers.Insert(0, new BinaryReader(new FileStream(filepath, FileMode.Open)));
            var binaryReaders = readers.ToArray();

            return((from reader in binaryReaders select new FoxLib.GrTexture.ReadFunctions(reader.ReadUInt16, reader.ReadUInt32, reader.ReadUInt64, reader.ReadByte, reader.ReadBytes, (numberOfBytes => SkipBytes(reader, numberOfBytes)), (bytePos => MoveStream(reader, bytePos)))).ToArray());
        }
示例#15
0
        /// <summary>
        /// Put element back to queue, at begining.
        /// This element will be taken first.
        /// </summary>
        /// <param name="item">Element</param>
        public void Back(T item)
        {
            bool signal = false;

            try
            {
                lock (_List)
                {
                    _List.Insert(0, item);
                    signal = true;
                }
            }
            finally
            {
                //_PushResetEvent.Set();
                if (signal)
                {
                    if (OnBack != null)
                    {
                        OnBack(this);
                    }
                }
            }
        }
示例#16
0
        /// <summary>
        /// Adds a new segment in the ordered list of segments
        /// </summary>
        /// <param name="segment">The segment to add</param>
        public void addSegment(Segment segment)
        {
            // Recompute segment bounds according to existing segments
            foreach (Segment otherSegment in Segments)
            {
                if (otherSegment.Start <= segment.Start && otherSegment.End > segment.End)
                {
                    segment.Start = 0;
                    segment.End   = 0;
                }

                if (otherSegment.Start <= segment.Start && otherSegment.End > segment.Start)
                {
                    segment.Start = otherSegment.End;
                }

                if (otherSegment.Start <= segment.End && otherSegment.End > segment.End)
                {
                    segment.End = otherSegment.Start;
                }
            }

            if (segment.Start < segment.End)
            {
                // Add the segment in the ordered list of segments
                // According to first phase, we know that there is no overlap of segments
                int i = 0;
                while (i < Segments.Count)
                {
                    if (Segments[i].Start >= segment.End)
                    {
                        Segments.Insert(i, segment);
                        segment = null;
                        break;
                    }
                    i = i + 1;
                }

                if (segment != null)
                {
                    Segments.Add(segment);
                }
            }
            else if (segment.Start > segment.End)
            {
                throw new Exception("Invalid segment starting at " + segment.Start + " and ending at " + segment.End);
            }
        }
示例#17
0
 static public int Insert(IntPtr l)
 {
     try {
         System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         WWWRequest a2;
         checkType(l, 3, out a2);
         self.Insert(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#18
0
 /// <summary>
 /// 将元素插入到指定索引位置(名称唯一模式时,按名称匹配是否存在)。
 /// </summary>
 /// <param name="index">从0开始的索引值。</param>
 /// <param name="item">为null时自动忽略。</param>
 public void Insert(int index, IParameterInfo item)
 {
     if (item == null)
     {
         return;
     }
     if (index < 0)
     {
         Add(item);
         return;
     }
     if (Contains(item))
     {
         return;
     }
     _list.Insert(index, item);
 }
示例#19
0
        public System.Collections.Generic.List <ushort> EnumerateNearbyCells(int i, int x, int y)
        {
            if (i < 0)
            {
                throw new ArgumentOutOfRangeException("i", i, "i<0");
            }
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException("x", x, "x<0");
            }
            if (y < 0)
            {
                throw new ArgumentOutOfRangeException("y", y, "y<0");
            }
            System.Collections.Generic.List <ushort> list = new System.Collections.Generic.List <ushort>();
            int num  = -(base.gatheringCellsCenter % base.gatheringCellsWide);
            int num2 = -(base.gatheringCellsCenter / base.gatheringCellsWide);

            for (int j = 0; j < base.gatheringCellsWide; j++)
            {
                int num4 = j + num;
                int num5 = x + num4;
                if ((num5 >= 0) && (num5 < base.cellsWide))
                {
                    for (int k = 0; k < base.gatheringCellsTall; k++)
                    {
                        int num7 = k + num2;
                        int num8 = y + num7;
                        if (((num8 >= 0) && (num8 < base.cellsTall)) && base.GetGatheringBit(j, k))
                        {
                            ushort item = (ushort)(num5 + (num8 * base.cellsWide));
                            if ((num8 == y) && (num5 == x))
                            {
                                list.Insert(0, item);
                            }
                            else
                            {
                                list.Add(item);
                            }
                        }
                    }
                }
            }
            return(list);
        }
示例#20
0
        private void getIncidentButton_Click(object sender, EventArgs e)
        {
            this.updateButton.Enabled = true;
            this.closeButton.Enabled  = true;
            Incident newIncident = new Incident();

            try
            {
                newIncident.IncidentID = Convert.ToInt32(this.incidentIDTextBox.Text);
                newIncident            = this.incidentController.getIncidentFromDBbyID(newIncident);

                if (!string.IsNullOrEmpty(newIncident.DateClosed))
                {
                    this.updateButton.Enabled = false;
                    this.closeButton.Enabled  = false;
                }

                if (newIncident.CustomerName == null)
                {
                    throw new System.ArgumentException("No incident found for the selected ID");
                }



                else
                {
                    this.customerNameTextBox.Text = newIncident.CustomerName;
                    this.descriptionTextBox.Text  = newIncident.Description;
                    this.titleTextBox.Text        = newIncident.Title;
                    this.dateOpenedTextBox.Text   = newIncident.DateOpened;
                    this.productNameTextBox.Text  = newIncident.ProductCode;
                    List <string> TechnicianList = new System.Collections.Generic.List <string>(this.incidentController.GETTechnicianListFromDB());
                    TechnicianList.Insert(0, "--Unassigned--");
                    this.technicianNameComboBox.DataSource    = TechnicianList;
                    this.technicianNameComboBox.SelectedIndex = Math.Max(this.technicianNameComboBox.Items.IndexOf(newIncident.TechnicianName), 0);
                    this.IncidentID = newIncident.IncidentID;
                }
            }
            catch (Exception ex)
            {
                this.clearButton_Click(null, null);
                MessageBox.Show("" + ex.Message,
                                "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#21
0
            public void Insert(int num)
            {
                if (Values == null)
                {
                    Values = new System.Collections.Generic.List <int>();
                }

                for (var i = 0; i < Values.Count; ++i)
                {
                    if (Values[i] >= num)
                    {
                        Values.Insert(i, num);
                        return;
                    }
                }

                Values.Add(num);
            }
示例#22
0
        public override void ModifyInterfaceLayers(System.Collections.Generic.List <GameInterfaceLayer> layers)
        {
            int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));

            if (MouseTextIndex != -1)
            {
                layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer(
                                  "DrakSolz: Souls",
                                  delegate {
                    if (SoulUI.visible)
                    {
                        userInterface.Update(Main._drawInterfaceGameTime);
                        ui.Draw(Main.spriteBatch);
                    }
                    return(true);
                },
                                  InterfaceScaleType.UI));
            }
        }
示例#23
0
        private static void InsertRests(System.Collections.Generic.List <WorkoutIntervalViewModel> intervals)
        {
            var i = 0;

            while (++i < intervals.Count)
            {
                var interval = intervals[i];
                if (i > 0)
                {
                    var prevInterval    = intervals[i - 1];
                    var prevIntervalEnd = prevInterval.TimeOffset + prevInterval.Duration;
                    var delta           = interval.TimeOffset - prevIntervalEnd;
                    if (delta > 1)
                    {
                        intervals.Insert(i++, new WorkoutIntervalViewModel {
                            TimeOffset = prevIntervalEnd, Duration = delta, Notes = "Rest"
                        });
                    }
                }
            }
        }
        public static System.Collections.Generic.List <CategoryGroupWithCategories> GetCategoriesByGroup(string lang, int?startPoint)
        {
            DataSet ds = DatabaseOperationProvider.QueryProcedure("up_guest_getExcursionCategories", "categories", new
            {
                language   = lang,
                startpoint = startPoint
            });

            System.Collections.Generic.List <CategoryGroupWithCategories> result = (
                from DataRow row in ds.Tables["categories"].Rows
                select ExcursionProvider.factory.CategoryGroupWithCategories(row)).Distinct(new ExcursionProvider.CategoryGroupWithCategoriesComparer()).ToList <CategoryGroupWithCategories>();
            CategoryGroupWithCategories emptyGroup = result.FirstOrDefault((CategoryGroupWithCategories m) => m.group == null);

            if (emptyGroup != null)
            {
                result.Remove(emptyGroup);
                result.Insert(0, emptyGroup);
            }
            foreach (CategoryGroupWithCategories group in result)
            {
                if (group.group == null)
                {
                    group.categories = (
                        from DataRow row in ds.Tables["categories"].Rows
                        where row.IsNull("categorygroup$inc")
                        select ExcursionProvider.factory.Category(row)).ToList <Category>();
                }
                else
                {
                    group.categories = (
                        from row in ds.Tables["categories"].Rows.Cast <DataRow>().Where(delegate(DataRow row)
                    {
                        int?num = row.ReadNullableInt("categorygroup$inc");
                        return(num == ((@group.@group != null) ? new int?(@[email protected]) : null));
                    })
                        select ExcursionProvider.factory.Category(row)).ToList <Category>();
                }
            }
            return(result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                #region 是否有删除功能
                if (Session["currentUserId"] != null)
                {
                    VAN_OA.Dal.TB_AdminDeleteService deleteSer = new VAN_OA.Dal.TB_AdminDeleteService();
                    if (deleteSer.CheckIsExistByUserId(Convert.ToInt32(Session["currentUserId"])) == false)
                    {
                        gvList.Columns[1].Visible = false;
                    }
                }
                #endregion


                TB_CarInfoService carInfoSer = new TB_CarInfoService();
                System.Collections.Generic.List <TB_CarInfo> carInfos = carInfoSer.GetListArray("");

                if (carInfos.Count > 0)
                {
                    lblMess.Text += "<table cellpadding='0' cellspacing='0'  border='1'  width=50%'>";
                    lblMess.Text += "<tr><td style='color:black'><font>车牌</font></td><td style='color:black'>年检时间</td><td style='color:black'>保险时间</td></tr>";
                    for (int i = 0; i < carInfos.Count; i++)
                    {
                        lblMess.Text += string.Format("<tr><td> {0}</td>  <td>{1}</td><td>{2}</td></tr>", carInfos[i].CarNo, carInfos[i].NianJian, carInfos[i].Baoxian);
                    }
                    lblMess.Text += "</table>";
                }
                carInfos.Insert(0, new TB_CarInfo());
                ddlCarNo.DataSource = carInfos;
                ddlCarNo.DataBind();
                ddlCarNo.DataTextField  = "CarNo";
                ddlCarNo.DataValueField = "CarNo";
                List <TB_BreakRulesCar> poseModels = new List <TB_BreakRulesCar>();
                this.gvList.DataSource = poseModels;
                this.gvList.DataBind();
            }
        }
示例#26
0
        static int _m_Insert(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <object> __cl_gen_to_be_invoked = (System.Collections.Generic.List <object>)translator.FastGetCSObj(L, 1);


            try {
                {
                    int    index = LuaAPI.xlua_tointeger(L, 2);
                    object item  = translator.GetObject(L, 3, typeof(object));

                    __cl_gen_to_be_invoked.Insert(index, item);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
示例#27
0
        static void Main(string[] args)
        {
            //int[] list = { 10, 20, 30};
            //System.Collections.ArrayList list = new System.Collections.ArrayList();
            System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>();
            list.Add(10);
            list.Add(20);
            list.Add(30);
            list.Remove(10);
            list.Insert(1, 10);

            Console.WriteLine(list[1]);
            list[1] = 25;
            Console.WriteLine(list[1]);

            Console.Write("Enter a number: ");
            //list.Add(Console.ReadLine());

            foreach (var item in list)
            {
                Console.WriteLine(item);
            }
        }
示例#28
0
        /// <summary>
        /// Insert string element into history or move it to the top
        /// </summary>
        /// <param name="list">String list</param>
        /// <param name="element">String element</param>
        /// <param name="insensitive">Ignore case</param>
        /// <returns>String list</returns>
        public static List <string> Insert(System.Collections.Generic.List <string> list, string element, bool insensitive)
        {
            if (list == null)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(element))
            {
                return(list);
            }
            if (!insensitive)
            {
                int index = list.IndexOf(element);
                if (index >= 0)
                {
                    list.RemoveAt(index);
                }
            }
            else
            {
                for (int i = list.Count - 1; i >= 0; i--)
                {
                    if (0 == String.Compare(list[i], element, insensitive))
                    {
                        list.RemoveAt(i);
                    }
                }
            }
            int offset = 0;

            if (list.Count > 0 && list[0] == "")
            {
                offset++;
            }
            list.Insert(offset, element);
            return(list);
        }
示例#29
0
        internal void SeekToXref()
        {
            // The last line of the file shall contain only the end-of-file marker %%EOF. The two preceding lines shall contain,
            // one per line and in order, the keyword startxref and the byte offset in the decoded stream from the beginning
            // of the file of the xref keyword in the last cross-reference section
            _at = _s.Length - 1;
            while (IsWhitespace())
            {
                _at--;
            }

            int offset = _at - "%%EOF".Length;

            _at = offset + 1; // +1 as _at would have been before the first character
            if (!IsText("%%EOF"))
            {
                throw new LexerException("%%EOF marker not located at the end of the file");
            }

            _at = offset;
            while (IsWhitespace())
            {
                _at--;
            }

            var chars = new System.Collections.Generic.List <char>();

            while (char.IsDigit((char)_s[_at]))
            {
                chars.Insert(0, (char)_s[_at]);
                _at--;
            }

            _offset = _at = int.Parse(new string(chars.ToArray()));
            Current = null;
        }
示例#30
0
 /** <summary>Walk up group hierarchy and show top down to this group</summary> */
 public virtual string GetGroupHierarchyStackString()
 {
     System.Collections.Generic.List<string> groupNames = new System.Collections.Generic.List<string>();
     StringTemplateGroup p = this;
     while ( p != null )
     {
         groupNames.Insert( 0, p._name );
         p = p._superGroup;
     }
     return "[" + string.Join( " ", groupNames.ToArray() ) + "]";
 }
 public void Insert(int index, ListViewGroupEx item)
 {
     list.Insert(index, item);
     listView.BaseGroups.Insert(index, item.baseGroup);
 }
示例#32
0
   protected void Page_Load(object sender, EventArgs e)
   {
      int nextColor = 0 ;
      int nrOfEvents = 0 ;
      EventColor bc ;

      System.Collections.Generic.List<Ektron.Cms.Common.Calendar.WebEventData> eventList = 
         new System.Collections.Generic.List<Ektron.Cms.Common.Calendar.WebEventData>();

      System.Collections.Generic.List<MyWebEventData> MyEventList = 
         new System.Collections.Generic.List<MyWebEventData>();

      Ektron.Cms.Framework.Calendar.WebEvent weAPI = 
         new Ektron.Cms.Framework.Calendar.WebEvent();

      System.DateTime st = DateTime.Now.AddDays( 0 - _daysBehind);
      System.DateTime et = DateTime.Now.AddDays(_daysAhead);
      System.DateTime firstEvent = et ; 
      System.DateTime lastEvent = st ; 

      foreach (CalendarDataSource cds in _calendarsource)
      {
         if( cds.backColor == EventColor.AutoSelect )
         {
            bc = (EventColor) ((nextColor % 7 /* 11 */) +1) ;
            nextColor ++ ;
         }
         else
            bc = cds.backColor ;

         eventList = weAPI.GetEventOccurrenceList( cds.defaultId, st, et) ;
         foreach( Ektron.Cms.Common.Calendar.WebEventData wed in eventList )
         {
            MyEventList.Insert( 0, new MyWebEventData( wed, bc ) );
         }
      }

      MyEventList.Sort(delegate(MyWebEventData we1, MyWebEventData we2){ return we1.EventStartUtc.CompareTo(we2.EventStartUtc);});

      StringBuilder sb = new StringBuilder();
      StringBuilder ss = new StringBuilder();
      string eventTime = "";
      string tooltip = "" ;
      string header = "" ;

      string eventTitle = "" ;

      if( !_suppressWrapperTags )
         ss.Append( "\n<SCRIPT type=\"text/javascript\">\n" ) ;

      foreach (MyWebEventData webEventData in MyEventList)
      {

         if( (DateTime.Compare(webEventData.EventStartUtc, System.DateTime.Now)) > 0 )
         {
            if( lastEvent < webEventData.EventStart )
               lastEvent = webEventData.EventStart ;
            if( firstEvent > webEventData.EventStart )
               firstEvent = webEventData.EventStart ;

            eventTime = ((DateTime.Compare(webEventData.EventStart.AddDays(1), webEventData.EventEnd)) == 0) ? "All Day Event" : webEventData.EventStart.ToShortTimeString() + " to " + webEventData.EventEnd.ToShortTimeString();
            string strDescription = (webEventData.Description.Length <= 30) ? webEventData.Description : webEventData.Description.Substring(0, 30) + "... ";

            eventTitle = String.Format( _eventFormat, 
                                        webEventData.Title,
                                        webEventData.Description,
                                        webEventData.Location,
                                        webEventData.EventStart,
                                        webEventData.EventEnd,
                                        eventTime,
                                        webEventData.Quicklink.ToString(),
                                        backColorCategories[ ((int) webEventData.backColor) -1 ]
                                      ) ;

            if( _suppressWrapperTags )
            {
               sb.Append( eventTitle ) ;
            }
            else
            {
               sb.Append(
"                              <tr class=\"rsAllDayRow\">\n" +
"                                 <td class=\"rsLastCell\">\n" +
"                                    <div class=\"rsWrap\" style=\"z-index:20;\">\n" +
"                                       <div class=\"rsApt rsCategory" +backColorCategories[ ((int) webEventData.backColor) -1 ] + "\" style=\"width:100%;position:relative; z-index:25;\">\n" +
"                                          <div class=\"rsAptOut\">\n" +
"                                             <div class=\"rsAptMid\">\n" +
"                                                <div class=\"rsAptIn\">\n" +
"                                                   <div ID=\"" +this.ClientID +"_Event_" +nrOfEvents.ToString() +"_AptContent\" class=\"rsAptContent\" >\n" +
"                                                      <span  id=\"" + this.ClientID +"_Event_" +nrOfEvents.ToString() +"_title\" class=\'UpcomingEventsDesc\'>" +eventTitle +"</span>\n" +
"                                                      <div id=\"" + this.ClientID +"_Event_" +nrOfEvents.ToString() +"_description\" style=\"display:none;\">\n" +
"                                                         <input id=\"" + this.ClientID +"_Event_" +nrOfEvents.ToString() +"_description_ClientState\" name=\"" + this.ClientID +"_Event_" +nrOfEvents.ToString() +"_description_ClientState\" type=\"hidden\" />\n" +
"                                                      </div>\n" +
"                                                   </div>\n" +
"                                                </div>\n" +
"                                             </div>\n" +
"                                          </div>\n" +
"                                       </div>\n" +
"                                    </div>\n" +
"                                 </td>\n" +
"                              </tr>\n"
                  ) ;
   
               tooltip = String.Format( "\\u003cdiv style=\\\"padding:10px;\\\"\\u003e{0}{1}Time: {2}\\u003cbr /\\u003e\\u003ca style=\\\"float:right;\\\" href=\\\"{3}\\\"\\u003emore\\u003c/a\\u003e\\u003c/div\\u003e",
                          (webEventData.Description.Length > 0 ? "Description: " + webEventData.Description.Replace( "\n", " " ).Replace( "\r", " " ) + "\\u003cbr /\\u003e" : ""),
                          (webEventData.Location.Length > 0 ? "Location: " + webEventData.Location + "\\u003cbr /\\u003e" : "" ),
                          eventTime,
                          webEventData.Quicklink.ToString()
                          ) ;
   
   
               ss.Append( 
                          "Sys.Application.add_init(function() {\n" +
                          "    $create(Telerik.Web.UI.RadToolTip, {\"clientStateFieldID\":" +
                          "\"" +this.ClientID +"_Event_" +nrOfEvents.ToString() +"_description_ClientState\"" +
                          ",\"formID\":\"aspnetForm\",\"skin\":\"Default\",\"sticky\":true,\"targetControlID\":" +
                          "\"" +this.ClientID +"_Event_" +nrOfEvents.ToString() +"_AptContent\"" +
                          ",\"text\":\"" +tooltip +"\",\"title\":\"" + webEventData.DisplayTitle +"\"}, null, null, $get(" +
                          "\"" +this.ClientID +"_Event_" +nrOfEvents.ToString() +"_description\"" +
                          "));\n" +
                          "});\n"
                          ) ;
            }

            nrOfEvents ++ ;

            if( nrOfEvents >= _maxResults )
               break;
         }
      }

      header = String.Format( _headerFormat, nrOfEvents, firstEvent, lastEvent, st, et ) ;

      if( _suppressWrapperTags )
      {
         sb.Insert( 0, header ) ;
      }
      else
      {
         sb.Insert( 0,
"   <div id=\"" +this.ClientID +"_InnerSchedulerPanel\">\n" +
"      <div id=\"" +this.ClientID +"_InnerScheduler\" class=\"RadScheduler RadScheduler_Vista \" style=\"overflow-y:visible;\">\n" +
"         <div class=\"rsTopWrap rsOverflowExpand\">\n" +
"            <div class=\"rsHeader\">\n" +
"               <h2 style=\"text-indent:5px;\">" +header +"</h2>\n" +
"            </div>\n" +
"            <div class=\"rsContent rsDayView\">\n" +
"               <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width:100%;\">\n" +
"                  <tr>\n" +
"                     <td class=\"rsContentWrapper\" style=\"width:100%;\">\n" +
"                        <div class=\"rsContentScrollArea\" style=\"overflow:auto;position:relative;overflow-x:visible;\">\n" +
"                           <table class=\"rsContentTable\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width:100%;\">\n" 
      ) ;


         sb.Append(                 
"                           </table>\n" +
"                        </div>\n" +
"                     </td>\n" +
"                  </tr>\n" +
"               </table>\n" +
"            </div>\n" +
"         </div>\n" +
"      </div>\n" +
"   </div>\n" ) ;

         ss.Append( "</SCRIPT>\n" ) ;
      }

      UpcomingEvents.Text = sb.ToString();
      UpcomingEvents.Text += ss.ToString();

   }
        protected virtual void AddNewRecords()
        {
            ArrayList newRecordList = new ArrayList();

            System.Collections.Generic.List<Hashtable> newUIDataList = new System.Collections.Generic.List<Hashtable>();
            // Loop though all the record controls and if the record control
            // does not have a unique record id set, then create a record
            // and add to the list.
            if (!this.ResetData)
            {
            System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "UOMTableControlRepeater"));
            if (rep == null){return;}

            foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
            {
            // Loop through all rows in the table, set its DataSource and call DataBind().
            UOMTableControlRow recControl = (UOMTableControlRow)(repItem.FindControl("UOMTableControlRow"));

                    if (recControl.Visible && recControl.IsNewRecord) {
                      UOMRecord rec = new UOMRecord();

                        if (recControl.Status.Text != "") {
                            rec.Parse(recControl.Status.Text, UOMTable.Status);
                  }

                        if (recControl.UOMDescription.Text != "") {
                            rec.Parse(recControl.UOMDescription.Text, UOMTable.UOMDescription);
                  }

                        if (recControl.UOMName.Text != "") {
                            rec.Parse(recControl.UOMName.Text, UOMTable.UOMName);
                  }

                        newUIDataList.Add(recControl.PreservedUIData());
                        newRecordList.Add(rec);
                    }
                }
            }

            // Add any new record to the list.
            for (int count = 1; count <= this.AddNewRecord; count++) {

                newRecordList.Insert(0, new UOMRecord());
                newUIDataList.Insert(0, new Hashtable());

            }
            this.AddNewRecord = 0;

            // Finally, add any new records to the DataSource.
            if (newRecordList.Count > 0) {

                ArrayList finalList = new ArrayList(this.DataSource);
                finalList.InsertRange(0, newRecordList);

                Type myrec = typeof(FPCEstimate.Business.UOMRecord);
                this.DataSource = (UOMRecord[])(finalList.ToArray(myrec));

            }

            // Add the existing UI data to this hash table
            if (newUIDataList.Count > 0)
                this.UIData.InsertRange(0, newUIDataList);
        }
示例#34
0
文件: Form1.cs 项目: taitung/lba
        private void PopulatePhysicalDrives()
        {
            cbDriveInfos.Items.Clear();
            System.Collections.Generic.IList<MyDrive> physicalDrives =
                new System.Collections.Generic.List<MyDrive>();
            ManagementClass devices = new ManagementClass(@"Win32_DiskDrive");
            ManagementObjectCollection objects = devices.GetInstances();
            foreach (ManagementObject obj in objects)
            {
                MyDrive myDrive = new MyDrive();

                // fields refer to https://msdn.microsoft.com/en-us/library/aa394132%28v=vs.85%29.aspx
                myDrive.DeviceID = (string)obj["DeviceID"];
                myDrive.Caption = (string)obj["Caption"];
                myDrive.Name = (string)obj["Name"];

                foreach (ManagementObject b in obj.GetRelated("Win32_DiskPartition"))
                {
                    foreach (ManagementBaseObject c in b.GetRelated("Win32_LogicalDisk"))
                    {
                        myDrive.DriveLetter = (string)c["Name"];
                        myDrive.Caption += "(" +myDrive.DriveLetter+ ")";
                    }

                }
                physicalDrives.Add(myDrive);
            }

            MyDrive myDrive1 = new MyDrive();
            myDrive1.Caption = "Please select one...";
            myDrive1.DeviceID = "-1";
            physicalDrives.Insert(0, myDrive1);
            cbDriveInfos.DataSource = physicalDrives;
            cbDriveInfos.DisplayMember = "Caption";
        }
        protected virtual void AddNewRecords()
        {
            ArrayList newRecordList = new ArrayList();

            System.Collections.Generic.List<Hashtable> newUIDataList = new System.Collections.Generic.List<Hashtable>();
            // Loop though all the record controls and if the record control
            // does not have a unique record id set, then create a record
            // and add to the list.
            if (!this.ResetData)
            {
            System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "EstLineAdjTableControlRepeater"));
            if (rep == null){return;}

            foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
            {
            // Loop through all rows in the table, set its DataSource and call DataBind().
            EstLineAdjTableControlRow recControl = (EstLineAdjTableControlRow)(repItem.FindControl("EstLineAdjTableControlRow"));

                    if (recControl.Visible && recControl.IsNewRecord) {
                      EstLineAdjRecord rec = new EstLineAdjRecord();

                        if (MiscUtils.IsValueSelected(recControl.CatID)) {
                            rec.Parse(recControl.CatID.SelectedItem.Value, EstLineAdjTable.CatID);
                        }
                        if (recControl.CreatedBy1.Text != "") {
                            rec.Parse(recControl.CreatedBy1.Text, EstLineAdjTable.CreatedBy);
                  }

                        if (recControl.CreatedByID1.Text != "") {
                            rec.Parse(recControl.CreatedByID1.Text, EstLineAdjTable.CreatedByID);
                  }

                        if (recControl.CreatedDate1.Text != "") {
                            rec.Parse(recControl.CreatedDate1.Text, EstLineAdjTable.CreatedDate);
                  }

                        if (MiscUtils.IsValueSelected(recControl.EstimateAdjID)) {
                            rec.Parse(recControl.EstimateAdjID.SelectedItem.Value, EstLineAdjTable.EstimateAdjID);
                        }
                        if (MiscUtils.IsValueSelected(recControl.EstimateID)) {
                            rec.Parse(recControl.EstimateID.SelectedItem.Value, EstLineAdjTable.EstimateID);
                        }
                        if (MiscUtils.IsValueSelected(recControl.EstimateLineID)) {
                            rec.Parse(recControl.EstimateLineID.SelectedItem.Value, EstLineAdjTable.EstimateLineID);
                        }
                        if (recControl.EstLineAdjAmount.Text != "") {
                            rec.Parse(recControl.EstLineAdjAmount.Text, EstLineAdjTable.EstLineAdjAmount);
                  }

                        if (recControl.EstLineAdjID.Text != "") {
                            rec.Parse(recControl.EstLineAdjID.Text, EstLineAdjTable.EstLineAdjID);
                  }

                        if (recControl.EstLineAdjName.Text != "") {
                            rec.Parse(recControl.EstLineAdjName.Text, EstLineAdjTable.EstLineAdjName);
                  }

                        if (recControl.LastEditBy1.Text != "") {
                            rec.Parse(recControl.LastEditBy1.Text, EstLineAdjTable.LastEditBy);
                  }

                        if (recControl.LastEditByID1.Text != "") {
                            rec.Parse(recControl.LastEditByID1.Text, EstLineAdjTable.LastEditByID);
                  }

                        if (recControl.LastEditDate1.Text != "") {
                            rec.Parse(recControl.LastEditDate1.Text, EstLineAdjTable.LastEditDate);
                  }

                        if (MiscUtils.IsValueSelected(recControl.SiteID)) {
                            rec.Parse(recControl.SiteID.SelectedItem.Value, EstLineAdjTable.SiteID);
                        }
                        rec.Status = recControl.Status1.Checked;

                        newUIDataList.Add(recControl.PreservedUIData());
                        newRecordList.Add(rec);
                    }
                }
            }

            // Add any new record to the list.
            for (int count = 1; count <= this.AddNewRecord; count++) {

                newRecordList.Insert(0, new EstLineAdjRecord());
                newUIDataList.Insert(0, new Hashtable());

            }
            this.AddNewRecord = 0;

            // Finally, add any new records to the DataSource.
            if (newRecordList.Count > 0) {

                ArrayList finalList = new ArrayList(this.DataSource);
                finalList.InsertRange(0, newRecordList);

                Type myrec = typeof(FPCEstimate.Business.EstLineAdjRecord);
                this.DataSource = (EstLineAdjRecord[])(finalList.ToArray(myrec));

            }

            // Add the existing UI data to this hash table
            if (newUIDataList.Count > 0)
                this.UIData.InsertRange(0, newUIDataList);
        }