Clear() public method

public Clear ( ) : void
return void
Example #1
0
        private static string MaxSubStringWithUniqueChars(string str)
        {
            char[] cArr = str.ToCharArray();
            Hashtable h = new Hashtable();
            h.Clear();
            int n = cArr.Length;
            int begin = 0;
            int j = 0;
            string maxSub = "";
            for (int i = 0; i < n; ++i)
            {
                if (!h.Contains(cArr[i]))
                {
                    h.Add(cArr[i], true);
                    j++;

                }
                else
                {
                    int newSublen = j - begin;
                    if (maxSub.Length < newSublen)
                    {
                        maxSub = str.Substring(begin, j);

                    }
                    begin = i;
                    j = begin + 1;
                    h.Clear();
                }
            }
            return maxSub;
        }
Example #2
0
        public void TestClearBasic()
        {
            StringBuilder sblMsg = new StringBuilder(99);
            Hashtable ht1 = null;
            string s1 = null;
            string s2 = null;

            int i = 0;
            ht1 = new Hashtable(); //default constructor
            ht1.Clear();

            Assert.Equal(0, ht1.Count);

            // add 100 key-val pairs
            ht1 = new Hashtable();

            for (i = 0; i < 100; i++)
            {
                sblMsg = new StringBuilder(99);
                sblMsg.Append("key_");
                sblMsg.Append(i);
                s1 = sblMsg.ToString();

                sblMsg = new StringBuilder(99);
                sblMsg.Append("val_");
                sblMsg.Append(i);
                s2 = sblMsg.ToString();

                ht1.Add(s1, s2);
            }

            Assert.Equal(100, ht1.Count);
            ht1.Clear();

            Assert.Equal(0, ht1.Count);

            //[]we will make a token call for some important methods to make sure that this is indeed clear
            s1 = "key_0";
            Assert.False(ht1.ContainsKey(s1));

            s1 = "val_0";
            Assert.False(ht1.ContainsValue(s1));

            //[]repeated clears of the HT. Nothing should happen		

            for (i = 0; i < 100; i++)
            {
                ht1.Clear();

                Assert.Equal(0, ht1.Count);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                acceptGuid = Request.Params["AcceptGuid"];
                string adPGuid, clientPGuid, adClass = string.Empty;
                if (!string.IsNullOrEmpty(acceptGuid))
                {
                    Hashtable hs = new Hashtable();
                    hs.Add("AcceptGuid", acceptGuid);
                    HD.Model.AcceptForm accept = HD.Model.AcceptForm.Instance.GetModelById(hs);
                    accept.SetWebControls(this.Page);
                    PostTime.Text = Convert.ToDateTime(accept.PostTime).ToString("yyyy-MM-dd");

                    adPGuid = accept.ADGuid;
                    hs.Clear();
                    hs.Add("ADPGuid", adPGuid);
                    HD.Model.AD ad = HD.Model.AD.Instance.GetModelById(hs);
                    ad.SetWebControls(this.Page);
                    adClass = ad.ADArea;
                    adAreaId = ad.ADArea;
                    StartTime.Text = Convert.ToDateTime(ad.StartTime).ToString("yyyy-MM-dd");
                    EndTime.Text = Convert.ToDateTime(ad.EndTime).ToString("yyyy-MM-dd");
                    if (!string.IsNullOrEmpty(adAreaId))
                    {
                        ChooseCount = (adAreaId.Split(',').Length - 2).ToString();
                    }
                    clientPGuid = accept.ClientGuid;
                    hs.Clear();
                    hs.Add("ClientPGuid", clientPGuid);
                    HD.Model.Client client = HD.Model.Client.Instance.GetModelById(hs);
                    client.SetWebControls(this.Page);

                    DataTable dt2 = HD.Framework.DataAccess.DataFactory.GetInstance().ExecuteTable("select wzrb_Class.ID, wzrb_Class.ClassName, (select COUNT(*) from wzrb_Terminal where ClassID=wzrb_Class.ID and Status=1)  as rcount from wzrb_Class");
                    rptClass.DataSource = dt2;
                    rptClass.DataBind();

                    DataTable dttype = HD.Framework.DataAccess.DataFactory.GetInstance().ExecuteTable("select * from wzrb_Publish where ADGuid='" + ad.ADPGuid + "'");
                    publishType = "<table id=\"CheckBoxList2\">";
                    for (int k = 0; k < dttype.Rows.Count; k++)
                    {
                        publishType += "<tr><td>" + GetPublishName(dttype.Rows[k]["PublishType"].ToString());
                        publishType += " -- 数量:" + dttype.Rows[k]["PublishQuantity"];
                        publishType += "</td></tr>";
                    }
                    publishType += "</table>";
                }
            }
        }
Example #4
0
        public void TestCtorDictionarySingle()
        {
            // No exception
            var hash = new Hashtable(new Hashtable(), 1f);
            // No exception
            hash = new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable()), 1f), 1f), 1f), 1f);

            // []test to see if elements really get copied from old dictionary to new hashtable
            Hashtable tempHash = new Hashtable();
            // this for assumes that MinValue is a negative!
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                tempHash.Add(i, i);
            }

            hash = new Hashtable(tempHash, 1f);

            // make sure that new hashtable has the elements in it that old hashtable had
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                Assert.True(hash.ContainsKey(i));
                Assert.True(hash.ContainsValue(i));
            }

            //[]make sure that there are no connections with the old and the new hashtable
            tempHash.Clear();
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                Assert.True(hash.ContainsKey(i));
                Assert.True(hash.ContainsValue(i));
            }
        }
Example #5
0
 public Hashtable GpsCarFilterToHashTable(int int_0)
 {
     SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@workId", int_0) };
     DataTable table = new SqlDataAccess().getDataBySP("WebGpsClient_GetCarFilter", parameterArray);
     Hashtable hashtable = new Hashtable();
     if (hashtable.Count > 0)
     {
         hashtable.Clear();
     }
     CarFilterInfo info = null;
     foreach (DataRow row in table.Rows)
     {
         if (row["simNum"] != DBNull.Value)
         {
             info = new CarFilterInfo {
                 SimNum = Convert.ToString(row["simNum"]),
                 CarInfoData = CarDataInfoBuffer.GetDataCarInfoBySimNum(info.SimNum)
             };
             if (info.CarInfoData != null)
             {
                 info.PosReadTime = info.CarInfoData.IsNewPosTime;
                 info.PicReadTime = info.CarInfoData.IsNewPicTime;
                 hashtable.Add(info.SimNum, info);
             }
         }
     }
     return hashtable;
 }
 public Hashtable GetMissingDefinitions()
 {
     MissingDefinition definition;
     Hashtable hashtable = new Hashtable();
     try
     {
         if (!this.TableExists("KindOfMissing"))
         {
             throw new Exception();
         }
         DataTable table1 = this._data.Tables["KindOfMissing"];
         foreach (DataRow row in this._data.Tables["KindOfMissing"].Rows)
         {
             int key = Convert.ToInt32((string)row["Key"]);
             string text = (string)row["Text"];
             bool capturable = ((string)row["Capturable"]).ToUpper() != "NO";
             definition = new MissingDefinition(key, text, capturable);
             key = definition.Key;
             if (!hashtable.ContainsKey(key))
             {
                 hashtable.Add(key, definition);
             }
         }
         return hashtable;
     }
     catch
     {
         hashtable.Clear();
         definition = new MissingDefinition(0, "Missing", false);
         hashtable.Add(0, definition);
         definition = new MissingDefinition(1, "Available", true);
         hashtable.Add(1, definition);
     }
     return hashtable;
 }
Example #7
0
        static void Main(string[] args)
        {
            Hashtable seen = new Hashtable();
            int max = 0;
            int maxD = 0;
            for (int i = 1; i < 1000; i++) {
                seen.Clear();
                int r = 1;
                int count = 0;
                int result = 0;
                bool found = false;
                while(!found) {
                    if (seen.ContainsKey(r)) {
                        found = true;
                        result = count - (int)seen[r];
                    } else {
                        seen.Add(r, count);
                        r = r % i;
                        if (r == 0) {
                            found = true;
                        } else {
                            r = r * 10;
                        }
                    }
                    count++;
                }
                if(max < result) {
                    max = result;
                    maxD = i;
                }
            }

            Console.WriteLine(maxD + " " + max);
            Console.ReadLine();
        }
        public static Task<Hashtable> Execute(string method, Hashtable parms,ref Int64 requestid )
        {
            string strParams="";
            IEnumerator enu = parms.Keys.GetEnumerator();
            while (enu.MoveNext())
            {
                string parm = enu.Current.ToString() + "=" + Convert.ToString(parms[enu.Current.ToString()]);
                strParams = strParams + parm + "&";
            }

            strParams = strParams + "requestid=" + requestid.ToString()+"&";

             var result = Task<Hashtable>.Factory.StartNew(() =>
            {
                Hashtable ReturnData = new Hashtable();
                try
                {
                    Encoding encoding = Encoding.UTF8;
                    string strurl = strBaseUrl + strExecutePage;

                    string strJason = PostHttpResponse.GetStream(PostHttpResponse.CreatePostHttpResponseJson(strurl, "", "method=" + method + "&"+strParams + "clienttype=mobile", 300*1000, "", encoding, "", ref m_CookieContainer, true), encoding);
                    ReturnData = (Hashtable)MiniUiAppCode.JSON.Decode(strJason);

                }
                catch (Exception ex)
                {

                    ReturnData.Clear();
                    ReturnData.Add("error", "-1");
                    ReturnData.Add("message", "client error:" + ex.Message.ToString());
                }
                return ReturnData;
            });
            return result;
        }
Example #9
0
        //Main_7_9_5
        public static void Main_7_9_5()
        {
            Hashtable ht = new Hashtable();

            //��Ӽ���Ԫ��
            ht.Add("Name", "��");
            ht.Add("Age", 27);
            ht.Add("Degree", "˶ʿ");

            //�Լ�ֵ���Ҽ���
            Console.WriteLine("{0}��������{1}", ht["Name"], ht["Age"]);

            //���ϱ���
            foreach (DictionaryEntry de in ht)
            {
                Console.WriteLine("{0}--{1}", de.Key.ToString(), de.Value.ToString());
            }

            //ɾ������Ԫ��
            ht.Remove("Age");

            //��������
            ArrayList als = new ArrayList(ht.Keys);
            als.Sort();
            foreach (string key in als)
            {
                Console.WriteLine("{0}--{1}", key, ht[key].ToString());
            }

            //�������
            ht.Clear();
        }
Example #10
0
        public void Initialize(Framework.Interfaces.ICore core)
        {
            _core = core;
            _availableWaypoints = new Hashtable();

            try
            {
                _dbcon = new Utils.DBConComSqlite(Path.Combine(core.PluginDataPath,"gcvote.db3"));

                object o = _dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='votes'");
                if (o == null || o.GetType() == typeof(DBNull))
                {
                    _dbcon.ExecuteNonQuery("create table 'votes' (Waypoint text, VoteMedian float, VoteAvg float, VoteCnt integer, VoteUser double)");
                    _dbcon.ExecuteNonQuery("create unique index idx_votess on votes (Waypoint)");
                }

                DbDataReader dr = _dbcon.ExecuteReader("select Waypoint from votes");
                while (dr.Read())
                {
                    _availableWaypoints.Add(dr[0], true);
                }
            }
            catch
            {
                _dbcon = null;
                _availableWaypoints.Clear();
            }
        }
       public Hashtable GetSiteDetails()
       {
           Hashtable _SiteDetails = new Hashtable();
           try
           {
               Logger.Debug("Refreshing Site details:GetSiteDetails");
               ISingleResult<rsp_EventTransmitter_GetSiteDetailsResult> ResultSet = _ExchangeContext.rsp_EventTransmitter_GetSiteDetails();
              
               foreach (rsp_EventTransmitter_GetSiteDetailsResult oInst in ResultSet)
               {
                   _SiteDetails.Add("Area", oInst.sub_company_area_name);
                   _SiteDetails.Add("Company", oInst.Company_name);
                   _SiteDetails.Add("District", oInst.sub_company_District_Name);
                   _SiteDetails.Add("Region", oInst.Sub_Company_Region_Name);
                   _SiteDetails.Add("Sub_Company", oInst.sub_company_Name);
               }

           }
           catch (Exception Ex)
           {
               Logger.Error("DataAdapter", "GetSiteDetails()", Ex);
               _SiteDetails.Clear();
               _SiteDetails.Add("Area", string.Empty);
               _SiteDetails.Add("Company", string.Empty);
               _SiteDetails.Add("District", string.Empty);
               _SiteDetails.Add("Region", string.Empty);
               _SiteDetails.Add("Sub_Company", string.Empty);
           }
           return _SiteDetails;
       }
Example #12
0
        public bool login(string username, string password, string catpcha)
        {
            HttpRequest request = HttpRequest.getInstance();
            string result = "";
            string url = "";
            Hashtable param = new Hashtable();

            url = "http://192.168.0.12:8080/ibts/j_spring_security_check";
            param.Clear();
            param.Add("j_organization_code", "10000201");
            param.Add("j_username", username);
            param.Add("j_password", password);
            param.Add("j_verifycode", catpcha);
            result = request.doPost(url, param);

            //url = "http://192.168.0.12:8080/ibts/user_authSuccess.action";
            //param.Clear();
            //result = request.doPost(url, param);

            //url = "http://192.168.0.12:8080/ibts/main.action";
            //param.Clear();
            //result = request.doPost(url, param);

            return true;
        }
Example #13
0
        /// <summary>
        /// 輸入變數兜成HashTable
        /// </summary>
        /// <param name="ParameterList">變數集</param>
        /// <returns>回傳HashTable</returns>
        private Hashtable GetInputValues(ArrayList ParameterList)
        {
            #region

            Hashtable htTemp = new Hashtable();
            htTemp.Clear();

            htTemp.Add("ChanFrom", ParameterList[0].ToString().Trim() == "" ? null : ParameterList[0].ToString().Trim());
            htTemp.Add("ChanTo", ParameterList[1].ToString().Trim() == "" ? null : ParameterList[1].ToString().Trim());

            htTemp.Add("DateFrom", ParameterList[2].ToString().Trim() == "" ? null : ParameterList[2].ToString().Trim());
            htTemp.Add("DateTo", ParameterList[3].ToString().Trim() == "" ? null : ParameterList[3].ToString().Trim());
            htTemp.Add("RankCode", ParameterList[4].ToString().Trim() == "" ? null : ParameterList[4].ToString().Trim());
            htTemp.Add("UserID", ParameterList[5].ToString());
            htTemp.Add("ProcNo", ParameterList[6].ToString());
            Int32 iTopRownum;
            Int32.TryParse(ParameterList[7].ToString(), out iTopRownum);
            htTemp.Add("TopRownum", iTopRownum);

            htTemp.Add("StoreFrom", ParameterList[8].ToString().Trim() == "" ? null : ParameterList[8].ToString().Trim());
            htTemp.Add("StoreTo", ParameterList[9].ToString().Trim() == "" ? null : ParameterList[9].ToString().Trim());
            htTemp.Add("RootNo", ParameterList[10].ToString().Trim() == "" ? null : ParameterList[10].ToString().Trim());
            htTemp.Add("PMAFrom", ParameterList[11].ToString().Trim() == "" ? null : ParameterList[11].ToString().Trim());
            htTemp.Add("PMATo", ParameterList[12].ToString().Trim() == "" ? null : ParameterList[12].ToString().Trim());
            htTemp.Add("PatternFrom", ParameterList[13].ToString().Trim() == "" ? null : ParameterList[13].ToString().Trim());
            htTemp.Add("PatternTo", ParameterList[14].ToString().Trim() == "" ? null : ParameterList[14].ToString().Trim());

            return htTemp;
            
            #endregion
        }
Example #14
0
        /// <summary>
        /// "放入购物车"按钮单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonAdd2Cart_Click(object sender, System.EventArgs e)
        {
            if (Session["user_id"] == null)
                Page.Response.Redirect("Login.aspx?in=1");

            Cart cart = new Cart();
            Hashtable ht = new Hashtable();
            ArrayList selectedBooks = this.GetSelected();

            //如果用户没有选择,就单击该按钮,则给出警告
            if (selectedBooks.Count == 0)
            {
                Response.Write("<Script Language=JavaScript>alert('请选择图书!');</Script>");
                return;
            }

            //循环将选择的图书加入到购物篮中
            foreach (int bookId in selectedBooks)
            {
                ht.Clear();
                ht.Add("UserId", Session["user_id"].ToString());
                ht.Add("BookId", bookId);
                ht.Add("Amount", TextBoxAmount.Text.Trim());
                cart.Add(ht);
            }
            Response.Redirect("CartView.aspx");
        }
        public static Task<Hashtable>  Login(string user, string upass)
        {
            var result = Task<Hashtable>.Factory.StartNew(() =>
            {
                Hashtable loginReturnData = new Hashtable() ;
                try
                {
                    Encoding encoding = Encoding.UTF8;
                    string strurl = strBaseUrl + strLoginPage;

                    string strJason = PostHttpResponse.GetStream(PostHttpResponse.CreatePostHttpResponseJson(strurl, "", "user="+user+"&upass="+upass+"&clienttype=mobile", null, "", encoding, "", ref m_CookieContainer, true), encoding);
                    loginReturnData = (Hashtable)MiniUiAppCode.JSON.Decode(strJason);

                }
                catch (Exception ex)
                {

                    loginReturnData.Clear();
                    loginReturnData.Add("error", "-1");
                    loginReturnData.Add("message", "client error:"+ex.Message.ToString());
                }
                return loginReturnData;
            });
            return result;

        }
        public static void Run()
        {
            // ExStart:SaveVisioShapeInOtherFormats
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Call a Diagram class constructor to load the VSDX diagram
            Diagram srcVisio = new Diagram(dataDir + "Drawing1.vsdx");

            double shapeWidth = 0;
            double shapeHeight = 0;

            // Get Visio page
            Aspose.Diagram.Page srcPage = srcVisio.Pages.GetPage("Page-3");
            // Remove background page
            srcPage.BackPage = null;

            // Get hash table of shapes, it holds id and name
            Hashtable remShapes = new Hashtable();
            // Hashtable<Long, String> remShapes = new Hashtable<Long, String>();
            foreach (Aspose.Diagram.Shape shape in srcPage.Shapes)
                // For the normal shape
                remShapes.Add(shape.ID, shape.Name);

            // Iterate through the hash table
            foreach (DictionaryEntry shapeEntry in remShapes)
            {
                long key = (long)shapeEntry.Key;
                string val = (string)shapeEntry.Value;
                Aspose.Diagram.Shape shape = srcPage.Shapes.GetShape(key);
                // Check of the shape name
                if (val.Equals("GroupShape1"))
                {
                    // Move shape to the origin corner
                    shapeWidth = shape.XForm.Width.Value;
                    shapeHeight = shape.XForm.Height.Value;
                    shape.MoveTo(shapeWidth * 0.5, shapeHeight * 0.5);
                    // Trim page size
                    srcPage.PageSheet.PageProps.PageWidth.Value = shapeWidth;
                    srcPage.PageSheet.PageProps.PageHeight.Value = shapeHeight;
                }
                else
                {
                    // Remove shape from the Visio page and hash table
                    srcPage.Shapes.Remove(shape);
                }
            }
            remShapes.Clear();

            // Specify saving options
            Aspose.Diagram.Saving.PdfSaveOptions opts = new Aspose.Diagram.Saving.PdfSaveOptions();
            // Set page count to save
            opts.PageCount = 1;
            // Set starting index of the page
            opts.PageIndex = 1;
            // Save it
            srcVisio.Save(dataDir + "SaveVisioShapeInOtherFormats_out.pdf", opts);
            // ExEnd:SaveVisioShapeInOtherFormats
        }
Example #17
0
        public static void CountObjects_OnCommand(CommandEventArgs e)
        {
            using (StreamWriter op = new StreamWriter("objects.log"))
            {
                Hashtable table = new Hashtable();

                foreach (Item item in World.Items.Values)
                {
                    Type type = item.GetType();

                    object o = (object)table[type];

                    if (o == null)
                        table[type] = 1;
                    else
                        table[type] = 1 + (int)o;
                }

                ArrayList items = new ArrayList(table);

                table.Clear();

                foreach (Mobile m in World.Mobiles.Values)
                {
                    Type type = m.GetType();

                    object o = (object)table[type];

                    if (o == null)
                        table[type] = 1;
                    else
                        table[type] = 1 + (int)o;
                }

                ArrayList mobiles = new ArrayList(table);

                items.Sort(new CountSorter());
                mobiles.Sort(new CountSorter());

                op.WriteLine("# Object count table generated on {0}", DateTime.Now);
                op.WriteLine();
                op.WriteLine();

                op.WriteLine("# Items:");

                foreach (DictionaryEntry de in items)
                    op.WriteLine("{0}\t{1:F2}%\t{2}", de.Value, (100 * (int)de.Value) / (double)World.Items.Count, de.Key);

                op.WriteLine();
                op.WriteLine();

                op.WriteLine("#Mobiles:");

                foreach (DictionaryEntry de in mobiles)
                    op.WriteLine("{0}\t{1:F2}%\t{2}", de.Value, (100 * (int)de.Value) / (double)World.Mobiles.Count, de.Key);
            }

            e.Mobile.SendMessage("Object table has been generated. See the file : <runuo root>/objects.log");
        }
Example #18
0
 private static void FlushDictionary(Hashtable d)
 {
     foreach (var key in d.Keys)
     {
         var disposeItem = d[key] as IDisposable;
         if (disposeItem != null)
             disposeItem.Dispose();
     }
     d.Clear();
 }
Example #19
0
        public void TerDelete(Model.Terminal terminal, Model.Source source)
        {
            Hashtable ht = new Hashtable();
            ht.Add("Guid", terminal.Guid);
            terminal.Delete(ht);

            ht.Clear();
            ht.Add("TerGuid", terminal.Guid);
            source.Delete(ht);
        }
Example #20
0
        public WWQK_MDB()
        {
            pmTableName = "WWQK_WF";
            formatPmTableName = "WWQK";

            doneTable = "WWQK_DONE" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm");
            title = "外文期刊";

            Rec = new Hashtable();
            Rec.Clear();
        }
Example #21
0
        /* general */
        public static void CheckForUpdate(ref Hashtable data)
        {
            data.Clear();

            if (ConfigManager.Instance.CommonConfiguration.PROFILES_UseProfiles)
                data = CheckForUpdate_profile();
            else
                data.Add(0, CheckForUpdate_single());

            //return data;
        }
Example #22
0
        public void ApplyDelete(Model.Application appli,Model.SCW scw, Model.BulkFreight bulk)
        {
            Hashtable ht = new Hashtable();
            ht.Add("Guid", appli.Guid);
            appli.Delete(ht);

            ht.Clear();
            ht.Add("AppGuid", appli.Guid);
            scw.Delete(ht);
            bulk.Delete(ht);
        }
Example #23
0
        /// <summary>
        ///     拷贝hash表内容,string类型
        /// </summary>
        /// <param name="src"></param>
        /// <param name="dst"></param>
        public static void CopyHashTableString(Hashtable src, Hashtable dst)
        {
            dst.Clear();
            foreach (var obj in src.Keys)
            {
                var nodename = (string) obj;
                var lst = (string) src[nodename];

                dst.Add(nodename, lst);
            }
        }
Example #24
0
 /// <summary>
 /// Ensure that Rtp is properly installed on each run, attempting to make ".NET File Copy Deployment" a reality.
 /// 
 /// This mostly works, but two problems arise from "File Copy Deployment".  First, there's a large delay upon first run while setup executes.
 /// Second, uninstall is never run if the files are just deleted so niggling things like registry entries, performance counters, event logs,
 /// etc. get left around.
 /// 
 /// Because of this, we still deploy the application to the clients using MSIs which call custom actions that run the Installer classes on both
 /// setup and when Add/Remove Programs -> Remove is called.
 /// 
 /// This Dll knows whether to self-install by checking a registry entry that is set upon installation.  If you delete the files without calling
 /// uninstall, be sure to delete HKLM\SOFTWARE\Microsoft Research\RtpInstalled before reinstalling Rtp in another location.  The clean way to
 /// uninstall without MSIs or Add/Remove Programs is to call "installutil /u MSR.LST.Net.Rtp.dll" before deleting the file or by having your
 /// app call Installer.Uninstall on the MSR.LST.Net.Rtp assembly programatically.  See Installation.cs for an example of how to programmatically
 /// install/uninstall an assembly dependency.
 /// </summary>
 private static void Install()
 {
     if (!Installation.Installed)
     {
         // Install myself
         IDictionary state = new Hashtable();
         state.Clear();
         Installation inst = new Installation();
         inst.Install(state);
         inst.Commit(state);
     }
 }
Example #25
0
 /// <summary>
 ///     拷贝hash表内容,List<string>类型
 /// </summary>
 /// <param name="src"></param>
 /// <param name="dst"></param>
 public static void CopyHashTableStringList(Hashtable src, Hashtable dst)
 {
     dst.Clear();
     foreach (var obj in src.Keys)
     {
         var nodename = (string) obj;
         var lst = (List<string>) src[nodename];
         var newlst = new List<string>(lst.Capacity);
         newlst.AddRange(lst);
         dst.Add(nodename, newlst);
     }
 }
Example #26
0
 /// <summary>
 /// 根据当前分类ID,往下找两级子分类
 /// </summary>
 /// <param name="catalogId"></param>
 /// <returns></returns>
 public IList<S_Catalog> GetSubList(int catalogId)
 {
     Hashtable p = new Hashtable();
     p.Add("Pid",catalogId);
     IList<S_Catalog> sublist = GetList(p, null, null, null);
     sublist.ToList().ForEach(c => {
         p.Clear();
         p.Add("Pid",c.CatalogId);
         c.SubCatalog = GetList(p, null, null, null);
     });
     return sublist;
 }
Example #27
0
File: xui.cs Project: linb/CrossUI
        public static void echoResponse(HttpContext context, Hashtable inputData, Object outputData, Boolean ok)
        {
            context.Response.ClearContent();
            string strOut = "";

            Hashtable hResponse = new Hashtable();

            if (ok)
            {
                hResponse.Add(DATA, outputData);
            }
            else
            {
                hResponse.Add(ERR, outputData);
            }
            Object oCallback = inputData[CALLBACK];
            //adjust out string
            if (oCallback != null)
            {
                string sCallback = "" + oCallback;
                if ("window.name".Equals(sCallback))
                {
                    context.Response.ContentType = "text/html";
                    strOut = "<script type='text' id='json'>"
                        + JsonConvert.ExportToString(hResponse)
                        + "</script><script type='text/javascript'>window.name=document.getElementById('json').innerHTML;</script>";
                }
                else if (sCallback.IndexOf(":") != -1){
                    context.Response.ContentType = "text/html";
                    strOut = "<script type='text' id='json'>"
                        + JsonConvert.ExportToString(hResponse)
                        + "</script><script type='text/javascript'>parent.postMessage(document.getElementById('json').innerHTML,'"
                        + sCallback
                        + "'.replace( /([^:]+://[^/]+).*/, '$1'));</script>";
                }
                else
                {
                    context.Response.ContentType = "text/plain";
                    strOut = sCallback + "(" + JsonConvert.ExportToString(hResponse) + ")";
                }
            }
            else
            {
                context.Response.ContentType = "text/plain";
                strOut = JsonConvert.ExportToString(hResponse);
            }

            if (inputData != null)
                inputData.Clear();
            context.Response.Write(strOut);
            context.Response.End();
        }
Example #28
0
 /// <summary>
 /// Ensure that ArchiveService is properly installed on each run, attempting to make ".NET File Copy Deployment" a reality.
 /// </summary>
 /// <remarks>
 /// This was stolen from MSR.LST.Net.Rtp.  See Notes on bugs in this design in MSR.LST.Net.Rtp.RtpSession.Install
 /// </remarks>
 private static void Install()
 {
     // Get the installed state out of the registry -- if we're already installed, we don't have to reinstall
     if (Installation.Installed == false)
     {
         // Install myself
         IDictionary state = new Hashtable();
         state.Clear();
         Installation inst = new Installation();
         inst.Install(state);
         inst.Commit(state);
     }
 }
Example #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string guid = Request.Params["Guid"];
                if (!string.IsNullOrEmpty(guid))
                {
                    Hashtable hs = new Hashtable();
                    hs.Add("Guid", guid);
                    HD.Model.Repair repair = HD.Model.Repair.Instance.GetModelById(hs);
                    repair.SetWebControls(this.Page);
                    RepairTime.Text = Convert.ToDateTime(repair.RepairTime).ToString("yyyy-MM-dd");

                    hs.Clear();
                    hs.Add("RepairGuid", guid);
                    HD.Model.Reply reply = HD.Model.Reply.Instance.GetModelById(hs);
                    reply.SetWebControls(this.Page);
                    ReplyRepairTime.Text = Convert.ToDateTime(reply.ReplyRepairTime).ToString("yyyy-MM-dd");
                    Response.Write(repair.Status);
                    if (repair.Status == 0)
                    {
                        RepairStatus.Text = "未受理";
                    }
                    if (repair.Status == 1)
                    {
                        RepairStatus.Text = "已受理";
                    }
                    if (repair.Status == 2)
                    {
                        RepairStatus.Text = "已解决";
                    }
                    hs.Clear();
                    hs.Add("ID", repair.TerminalId);
                    HD.Model.Terminal ternimal = HD.Model.Terminal.Instance.GetModelById(hs);
                    ternimal.SetWebControls(this.Page);
                }
            }
        }
Example #30
0
        /// <summary>
        /// This method is called when user changed the selection in the drop down
        /// </summary>
        /// <param name="sender">This will contains sender information</param>
        /// <param name="e">This will contain evnt argument information</param>
        protected void Hppfield_list_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (hppfield_list.SelectedIndex != 0)
            {
                Hashtable hppFieldsHashtable = new Hashtable();
                hppFieldsHashtable["hpp_id"] = hppfield_list.SelectedValue.ToString();
                HppFields objHppFields = new HppFields();
                DataTable dthppFields = objHppFields.GetHppFields(hppFieldsHashtable);
                
                foreach (DataRow hppFieldRow in dthppFields.Rows)
                {
                    field_id.Text = hppFieldRow["hpp_id"].ToString();
                    filed_name.Text = hppFieldRow["hpp_field_name"].ToString();
                    filed_description.Text = hppFieldRow["hpp_field_desc"].ToString();
                    if (hppFieldRow["hppfield_mapped"].ToString() == "0")
                    {
                        filed_name.Enabled = true;
                        filed_description.Enabled = true;
                        save.Enabled = true;
                    }
                    else
                    {
                        filed_name.Enabled = false;
                        filed_description.Enabled = false;
                        save.Enabled = false;
                    }                  
                }

                hppFieldsHashtable.Clear();
            }
            else
            {
                // get identity value
                Hashtable hppFieldshashtable = new Hashtable();
                hppFieldshashtable["identity_value"] = 1;
                HppFields objHppFields = new HppFields();
                fieldID = objHppFields.GetHppFields(hppFieldshashtable).Rows[0][0].ToString();     

                field_id.Text = fieldID;
                filed_name.Text = string.Empty;
                filed_description.Text = string.Empty;

                filed_name.Enabled = true;
                filed_description.Enabled = true;
                save.Enabled = true;
             }

            lb_fieldname_error_invalid.Visible = false;
            lb_field_error.Visible = false;
         }