Ejemplo n.º 1
0
        /// <summary>
        /// 获取用户分组
        /// </summary>
        public void GetGroups(object statues)
        {
            //http://www.meilishuo.com/aj/magazine/user_groups

            try
            {
                //[{"group_id":"42454433","name":"fengzijun\u559c\u6b22\u7684\u5b9d\u8d1d","role":"1"},{"group_id":"42454373","name":"fengzijun","role":"1"}]
                string html = HttpHelper.GetHtml("http://www.meilishuo.com/aj/magazine/user_groups", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0", "application/json, text/javascript, */*; q=0.01", null, "", true, user.Cookie, null, Encoding.GetEncoding("gb2312"), null, true);
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                List <UserGroup>     objs       = serializer.Deserialize <List <UserGroup> >(html);
                if (objs != null && objs.Count > 0)
                {
                    foreach (UserGroup usergroup in objs)
                    {
                        //client.UpdateGroup(user.Username, usergroup.group_id, usergroup.name);
                        client.BeginUpdateGroup(user.Username, usergroup.group_id, usergroup.name, null, null);
                        writelog("创建分组,分组名:" + usergroup.name);
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMsg = "An application error occurred. Please contact the adminstrator " +
                                  "with the following information:/n/n";
                errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;
                client.Log(errorMsg);
            }
        }
Ejemplo n.º 2
0
        private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            Exception ex       = (Exception)t.Exception;
            string    errorMsg = "An application error occurred. Please contact the adminstrator " +
                                 "with the following information:/n/n";

            errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;
            BeautyService.BeautyServiceClient client = new BeautyService.BeautyServiceClient();
            client.Log(errorMsg);
            MessageBox.Show("程序发生异常,请重新运行");
        }
Ejemplo n.º 3
0
        // Handle the UI exceptions by showing a dialog box, and asking the user whether
        // or not they wish to abort execution.
        // NOTE: This exception cannot be kept from terminating the application - it can only
        // log the event, and inform the user about it.
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex       = (Exception)e.ExceptionObject;
            string    errorMsg = "An application error occurred. Please contact the adminstrator " +
                                 "with the following information:/n/n";

            errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;

            //MessageBox.Show("2:" + errorMsg);

            BeautyService.BeautyServiceClient client = new BeautyService.BeautyServiceClient();
            client.Log(errorMsg);
            MessageBox.Show("程序发生异常,请重新运行");
        }