示例#1
0
		/// <summary>
		/// 指定のキーのテキストを、設定された言語に翻訳して取得
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public static string LocalizeText(ErrorMsg type)
		{
			LanguageManagerBase language = LanguageManagerBase.Instance;
			if (language != null)
			{
				return language.LocalizeText(LanguageDataName, type.ToString());
			}
			else
			{
				Debug.LogWarning("LanguageManager is NULL");
				return type.ToString();
			}
		}
示例#2
0
 public void SetError(ErrorMsg msg)
 {
     switch (msg)
     {
         case ErrorMsg.Banned:
             {
                 Error = "You have been banned from the server";
                 break;
             }
         case ErrorMsg.Kicked:
             {
                 Error = "You have been kicked from the server";
                 break;
             }
         case ErrorMsg.ServerFull:
             {
                 Error = "The server is full";
                 break;
             }
         case ErrorMsg.VersionMismatch:
             {
                 Error = "Client/Server version mismatch";
                 break;
             }
         case ErrorMsg.ServerShutdown:
             {
                 Error = "Server has shutdown";
                 break;
             }
         case ErrorMsg.ServerRestart:
             {
                 Error = "Server is restarting";
                 break;
             }
         case ErrorMsg.Unkown:
             {
                 Error = "A unknown error has occured";
                 break;
             }
     }
 }
 /// <summary>
 /// draw the sample GUI and error messages
 /// </summary>
 void OnGUI()
 {
     // draw error messages in case there were any
     ErrorMsg.Draw();
 }
示例#4
0
文件: Status.cs 项目: TomLievense/FTM
    public static void GetStatus(string[] options, string[] args)
    {
        if (!Verification.ProfileIsValid())
        {
            return;
        }

        if (args.Length > 1)
        {
            ErrorMsg.TooManyArgs();
            return;
        }

        if (options.Length > 2)
        {
            ErrorMsg.TooManyOptions();
            return;
        }

        if (args.Length == 0)
        {
            Msg.InfoStatus();
            return;
        }

        bool userStatus       = false;
        bool checkedOutStatus = false;

        foreach (string option in options)
        {
            switch (option)
            {
            case "-o":
            case "--out":
                checkedOutStatus = true;
                break;

            case "-u":
            case "--user":
                userStatus = true;
                break;

            default:
                ErrorMsg.UnknownOption();
                return;
            }
        }

        if (userStatus)
        {
            GetUserProjectStatus(args[0], checkedOutStatus);
        }
        else if (!checkedOutStatus)
        {
            string serverPath = Program.settings.Read("remote");
            string path       = serverPath + "/" + args[0];

            GetProjectStatus(path);
        }
        else
        {
            Print.ErrorMessage("Option '--out' or '-o' cannot be used in the current context.");
        }
    }
示例#5
0
        /// <summary>
        /// 指定のキーのテキストフォーマットを、設定された言語に翻訳して取得
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string LocalizeTextFormat(ErrorMsg type, params object[] args)
        {
            string format = LocalizeText(type);

            return(string.Format(format, args));
        }
示例#6
0
 public Error custom(FieldHierarchyStr hierarchy, ErrorMsg customErrorMessage) =>
 Error.customError(o: component, hierarchy: hierarchy, error: customErrorMessage, context: context);
示例#7
0
        /// <summary>
        /// Hàm thêm mới shop, xử lý nghiệp vụ trước khi thêm
        /// </summary>
        /// <param name="shop">shop cần thêm mới</param>
        /// <returns>Success = true thì trả về số lượng bản ghi được thêm mới</returns>
        public ServiceResult InsertShop(Shop shop)
        {
            var serviceResult = new ServiceResult();
            var errorMsg      = new ErrorMsg();
            var dbContext     = new ShopRepository();

            //1.Validate bắt buộc nhập
            //Mã cửa hàng bắt buộc nhập
            if (shop.ShopCode == null || shop.ShopCode == string.Empty)
            {
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Error_Required_ShopCode;
                serviceResult.Success = false;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }
            //Tên cửa hàng bắt buộc nhập
            if (shop.ShopName == null || shop.ShopName == string.Empty)
            {
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Error_Required_ShopName;
                serviceResult.Success = false;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }
            //Địa chỉ cửa hàng bắt buộc nhập
            if (shop.Address == null || shop.Address == string.Empty)
            {
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Error_Required_Address;
                serviceResult.Success = false;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }

            //2.Validate dữ liệu không được phép trùng
            //ShopCode không được phép trùng

            var isExits = dbContext.CheckShopCodeExits(shop.ShopCode, shop.ShopId);

            if (isExits == true)
            {
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Error_Duplicates_ShopCode;
                serviceResult.Success = false;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }
            //Validate dữ liệu thành công thì thực hiện thêm mới:
            var res = dbContext.InsertObject(shop);

            if (res > 0)
            {
                serviceResult.Success = true;
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Success;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }
            else
            {
                serviceResult.Success = false;
                errorMsg.UserMsg      = MISA.Common.Properties.Resources.Error_Insert;
                serviceResult.Data    = errorMsg;
                return(serviceResult);
            }
        }
示例#8
0
 public void SetErrorState(ErrorMsg msg)
 {
     _errorstate.SetError(msg);
     SwitchState(GameState.ErrorState);
 }
        private bool AnalysisOutputXML(string outXML)
        {
            bool flag;

            try
            {
                this.AlarmListFirst = new List <string>();
                this.AlarmListMid   = new List <string>();
                this.AlarmListEnd   = new List <string>();
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(outXML);
                XmlNode xmlNodes = xmlDocument.SelectSingleNode("//PosMsgs");
                if (xmlNodes == null)
                {
                    ErrorMsg errorMsg = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "AnalysisOutputXML", "")
                    {
                        ErrorText = "返回的xml错误,不包含PosMsgs 节点"
                    };
                    this.logHelper.WriteError(errorMsg);
                    flag = false;
                }
                else
                {
                    foreach (XmlElement childNode in xmlNodes.ChildNodes)
                    {
                        int num  = int.Parse(childNode.Attributes["id"].Value);
                        int num1 = int.Parse(this.htNumCarid[num].ToString());
                        int num2 = int.Parse(this.htCaridStat[num1].ToString());
                        if (!((XmlElement)childNode.GetElementsByTagName("Status")[0]).Attributes["value"].Value.Equals("536870912"))
                        {
                            if (num2 != 1)
                            {
                                continue;
                            }
                            this.AlarmListEnd.Add(num1.ToString());
                            this.htCaridStat[num1] = 0;
                        }
                        else
                        {
                            if (num2 != 0)
                            {
                                this.AlarmListMid.Add(num1.ToString());
                            }
                            else
                            {
                                this.AlarmListFirst.Add(num1.ToString());
                            }
                            this.htCaridStat[num1] = 1;
                        }
                    }
                    flag = true;
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ErrorMsg  errorMsg1 = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "AnalysisOutputXML", string.Concat("解析返回XML错误,", exception.Message));
                this.logHelper.WriteError(errorMsg1);
                flag = false;
            }
            return(flag);
        }
示例#10
0
文件: Show.cs 项目: TomLievense/FTM
    public static void Show(string[] options, string[] args)
    {
        if (!Verification.ProfileIsValid())
        {
            return;
        }

        if (options.Length == 0)
        {
            ErrorMsg.NoOptions();
            return;
        }

        if (args.Length == 0)
        {
            ErrorMsg.NoArgs();
            return;
        }

        if (options.Length > 2)
        {
            ErrorMsg.TooManyOptions();
            return;
        }

        if (args.Length > 1)
        {
            ErrorMsg.TooManyArgs();
            return;
        }

        bool wOption = false;
        bool rOption = false;

        int previousVersion = 0;

        foreach (string option in options)
        {
            switch (option)
            {
            case "-w":
            case "--workspace":
                wOption = true;
                break;

            case "-r":
            case "--remote":
                rOption = true;
                break;

            default:

                // Check if option is version notation (for example -3)
                if (int.TryParse(option, out previousVersion))
                {
                    break;
                }

                ErrorMsg.UnknownOption();
                return;
            }
        }

        if (wOption && !rOption)
        {
            ShowFileWorkSpace(args[0]);
        }

        if (rOption && !wOption)
        {
            ShowFileRemote(args[0], previousVersion);
        }
    }
示例#11
0
        /// <summary>
        /// 获取车辆状态名称
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static string GetStatusNameByCarStatu(long status)
        {
            StringBuilder builder = new StringBuilder();

            try
            {
                //从状态列表中查询该状态值是否有对应的状态名称
                string bufferStatuName = GetBufferStatuName(status);
                if (!string.IsNullOrEmpty(bufferStatuName))
                {
                    return(bufferStatuName);
                }

                if ((1L & status) == 0L && (0x4000L & status) == 0)
                {
                    builder.Append("停车在线;");
                }
                else if ((1L & status) == 0 && (0x4000L & status) != 0)
                {
                    builder.Append("定位无效;");
                }

                if (!IsNull())
                {
                    long num = 0L;
                    foreach (DataRow row in _CarStatusList.Rows)
                    {
                        num = Convert.ToInt64(row["CarStatu"]);
                        if ((num != 0x4000L) && (num != 1L))
                        {
                            if ((num == 0x20000L) && ((num & status) != 0L))
                            {
                                builder.Append(Convert.ToString(row["CarStatuName"]) + ":开;");
                            }
                            else if ((num == 0x40000L) && ((num & status) != 0L))
                            {
                                builder.Append(Convert.ToString(row["CarStatuName"]) + ":开;");
                            }
                            else if ((num == 0x80000L) && ((num & status) != 0L))
                            {
                                builder.Append(Convert.ToString(row["CarStatuName"]) + ":开;");
                            }
                            else if ((num == 0x400000L) && ((num & status) != 0L))
                            {
                                builder.Append(Convert.ToString(row["CarStatuName"]) + ":开;");
                            }
                            else if ((num & status) != 0L)
                            {
                                builder.Append(Convert.ToString(row["CarStatuName"]) + ";");
                                //修改状态避免同时出现定位无效和定位状态 huzh 2014.2.18
                                //根据ACC状态和定位状态判断车辆状态
                                //由于华宝设备在ACC关闭后进入休眠,会将定位状态置为无效
                                //所以当ACC关且定位状态无效时,视为停车在线状态
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorMsg msg = new ErrorMsg("AlamStatus", "GetStatusNameByCarStatu", exception.Message);
                new LogHelper().WriteError(msg);
            }
            if (string.IsNullOrEmpty(builder.ToString()))
            {
                builder.Append("卫星定位;");
            }
            else
            {
                AddBufferStatuName(status, builder.ToString());
            }
            //System.Diagnostics.Trace.Write(builder.ToString() + status.ToString() +  "\r\n");
            return(builder.ToString());
        }
示例#12
0
		/// <summary>
		/// 指定のキーのテキストフォーマットを、設定された言語に翻訳して取得
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		public static string LocalizeTextFormat(ErrorMsg type, params object[] args )
		{
			string format = LocalizeText(type);
			return string.Format(format, args);
		}
示例#13
0
        public override string Fetch(DataRow dr)
        {
            Initialize(dr, true);

            string lic_no    = dr["lic_no"].ToString().Replace(".", "").Replace("-", "").Replace("_", "").Replace("/", "").Replace("\\", "").Replace(" ", "").Trim().ToUpper();
            string firstName = dr["dr_fname"].ToString().Trim();
            string lastName  = dr["dr_lname"].ToString().Trim();
            string org       = dr["orgName"].ToString().Trim();

            if (String.IsNullOrEmpty(org))
            {
                return(ErrorMsg.Custom("Invalid organization name"));
            }
            if (String.IsNullOrEmpty(lic_no))
            {
                return(ErrorMsg.InvalidLicense);
            }
            else if (String.IsNullOrEmpty(firstName) || String.IsNullOrEmpty(lastName))
            {
                return(ErrorMsg.InvalidFirstLastName);
            }

            ArrayList profsToQuery = GetProfsToQuery(dr["drtitle"].ToString().ToUpper());

            if (profsToQuery.Count == 0)
            {
                if (org == "Georgia State Board of Optometry")
                {
                    profsToQuery = GetProfsToQuery("OPT");
                }
                else if (org == "Georgia Board of Nursing")
                {
                    profsToQuery = GetProfsToQuery("RN");
                }
                else if (org == "Georgia State Board of Examiners of Psychologists")
                {
                    profsToQuery = GetProfsToQuery("PSY");
                }
                else if (org == "Georgia Board of Chiropractic Examiners")
                {
                    profsToQuery = GetProfsToQuery("CHIR");
                }
                else if (org == "Georgia Board of Marriage and Family Therapists")
                {
                    profsToQuery = GetProfsToQuery("MFT");
                }
                else if (org == "Georgia Board of Professional Counselors")
                {
                    profsToQuery = GetProfsToQuery("LPC");
                }
                else if (org == "Georgia State Board of Podiatry")
                {
                    profsToQuery = GetProfsToQuery("POD");
                }
                else if (org == "Georgia State Board of Physical Therapy")
                {
                    profsToQuery = GetProfsToQuery("PT");
                }
                //else if (org == "Georgia Secretary of State") { profsToQuery = GetProfsToQuery(""); }
                else
                {
                    Match match = Regex.Match(lic_no, "[a-zA-Z]+", RegexOptions.IgnoreCase);

                    if (match.Success)
                    {
                        profsToQuery = GetProfsToQuery(match.Value);

                        if (profsToQuery.Count == 0)
                        {
                            return(ErrorMsg.InvalidTitle);
                        }
                    }
                    else
                    {
                        return(ErrorMsg.InvalidTitle);
                    }
                }
            }

            HttpWebResponse objResponse = null;
            HttpWebRequest  objRequest  = null;
            //http://sos.ga.gov/myverification/;
            string basehref = "http://verify.sos.ga.gov/verification/";
            string url      = basehref;
            string url2     = basehref;
            string result   = String.Empty;

            //MT 04/23/2008 Hit the login page to get the cookies info
            if (WebFetch.IsError(result = WebFetch.ProcessGetRequest2(ref objRequest, ref objResponse, url, "", null, null)))
            {
                return(ErrorMsg.CannotAccessSite);
            }

            result += "\n\r-----------------------------------\n\r";

            foreach (Cookie c in objResponse.Cookies)
            {
                result += c.Name + ":::" + c.Value + ":::" + c.Expires + "\n\r";
            }

            //Use the cookieColl to hold every cookie from every objResponse that comes back
            string           pattern      = string.Empty;
            string           searchStatus = string.Empty;
            CookieCollection cookieColl   = new CookieCollection();

            //Add response cookies to cookieCollection
            cookieColl.Add(objResponse.Cookies);
            string theViewState  = getFieldVal("__VIEWSTATE", result);
            string eventTarget   = getFieldVal("__EVENTTARGET", result);
            string eventArgument = getFieldVal("__EVENTARGUMENT", result);

            // Since some of these potentially need to query against multiple providers, loop through the list and try each
            // For each of them, check whether there were 0, 1 or n results.  If 1 result, then abort loop, otherwise continue through profs
            foreach (string s in profsToQuery)
            {
                string[] profTypeSplit   = s.Split('|');
                string   professionName  = profTypeSplit[0].Replace(" ", "+");
                string   licenseTypeName = profTypeSplit[1].Replace(" ", "+");

                string
                    post = "__EVENTTARGET=" + eventTarget
                           + "&__EVENTARGUMENT=" + eventArgument
                           + "&__VIEWSTATE=" + theViewState
                           + "&t_web_lookup__profession_name=" + professionName
                           + "&t_web_lookup__license_type_name=" + licenseTypeName
                           + "&t_web_lookup__first_name=" //+ firstName
                           + "&t_web_lookup__last_name="  //+ lastName
                           + "&t_web_lookup__license_no=" + lic_no
                           + "&t_web_lookup__addr_county="
                           + "&sch_button=Search";

                //url = "http://secure.sos.state.ga.us/myverification/Search.aspx";
                url = "http://verify.sos.ga.gov/verification/";

                if (!WebFetch.IsError(result = WebFetch.ProcessPostRequest(ref objRequest, ref objResponse, url, post, "", null, cookieColl)))
                {
                    result = WebFetch.ProcessPostResponse(ref objResponse, ref objRequest);
                }
                else
                {
                    return(ErrorMsg.CannotAccessSearchResultsPage);
                }

                result += "\n\r-----------------------------------\n\r";

                foreach (Cookie c in objResponse.Cookies)
                {
                    result += c.Name + ":::" + c.Value + ":::" + c.Expires + "\n\r";
                }

                // var cookiessss = cookieColl.ToString().Split('/');
                //Add response cookies to cookieCollection
                cookieColl.Add(objResponse.Cookies);
                pattern = "(?<LINK>Details\\.aspx[^\"]*)\"";
                MatchCollection mc = Regex.Matches(result, pattern, RegexOptions.Singleline | RegexOptions.IgnoreCase);
                if (mc.Count < 1)
                {
                    searchStatus = "no matches found";
                }
                else if (mc.Count > 1)
                {
                    searchStatus = "multiple matches found";
                    break;
                }

                else
                {
                    string theLink = mc[0].Groups["LINK"].ToString().Trim();
                    theLink      = Regex.Replace(theLink, "&amp;", "&");
                    url          = httpPrefix(theLink, basehref);
                    searchStatus = "found";
                    break;
                }
            }

            if (searchStatus == "no matches found")
            {
                //return "no matches found";
                return(PlugIn4_5.ErrorMsg.NoResultsFound);
            }
            else if (searchStatus == "multiple matches found")
            {
                //return "multiple matches found";
                return(ErrorMsg.MultipleProvidersFound);
            }


            if (!WebFetch.IsError(result = WebFetch.ProcessGetRequest2(ref objRequest, ref objResponse, url, "", null, cookieColl)))
            {
                pdf.Html  = "<img id='banner_image' height='121' width='717' src='http://verify.sos.ga.gov/verification/images/banner.png' border='0' /><tr>" + Regex.Match(result, "<td class=\"pagetitle\".*?</div>.*?</tr>", RegexOptions.IgnoreCase | RegexOptions.Singleline).ToString();
                pdf.Html  = Regex.Replace(pdf.Html, "<td class=\".*?colspan=.*?\">", "<td>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                pdf.Html  = Regex.Replace(pdf.Html, "Licensee Details", "");
                pdf.Html += "This website is to be used as a primary source verification for licenses issued by the Professional Licensing Boards.  Paper verifications are available for a fee. Please contact the Professional Licensing Boards at 478-207-2440.";
                pdf.ConvertToABCImage(new ImageParameters()
                {
                    BaseUrl = url
                });
            }
            else
            {
                return(ErrorMsg.CannotAccessDetailsPage);
            }

            result = cleanAllTags(result);
            result = (getLicenseeInfo(result) + "\n" + getLicenseInfo(result) + "\n" + getAssocLics(result) + "\n" + getDiscipInfo(result));
            result = replaceStartTags(result, "br", "\n");
            result = replaceEndTags(result, "br", "");
            result = replaceStartTags(result, "p", "\n");
            result = replaceEndTags(result, "p", "");
            result = replaceStartTags(result, "b", "");
            result = replaceEndTags(result, "b", "");

            Match m = Regex.Match(result, "(No\\s+Discipline\\s+Info)|(No\\s+Other\\s+Documents)", RegexOptions.Singleline | RegexOptions.IgnoreCase);

            setSanction(!m.Success);

            if (this.expirable)
            {
                handleExpirable(result, dr["lic_exp"].ToString().Trim(), @"Expires\s*(:)*\s*</td>\s*<td>\s*(?<EXP>\d{1,2}(/|-)\d{1,2}(/|-)\d{2,4})\s*</td>", "EXP");
            }

            return(result);
        }
示例#14
0
        private void LCSPosTimer()
        {
            ErrorMsg errorMsg = new ErrorMsg("service", "tLCSPosTimer_Elapsed", "");
            LogMsg   logMsg   = new LogMsg("service", "tLCSPosTimer_Elapsed", "");

            this.getLBSPosParam();
            string empty = string.Empty;
            int    num   = 0;
            long   num1  = (long)0;
            int    num2  = 0;

            while (this.LCSList.Count > 0 && num2 < this.LCSList.Count)
            {
                string[] strArrays = this.LCSList[num2].ToString().Split(new char[] { '|' });
                empty = strArrays[0];
                num   = Convert.ToInt32(strArrays[1]);
                if (this.myDownData.iCar_SetPosReport(CmdParam.ParamType.SimNum, empty, "", CmdParam.CommMode.未知方式, this.m_PosReport, num) != (long)-1)
                {
                    logMsg.Msg = string.Concat("发送LCS失败队列中的车辆成功,SIM卡:", empty);
                    this.logHelper.WriteLog(logMsg);
                    this.LCSList.RemoveAt(num2);
                }
                else
                {
                    num2++;
                    errorMsg.ErrorText = string.Concat("LCS定位,下发失败队列中的车辆失败,SIM卡:", empty);
                    this.logHelper.WriteError(errorMsg);
                }
            }
            if (this.LCSList.Count == 0)
            {
                this.LCSList.Clear();
            }
            while (DateTime.Now > this.dLCSPosTime)
            {
                DateTime  dateTime   = this.dLCSPosTime;
                DataTable dataTable  = new DataTable();
                int       lCSPosData = this.GetLCSPosData(dateTime.ToString("yyyy/MM/dd"), dateTime.ToString("HH:mm"), out dataTable);
                if (lCSPosData == 0)
                {
                    this.addLCSTime();
                }
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    foreach (DataRow row in dataTable.Rows)
                    {
                        empty = row["SimNum"].ToString();
                        num   = Convert.ToInt32(row["CarId"]);
                        if (this.myDownData.iCar_SetPosReport(CmdParam.ParamType.SimNum, empty, "", CmdParam.CommMode.未知方式, this.m_PosReport, num) != (long)-1)
                        {
                            logMsg.Msg = string.Concat("下发LCS定位成功,SIM卡:", empty);
                            this.logHelper.WriteLog(logMsg);
                        }
                        else
                        {
                            if (this.LCSList.Contains(empty))
                            {
                                errorMsg.ErrorText = string.Concat("LCS定位,下发指令失败,失败队列中已存在该车,上次定位丢失,SIM卡:", empty);
                            }
                            else if (this.LCSList.Count < ReadDataFromXml.LCSCount)
                            {
                                this.LCSList.Add(string.Concat(empty, "|", num));
                                errorMsg.ErrorText = string.Concat("LCS定位,下发指令失败,加入到失败队列中等待重新下发,SIM卡:", empty);
                            }
                            else
                            {
                                errorMsg.ErrorText = string.Concat("LCS定位,下发指令失败,队列已满,未加入到失败队列中,SIM卡:", empty);
                            }
                            this.logHelper.WriteError(errorMsg);
                        }
                    }
                }
                if (lCSPosData == 0)
                {
                    continue;
                }
                return;
            }
        }
示例#15
0
 public override void onLoginFailed(ErrorMsg errMsg)
 {
     showLog("onLoginFailed", "msg: " + errMsg.errMsg);
 }
示例#16
0
        public IEnumerable <Token> Scan()
        {
            char peek;

            if (!chars.MoveNext())
            {
                yield break;
            }
            do
            {
                peek      = chars.Current;
                dont_move = false;
                if (peek == '\n')
                {
                    ++Row;
                    Col = 0;
                    continue;
                }
                else if (char.IsWhiteSpace(peek))
                {
                    continue;
                }
                else if (peek == ',')
                {
                    yield return(new Token(TokenType.COMMA, ',', Row, Col));
                }
                else if ("+-/*".IndexOf(peek) != -1)
                {
                    yield return(new Token(TokenType.OP, peek, Row, Col));
                }
                else if ("()".IndexOf(peek) != -1)
                {
                    yield return(new Token(TokenType.BRACKET, peek, Row, Col));
                }
                else if (Char.IsDigit(peek))
                {
                    int row = Row, col = Col;
                    yield return(new Token(TokenType.NUM, GetSubstringByCond(peek, Char.IsDigit), row, col));
                }
                else if (Char.IsLetter(peek))
                {
                    int row = Row, col = Col;
                    yield return(new Token(TokenType.ID, GetSubstringByCond(peek, Char.IsLetterOrDigit), row, col));
                }
                else if (peek == '=')
                {
                    yield return(new Token(TokenType.OP, peek, Row, Col));
                }
                else if (peek == ';')
                {
                    yield return(new Token(TokenType.SEMICOLON, peek, Row, Col));
                }
                else if (peek == ':')
                {
                    if (MoveNext() && chars.Current == '=')
                    {
                        yield return(new Token(TokenType.ASSIGN, ":=", Row, Col - 1));
                    }
                    else
                    {
                        ErrorMsg.Add("Missing '=' after ':' ", Row, Col); // Or:   dontmove = true; Ignore this mistake
                    }
                }
                else if (peek == '<')
                {
                    if (MoveNext())
                    {
                        if (chars.Current == '=')
                        {
                            yield return(new Token(TokenType.OP, "<=", Row, Col - 1));
                        }
                        else if (chars.Current == '>')
                        {
                            yield return(new Token(TokenType.OP, "<>", Row, Col - 1));
                        }
                        else
                        {
                            dont_move = true;
                            yield return(new Token(TokenType.OP, '<', Row, Col));
                        }
                    }
                    else
                    {
                        yield return(new Token(TokenType.OP, '<', Row, Col));
                    }
                }
                else if (peek == '>')
                {
                    if (MoveNext())
                    {
                        if (chars.Current == '=')
                        {
                            yield return(new Token(TokenType.OP, ">=", Row, Col - 1));
                        }
                        else
                        {
                            dont_move = true;
                            yield return(new Token(TokenType.OP, '>', Row, Col));
                        }
                    }
                    else
                    {
                        yield return(new Token(TokenType.OP, '>', Row, Col));
                    }
                }
                else if (peek == '.')
                {
                    yield return(new Token(TokenType.PERIOD, '.', Row, Col));
                }
                else
                {
                    string tmp = "";
                    int    row = Row, col = Col;
                    while (!char.IsWhiteSpace(peek))
                    {
                        tmp += peek;
                        if (!MoveNext())
                        {
                            break;
                        }
                        peek = chars.Current;
                    }
                    ErrorMsg.Add($"Unknown Token '{tmp}'", row, col);
                }

                //else if ("\"\'".IndexOf(peek) != -1) yield return new Token(TokenType.STRING, (object)TODO, Line); //PL0 doesn't have string
            }while (dont_move || MoveNext()); //'dont_move' can avoid too much MoveNext()
        }
示例#17
0
        public override string Fetch(DataRow dr)
        {
            Initialize(dr, true);
            string url         = string.Empty;
            string output      = string.Empty;
            string message     = string.Empty;
            var    detailsPage = "";
            string code        = string.Empty;

            try
            {
                var fields = Validate();
                if (fields.IsValid)
                {
                    string firstpage = SiteCalling_HTTPPOSTANDGET("https://portalclient.echo-cloud.com/98059portal/VerifPortal/msltop.asp?id=", "GET", cookiesresponse, "");
                    if (firstpage != null && firstpage.Contains("*Required Fields"))
                    {
                        _htmlDocResults.LoadHtml(firstpage);
                        var secondpage = SiteCalling_HTTPPOSTANDGET("https://portalclient.echo-cloud.com/98059portal/VerifPortal/doclist.asp", "POST", cookiesresponse, GetParamm());
                        if (secondpage != null && !secondpage.Contains("No physicians"))
                        {
                            _htmlDocResults.LoadHtml(secondpage);
                            HtmlNodeCollection Temptrs = _htmlDocResults.DocumentNode.SelectNodes("//tr/td/a[contains(.," + provider.LastName + ")]");
                            if (Temptrs != null && Temptrs.Count() > 0)
                            {
                                int TotalRecords = Temptrs.Count();
                                foreach (HtmlNode Temptr in Temptrs)
                                {
                                    if (Temptr != null)
                                    {
                                        HtmlAttribute att = Temptr.Attributes["href"];
                                        if (att != null)
                                        {
                                            string GetUrlString = att.Value;
                                            if (!string.IsNullOrEmpty(GetUrlString))
                                            {
                                                GetUrlString = GetUrlString.Replace("JavaScript:SubmitVerif(", "").Replace(")", "").Replace("'", "");
                                                string[] Urlcode = GetUrlString.Split(',');
                                                if (Urlcode != null && Urlcode.Count() >= 4)
                                                {
                                                    var details = SiteCalling_HTTPPOSTANDGET("https://portalclient.echo-cloud.com/98059portal/VerifPortal/docset.asp?dr_id=" + HttpUtility.UrlEncode(Urlcode[0]) + "&standing=" + HttpUtility.UrlEncode(Urlcode[1]) + "&uname=Test&title=Test&org=Test&addr=Test&addr2=Test&reclink=" + HttpUtility.UrlEncode(Urlcode[2]) + "&recstat=" + HttpUtility.UrlEncode(Urlcode[3]), "GET", cookiesresponse, "");
                                                    if (details != null && details.Contains("Sentara Medical Staff Services"))
                                                    {
                                                        _TemphtmlDocResults.LoadHtml(details);
                                                        GetpageDetails();
                                                    }
                                                    else
                                                    {
                                                        message = ErrorMsg.CannotAccessDetailsPage;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                message = ErrorMsg.Custom("JavaScript element not found");
                                            }
                                        }
                                        else
                                        {
                                            message = ErrorMsg.Custom("Error occurred while retrieving the Anchor Node");
                                        }
                                    }
                                    else
                                    {
                                        message = ErrorMsg.Custom("Error occurred while retrieving the data");
                                    }
                                }
                                if (_sbResponseHtmlCollection != null && _sbResponseHtmlCollection.Count() > 0 && _sbResponseHtmlCollection.Count() == _sbResponseTextCollection.Count())
                                {
                                    int SelectedRecords = _sbResponseHtmlCollection.Count();
                                    if (SelectedRecords > 1)
                                    {
                                        _sbResponseHtml.Append("<tr><td> --- Multiple Results Found </td><td>(Total: ");
                                        _sbResponseHtml.Append(SelectedRecords.ToString());
                                        _sbResponseHtml.Append(") --- </td></tr>");
                                        _sbResponseText.Append(" --- Multiple Result Found (Total: " + SelectedRecords + ") --- ");
                                        _sbResponseText.Append('\r');
                                        _sbResponseText.Append('\n');
                                    }
                                    int Count = 1;
                                    for (int i = 0; i < SelectedRecords; i++)
                                    {
                                        if (_sbResponseHtmlCollection[i] != null && _sbResponseTextCollection[i] != null)
                                        {
                                            if (SelectedRecords > 1)
                                            {
                                                _sbResponseHtml.Append("<tr><td>--- Result </td><td>(" + Count + " Of " + SelectedRecords + ") --- </td></tr>");
                                                _sbResponseText.Append("--- Result (" + Count + " Of " + SelectedRecords + ") --- ");
                                                _sbResponseText.Append('\r');
                                                _sbResponseText.Append('\n');
                                            }
                                            _sbResponseHtml.Append(_sbResponseHtmlCollection[i]);
                                            _sbResponseText.Append(_sbResponseTextCollection[i]);
                                            Count++;
                                        }
                                    }
                                    output  = _sbResponseHtml.ToString();
                                    message = _sbResponseText.ToString();
                                    try
                                    {
                                        pdf.Html = detailsPage;
                                        pdf.ConvertToABCImage(new ImageParameters {
                                            BaseUrl = "https://portalclient.echo-cloud.com/98059portal/VerifPortal/"
                                        });
                                    }
                                    catch { }
                                }
                                else
                                {
                                    message = ErrorMsg.Custom("Facility name not matching with user name");
                                }
                            }
                            else
                            {
                                message = ErrorMsg.NoResultsFound;
                            }
                        }
                        else
                        {
                            message = ErrorMsg.NoResultsFound;
                        }
                    }
                    else
                    {
                        message = ErrorMsg.CannotAccessSite;
                    }
                }
                else
                {
                    message = fields.Error.Message;
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(ProcessResults(output, message));
        }
 private void InsertAlarmInfo(DataRow dr, int AddMsgType)
 {
     try
     {
         int    num   = 0;
         string empty = string.Empty;
         int    num1  = Convert.ToInt32(dr["carstatu"]);
         long   num2  = (long)0;
         num2 = (dr["carStatuEx"] == DBNull.Value || dr["carstatuex"].ToString().Equals("") ? 274877906944L : 274877906944L | Convert.ToInt64(dr["carstatuex"]));
         int    num3 = 1154;
         int    num4 = 65;
         string str  = string.Empty;
         string str1 = dr["AddMsgTxt"].ToString();
         string str2 = null;
         bool   flag = false;
         string str3 = null;
         int    num5 = 0;
         try
         {
             SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num4), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num1), new SqlParameter("@carStatuEx", (object)num2), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num3), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", (object)AddMsgType), new SqlParameter("@addTxt", str1), new SqlParameter("@DutyStr", str2), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str3), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) };
             string         str4         = "GpsPicServer_Alarm_Insert";
             string         str5         = "GpsPicServer_RealTime_Insert";
             if (AddMsgType != -99997)
             {
                 int num6 = SqlDataAccess.insertBySp(str4, sqlParameter);
                 if (num6 > 0)
                 {
                     LogMsg logMsg = new LogMsg("PlatFormAlarmThreeLevelRoadAlarm", "InsertAlarmInfo", "")
                     {
                         Msg = string.Concat("车载电话为:", dr["telephone"].ToString(), "的平台检测三级路面报警报文已插入gpsrecebuffer")
                     };
                     this.logHelper.WriteLog(logMsg);
                 }
                 else
                 {
                     ErrorMsg errorMsg = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "InsertAlarmInfo", string.Concat("将平台检测三级路面报警报文插入gpsrecbuffer表错误,返回值!", num6.ToString()));
                     this.logHelper.WriteError(errorMsg);
                 }
             }
             int num7 = SqlDataAccess.insertBySp(str5, sqlParameter);
             if (num7 > 0)
             {
                 LogMsg logMsg1 = new LogMsg("PlatFormAlarmThreeLevelRoadAlarm", "InsertAlarmInfo", string.Concat("车载电话为:", dr["telephone"].ToString(), "的平台检测三级路面报警报文已插入gpsrecerealtime"))
                 {
                     Msg = string.Concat("车载电话为:", dr["telephone"].ToString(), "的平台检测三级路面报警报文已插入gpsrecerealtime")
                 };
                 this.logHelper.WriteLog(logMsg1);
             }
             else
             {
                 ErrorMsg errorMsg1 = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "InsertAlarmInfo", string.Concat("将平台检测三级路面报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num7.ToString()));
                 this.logHelper.WriteError(errorMsg1);
             }
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             ErrorMsg  errorMsg2 = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "InsertAlarmInfo", string.Concat("车载电话为:", dr["telephone"].ToString(), "的平台检测三级路面报警报文插入数据库发生错误! 信息:", exception.Message));
             this.logHelper.WriteError(errorMsg2);
         }
     }
     catch (Exception exception3)
     {
         Exception exception2 = exception3;
         ErrorMsg  errorMsg3  = new ErrorMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat("将平台检测三级路面报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message));
         this.logHelper.WriteError(errorMsg3);
     }
 }
示例#19
0
 public override void onInitFailed(ErrorMsg message)
 {
     Debug.LogError("初始化失败, msg: " + message);
 }
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                //TaskInfoDialog.Messages.Add("开始质检项目:" + Project.ProjectName);
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "质检项目:" + Project.ProjectName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);
                Task task = new Task(() =>
                {
                    //Thread.Sleep(2000);

                    QualityControl qualityControl = new QualityControl();
                    qualityControl.Project        = ProjectDal.InitialRealEstateProject(Project);
                    qualityControl.TaskMessage    = taskMessage;
                    try
                    {
                        ErrorMsg.AddRange(qualityControl.Check());
                    }
                    catch (Exception ex)
                    {
                        ErrorMsg.Add(ex.Message);
                    }
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("质检不通过");
                                Project.State      = "0";
                                Project.UptateTime = DateTime.Now;
                                ProjectDal.Modify(Project);
                            }
                            else
                            {
                                taskMessage.DetailMessages.Add("质检合格");
                                Project.State      = "1";
                                Project.UptateTime = DateTime.Now;
                                ProjectDal.Modify(Project);
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#21
0
 public override void onLoginFailed(ErrorMsg message)
 {
     Debug.LogError("登录失败, msg: " + message);
 }
示例#22
0
 protected override bool IsInsertDataValid(CustomerGroup entity, ErrorMsg errorMsg = null)
 {
     return(base.IsInsertDataValid(entity, errorMsg));
 }
 public void OnError()
 {
     ErrorMsg?.Invoke();
 }
示例#24
0
        private void tCheckForbidDriveAlarm_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.tCheckForbidDriveAlarm.Enabled = false;
            this.dtTmp = ReadDataFromDB.GetSvrTime();
            DataTable dataBySP = null;

            SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@CurrentTime", (object)this.dtTmp) };
            dataBySP = SqlDataAccess.getDataBySP("GpsPicServer_GetForbidDriveAlarmConfig", sqlParameter);
            ArrayList arrayLists = new ArrayList();

            foreach (int key in this.htCaridStat.Keys)
            {
                if ((int)dataBySP.Select(string.Concat("Carid=", key)).Length != 0)
                {
                    continue;
                }
                arrayLists.Add(key);
            }
            foreach (int arrayList in arrayLists)
            {
                this.htCaridStat.Remove(arrayList);
            }
            try
            {
                try
                {
                    this.dtConfig = this.getConfig();
                    if (this.dtConfig != null && this.dtConfig.Rows.Count > 0)
                    {
                        foreach (DataRow row in this.dtConfig.Rows)
                        {
                            int num = int.Parse(row["CarId"].ToString());
                            if (!this.htCaridStat.Contains(num))
                            {
                                this.htCaridStat[num] = 0;
                            }
                            double   num1      = double.Parse(row["Speed"].ToString());
                            int      num2      = int.Parse(this.htCaridStat[num].ToString());
                            DateTime dateTime  = DateTime.Parse(row["GpsTime"].ToString());
                            string   str       = dateTime.ToString("HH:mm");
                            DateTime dateTime1 = DateTime.Parse(row["StartTime"].ToString());
                            string   str1      = dateTime1.ToString("HH:mm");
                            DateTime dateTime2 = DateTime.Parse(row["EndTime"].ToString());
                            string   str2      = dateTime2.ToString("HH:mm");
                            if ((str1.CompareTo(str2) >= 0 || str.CompareTo(str1) <= 0 || str.CompareTo(str2) >= 0) && (str1.CompareTo(str2) <= 0 || str.CompareTo(str1) <= 0 && str.CompareTo(str2) >= 0))
                            {
                                if (num2 != 1)
                                {
                                    continue;
                                }
                                this.AlarmListEnd.Add(num.ToString());
                                this.htCaridStat[num] = 0;
                            }
                            else if (num1 <= 0.001)
                            {
                                if (num2 != 1)
                                {
                                    continue;
                                }
                                this.AlarmListEnd.Add(num.ToString());
                                this.htCaridStat[num] = 0;
                            }
                            else if (num2 != 0)
                            {
                                this.AlarmListMid.Add(num.ToString());
                            }
                            else
                            {
                                this.AlarmListFirst.Add(num.ToString());
                                this.htCaridStat[num] = 1;
                            }
                        }
                        this.dtNow = this.dtTmp;
                    }
                    this.CheckAndInsert();
                }
                catch (Exception exception)
                {
                    ErrorMsg errorMsg = new ErrorMsg("PlatFormrForbidDriveAlarm", "tCheckForbidDrivingAlarm_Elapsed", exception.Message);
                    this.logHelper.WriteError(errorMsg);
                }
            }
            finally
            {
                this.tCheckForbidDriveAlarm.Enabled = true;
            }
        }
示例#25
0
 /// <summary>
 /// Hàm Validate để các Service con ghi đè, trả về mặc định là true
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="errorMsg"></param>
 /// <returns>true - hợp lệ; false - không hợp lệ</returns>
 /// CreatedBy: NTANH (21/02/2021)
 protected virtual bool ValidateUpdate(MISAEntity entity, ErrorMsg errorMsg = null)
 {
     return(true);
 }
示例#26
0
    public static void Diff(string[] options, string[] args)
    {
        if (!Verification.ProfileIsValid())
        {
            return;
        }

        if (args.Length == 0)
        {
            Msg.InfoDiff();
            return;
        }

        if (args.Length > 2)
        {
            ErrorMsg.TooManyArgs();
            return;
        }

        string rootFileOld = null;
        string rootFileNew = null;

        int?previousVersionOld = null;
        int?previousVersionNew = null;

        bool isRemoteOld = false;
        bool isRemoteNew = false;

        foreach (string option in options)
        {
            if (option == "--workspace" || option == "-w")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = Program.settings.Read("workspace") + "/";
                }
                else
                {
                    rootFileNew = Program.settings.Read("workspace") + "/";
                }
            }
            else if (option == "--remote" || option == "-r")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = Program.settings.Read("remote") + "/";
                    isRemoteOld = true;
                }
                else
                {
                    rootFileNew = Program.settings.Read("remote") + "/";
                    isRemoteNew = true;
                }
            }
            else if (option == "--other" || option == "-o")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = "";
                }
                else
                {
                    rootFileNew = "";
                }
            }
            else
            {
                // Check if option is version notation (for example -3)
                if (int.TryParse(option, out int revisionStamp))
                {
                    if (previousVersionOld == null)
                    {
                        previousVersionOld = revisionStamp;
                    }
                    else
                    {
                        previousVersionNew = revisionStamp;
                    }
                }
            }
        }

        if (previousVersionNew == null)
        {
            previousVersionNew = 0;
        }

        if (previousVersionOld == null)
        {
            previousVersionOld = 0;
        }

        if (rootFileNew == null)
        {
            rootFileNew = rootFileOld;
        }

        string relPathOld = null;
        string relPathNew = null;

        foreach (string arg in args)
        {
            if (relPathOld == null)
            {
                relPathOld = arg;
            }
            else
            {
                relPathNew = arg;
            }
        }

        if (relPathNew == null)
        {
            relPathNew  = relPathOld;
            isRemoteNew = isRemoteOld;
        }

        string absPathOld = rootFileOld + relPathOld;
        string absPathNew = rootFileNew + relPathNew;

        Console.WriteLine(absPathOld + " " + previousVersionOld);
        Console.WriteLine(absPathNew + " " + previousVersionNew);

        string oldText = (isRemoteOld)
            ? GetFileRemote(absPathOld, (int)previousVersionOld)
            : File.ReadAllText(absPathOld);

        string newText = (isRemoteNew)
            ? GetFileRemote(absPathNew, (int)previousVersionNew)
            : File.ReadAllText(absPathNew);

        if (newText == null || oldText == null)
        {
            return;
        }

        List <SubText> compareResult = GetLCScollection(oldText, newText);

        foreach (SubText result in compareResult)
        {
            switch (result.blockType)
            {
            case BlockType.AddedText:
                Print.WriteBlueWord(result.text);
                break;

            case BlockType.RemovedText:
                Print.WriteRedWord(result.text);
                break;

            case BlockType.LCStext:
                Console.Write(result.text);
                break;
            }
        }

        Console.WriteLine();
    }
        //保存
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            //错误信息
            StringBuilder error = new StringBuilder();

            if (this.Data == null && Request["id"] != null)
            {
                //根据ID获取任务对象
                //this.Data = (ETLJob)ETLJobAdapter.Instance.Load(Convert.ToString(Request["id"]));
                this.Data = JobBaseAdapter.Instance.Load(c => c.AppendItem("job_id", Convert.ToString(Request["id"]))).FirstOrDefault();
            }

            if (!Util.CheckOperationSafe())
            {
                return;
            }
            //ETL任务
            if (ddl_JobType.SelectedValue == "ETLService")
            {
                #region

                JobScheduleCollection pvc = new JobScheduleCollection();
                //计划列表
                if (ch_IsAuto.Checked)
                {
                    //pvc = JSONSerializerExecute.Deserialize<JobScheduleCollection>(schedules.Value);
                    pvc = GetSchedules(schedules.Value);
                }

                ETLEntityCollection etls = GetETLEntities(etlEntities.Value);

                ETLWhereConditionCollection wheres = JSONSerializerExecute.Deserialize <ETLWhereConditionCollection>(conditions.Value);
                if (this.Data != null)
                {
                    ETLJob job = ETLJobAdapter.Instance.Load(this.Data.JobID) as ETLJob;
                    this.Data       = job;
                    job.Category    = txt_jobCategory.Text;
                    job.Enabled     = ddl_Enabled.SelectedValue == "1" ? true : false;
                    job.JobType     = JobType.ETLService;
                    job.Description = txt_JobDescription.Text;
                    job.Name        = txt_JobName.Text;
                    job.Schedules   = pvc;
                    job.ETLEntities = etls;
                    job.IsAuto      = ch_IsAuto.Checked;
                    job.IsIncrement = ch_IsIncrement.Checked;
                    wheres.ForEach(w => { w.JOB_ID = this.Data.JobID; w.ID = Guid.NewGuid().ToString(); });

                    job.ETLWhereConditions = wheres;

                    if (CheckEtlEntities())
                    {
                        ETLJobOperations.Instance.DoOperation(EntityJobOperationMode.Update, job);
                    }
                }
                else
                {
                    ETLJob job = new ETLJob()
                    {
                        JobID       = Guid.NewGuid().ToString(),
                        Category    = txt_jobCategory.Text,
                        Enabled     = ddl_Enabled.SelectedValue == "1" ? true : false,
                        JobType     = JobType.ETLService,
                        Description = txt_JobDescription.Text,
                        Name        = txt_JobName.Text,
                        Schedules   = pvc,
                        ETLEntities = etls,
                        IsAuto      = ch_IsAuto.Checked,
                        IsIncrement = ch_IsIncrement.Checked
                    };
                    wheres.ForEach(w => { w.JOB_ID = job.JobID; w.ID = Guid.NewGuid().ToString(); });

                    job.ETLWhereConditions = wheres;

                    this.Data = job;
                    if (CheckEtlEntities())
                    {
                        ETLJobOperations.Instance.DoOperation(EntityJobOperationMode.Add, job);
                    }
                }
                if (string.IsNullOrEmpty(ErrorMsg))
                {
                    HttpContext.Current.Response.Write("<script>window.returnValue=true;window.close();</script>");
                    //this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWindow", "window.returnValue=true;window.close()", true);
                }
                else
                {
                    //ViewState["conditions"] = conditions.Value;
                    ViewState["schedules"] = schedules.Value;
                    conditions.Value       = JSONSerializerExecute.Serialize((this.Data as ETLJob).ETLWhereConditions);

                    ViewState["etlEntities"] = etlEntities.Value;


                    //计划列表
                    List <ScheduleGridObj> scheduleList = new List <ScheduleGridObj>();
                    foreach (JobSchedule item in this.Data.Schedules)
                    {
                        scheduleList.Add(new ScheduleGridObj()
                        {
                            ID          = item.ID,
                            Name        = item.Name,
                            Description = item.Description
                        });
                    }
                    ViewState["schedulesGrid"] = JSONSerializerExecute.Serialize(scheduleList);;
                    grid.InitialData           = scheduleList;

                    //etl实体列表
                    List <EtlGridObj> etlJobs = new List <EtlGridObj>();
                    foreach (ETLEntity item in (this.Data as ETLJob).ETLEntities)
                    {
                        etlJobs.Add(new EtlGridObj()
                        {
                            ID          = item.ID,
                            CodeName    = item.Name,
                            Description = item.Description
                        });
                    }

                    ViewState["etlsGrid"] = JSONSerializerExecute.Serialize(etlJobs);
                    gridEtl.InitialData   = etlJobs;

                    string msg       = ErrorMsg.Replace("\r\n", string.Empty);
                    string scriptStr = string.Format("alert('{0}');", msg);
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWindow", scriptStr, true);
                    //HttpContext.Current.Response.Write(scriptStr);
                }
                #endregion
            }
            //WebService任务
            else
            {
                #region

                JobScheduleCollection pvc = new JobScheduleCollection();
                //计划列表
                if (ch_IsAuto.Checked)
                {
                    //pvc = JSONSerializerExecute.Deserialize<JobScheduleCollection>(schedules.Value);
                    pvc = GetSchedules(schedules.Value);
                }

                if (this.Data != null)
                {
                    InvokeWebServiceJob job = InvokeWebServiceJobAdapter.Instance.Load(w => w.AppendItem("Job_id", this.Data.JobID)).FirstOrDefault();// this.Data as InvokeWebServiceJob;
                    job.Category         = txt_jobCategory.Text;
                    job.Enabled          = ddl_Enabled.SelectedValue == "1" ? true : false;
                    job.JobType          = JobType.InvokeService;
                    job.Description      = txt_JobDescription.Text;
                    job.Name             = txt_JobName.Text;
                    job.Schedules        = pvc;
                    job.ISManual         = !ch_IsAuto.Checked;
                    job.SvcOperationDefs = JSONSerializerExecute.Deserialize <WfServiceOperationDefinitionCollection>(this.services.Value);
                    //入库
                    DoUpdate(job);
                }
                else
                {
                    InvokeWebServiceJob job = new InvokeWebServiceJob()
                    {
                        JobID            = Guid.NewGuid().ToString(),
                        Category         = txt_jobCategory.Text,
                        Enabled          = ddl_Enabled.SelectedValue == "1" ? true : false,
                        JobType          = JobType.InvokeService,
                        Description      = txt_JobDescription.Text,
                        Name             = txt_JobName.Text,
                        Schedules        = pvc,
                        ISManual         = !ch_IsAuto.Checked,
                        SvcOperationDefs = JSONSerializerExecute.Deserialize <WfServiceOperationDefinitionCollection>(this.services.Value)
                    };

                    this.Data = job;

                    //入库
                    DoUpdate(job);
                }
                if (string.IsNullOrEmpty(ErrorMsg))
                {
                    HttpContext.Current.Response.Write("<script>window.returnValue=true;window.close();</script>");
                    //this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWindow", "window.returnValue=true;window.close()", true);
                }
                else
                {
                    //ViewState["conditions"] = conditions.Value;
                    ViewState["schedules"] = schedules.Value;
                    conditions.Value       = JSONSerializerExecute.Serialize((this.Data as ETLJob).ETLWhereConditions);

                    ViewState["etlEntities"] = etlEntities.Value;


                    //计划列表
                    List <ScheduleGridObj> scheduleList = new List <ScheduleGridObj>();
                    foreach (JobSchedule item in this.Data.Schedules)
                    {
                        scheduleList.Add(new ScheduleGridObj()
                        {
                            ID          = item.ID,
                            Name        = item.Name,
                            Description = item.Description
                        });
                    }
                    ViewState["schedulesGrid"] = JSONSerializerExecute.Serialize(scheduleList);;
                    grid.InitialData           = scheduleList;

                    //etl实体列表
                    List <EtlGridObj> etlJobs = new List <EtlGridObj>();
                    foreach (ETLEntity item in (this.Data as ETLJob).ETLEntities)
                    {
                        etlJobs.Add(new EtlGridObj()
                        {
                            ID          = item.ID,
                            CodeName    = item.Name,
                            Description = item.Description
                        });
                    }

                    ViewState["etlsGrid"] = JSONSerializerExecute.Serialize(etlJobs);
                    gridEtl.InitialData   = etlJobs;

                    string msg       = ErrorMsg.Replace("\r\n", string.Empty);
                    string scriptStr = string.Format("alert('{0}');", msg);
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWindow", scriptStr, true);
                }
                #endregion
            }
        }
示例#28
0
        private void execSendErrMsg(string sErrMsg)
        {
            TxtMsg txtMsg = new TxtMsg()
            {
                MsgType   = CmdParam.MsgType.UCS2手机短信,
                OrderCode = CmdParam.OrderCode.调度,
                strMsg    = sErrMsg
            };

            Record.execFileRecord("发送故障报警", sErrMsg);
            string[] strArrays = ReadDataFromXml.Linkman.Split(new char[] { ',' });
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                if (!string.IsNullOrEmpty(str))
                {
                    this.myDownData.icar_SendTxtMsg(CmdParam.ParamType.SimNum, str, "", CmdParam.CommMode.短信, txtMsg, 0, "故障检测通知");
                }
            }
            MailMessage mailMessage = new MailMessage();

            if (string.IsNullOrEmpty(ReadDataFromXml.sLinkmanMailTo))
            {
                return;
            }
            string[] strArrays1 = ReadDataFromXml.sLinkmanMailTo.Split(new char[] { ';' });
            for (int j = 0; j < (int)strArrays1.Length; j++)
            {
                string str1 = strArrays1[j];
                if (!string.IsNullOrEmpty(str1))
                {
                    string[] strArrays2 = str1.Split(new char[] { '(' });
                    if ((int)strArrays2.Length == 2)
                    {
                        MailAddressCollection to = mailMessage.To;
                        string str2     = strArrays2[1];
                        char[] chrArray = new char[] { ')' };
                        ((Collection <MailAddress>)to).Add(new MailAddress(str2.Trim(chrArray), strArrays2[0]));
                    }
                    else if ((int)strArrays2.Length == 1)
                    {
                        mailMessage.To.Add(strArrays2[0]);
                    }
                }
            }
            string[] strArrays3 = ReadDataFromXml.sLinkmanMailCC.Split(new char[] { ';' });
            for (int k = 0; k < (int)strArrays3.Length; k++)
            {
                string str3 = strArrays3[k];
                if (!string.IsNullOrEmpty(str3))
                {
                    string[] strArrays4 = str3.Split(new char[] { '(' });
                    if ((int)strArrays4.Length == 2)
                    {
                        MailAddressCollection cC = mailMessage.CC;
                        string str4      = strArrays4[1];
                        char[] chrArray1 = new char[] { ')' };
                        ((Collection <MailAddress>)cC).Add(new MailAddress(str4.Trim(chrArray1), strArrays4[0]));
                    }
                    else if ((int)strArrays4.Length == 1)
                    {
                        mailMessage.CC.Add(strArrays4[0]);
                    }
                }
            }
            mailMessage.From    = new MailAddress("*****@*****.**", "车务通检测平台", Encoding.Default);
            mailMessage.Subject = "故障检测通知";
            DateTime now = DateTime.Now;

            mailMessage.Body            = string.Format("时间:{0}\r\n{1}", now.ToString("yyyy-MM-dd HH:mm:ss"), sErrMsg);
            mailMessage.SubjectEncoding = Encoding.GetEncoding(936);
            mailMessage.BodyEncoding    = Encoding.GetEncoding(936);
            SmtpClient smtpClient = new SmtpClient("mail.star-net.cn")
            {
                Credentials = new NetworkCredential("*****@*****.**", "zb1234")
            };

            try
            {
                smtpClient.UseDefaultCredentials = false;
                smtpClient.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtpClient.Send(mailMessage);
                (new LogHelper()).WriteText("故障邮件发送成功");
            }
            catch (Exception exception)
            {
                ErrorMsg errorMsg = new ErrorMsg("故障检测通知", "发送故障邮件", exception.Message)
                {
                    ClassName = "execSendErrMsg"
                };
                (new LogHelper()).WriteError(errorMsg);
            }
        }
示例#29
0
文件: Parser.cs 项目: TomLievense/FTM
    static void Parse(string command, string[] options, string[] args)
    {
        switch (command)
        {
        case "ls":
            Command.GetList(options, args);
            break;

        case "tree":
            Command.Tree(options, args);
            break;

        case "help":
            Command.Help(options, args);
            break;

        case "config":
            Command.Config(options, args);
            break;

        case "pull":
            Command.Pull(options, args, false);
            break;

        case "push":
            Command.Push(options, args, false);
            break;

        case "checkin":
            Command.Push(options, args, true);
            break;

        case "checkout":
            Command.Pull(options, args, true);
            break;

        case "status":
            Command.GetStatus(options, args);
            break;

        case "log":
            Command.GetLog(options, args);
            break;

        case "rm":
            Command.Delete(options, args);
            break;

        case "find":
            Command.Find(options, args);
            break;

        case "scan":
            Command.Scan(options, args);
            break;

        case "create":
            Command.Create(options, args);
            break;

        case "show":
            Command.Show(options, args);
            break;

        case "count":
            Command.Count(options, args);
            break;

        case "clear":
            Command.Clear(options, args);
            break;

        case "diff":
            Command.Diff(options, args);
            break;

        case "baseline":
            Command.Baseline(options, args);
            break;

        case "init":
            Command.Init(options, args);
            break;

        case "clone":
            Command.Clone(options, args);
            break;

        case "exit":
            Environment.Exit(0);
            break;

        default:
            ErrorMsg.UnknownCommand();
            break;
        }
    }
示例#30
0
 /// <summary>
 /// Validate dữ liệu
 /// </summary>
 /// <param name="entity">Dữ liệu truyền vào</param>
 /// <param name="errorMsg">Câu thông báo</param>
 /// <returns>true - validate đúng, false - validate sai</returns>
 /// CreatedBy: BDHIEU (09/02/2021)
 protected virtual bool ValidateData(T entity, ErrorMsg errorMsg = null)
 {
     return(true);
 }
示例#31
0
文件: Parser.cs 项目: TomLievense/FTM
    public static void Tokenize(string input)
    {
        string command = null;

        List <string> args    = new List <string>();
        List <string> options = new List <string>();

        char[] token    = input.ToCharArray();
        string word     = null;
        bool   isQuoted = false;

        void DetermineType()
        {
            if (word == null || word.Length < 1)
            {
                return;
            }

            if (command == null)
            {
                command = word;
            }
            else if (word.Substring(0, 1) == "-")
            {
                // Check if options are combined:
                // Options can also be integers with more than one digit.
                // Example: pull -10 myproject. Without applying the TryParse method,
                // the value -10 will be split into -1 and -0.
                if (word.Length > 2 && word.Substring(0, 2) != "--" &&
                    !int.TryParse(word, out int tryResult))
                {
                    char[] split = word.ToCharArray();

                    for (int i = 1; i < split.Length; i++)
                    {
                        string newOption = "-" + split[i];
                        options.Add(newOption);
                    }
                }
                else
                {
                    options.Add(word);
                }
            }
            else
            {
                args.Add(word);
            }
            word = null;
        }

        for (int i = 0; i < token.Length; i++)
        {
            if ((token[i] == ' ' || token[i] == '\t') && !isQuoted)
            {
                DetermineType();
                continue;
            }

            if (token[i] == '"')
            {
                isQuoted = !isQuoted;
            }
            else
            {
                word += token[i];
            }
        }

        // Word can be null if input contains a space/tab at the end or
        // a double space/tab between the words.
        if (word != null)
        {
            DetermineType();
        }

        if (isQuoted) // Check if there is also a closing tag.
        {
            ErrorMsg.QuotationMarkMissing();
            return;
        }
        Parse(command, options.ToArray(), args.ToArray());
    }
示例#32
0
 private void InsertAlarmInfo(DataRow dr, CmdParam.CarAlarmState carAlarmState, int regionID)
 {
     try
     {
         int    num   = 0;
         string empty = string.Empty;
         int    num1  = 1;
         long   num2  = 4503599627370496L;
         int    num3  = 1154;
         int    num4  = 65;
         string str   = string.Empty;
         string str1  = dr["AddMsgTxt"].ToString();
         string str2  = null;
         bool   flag  = false;
         string str3  = null;
         int    num5  = 0;
         try
         {
             SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num4), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num1), new SqlParameter("@carStatuEx", (object)num2), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num3), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", dr["AddMsgType"]), new SqlParameter("@addTxt", str1), new SqlParameter("@DutyStr", str2), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str3), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) };
             string         str4         = "GpsPicServer_Alarm_Insert";
             string         str5         = "GpsPicServer_RealTime_Insert";
             int            num6         = SqlDataAccess.insertBySp(str4, sqlParameter);
             if (num6 > 0)
             {
                 LogMsg   logMsg   = new LogMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", "");
                 object[] objArray = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecebuffer,区域ID:", regionID };
                 logMsg.Msg = string.Concat(objArray);
                 this.logHelper.WriteLog(logMsg);
             }
             else
             {
                 object[] objArray1 = new object[] { "将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecbuffer表错误,返回值!", num6.ToString(), ",区域ID:", regionID };
                 ErrorMsg errorMsg  = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray1));
                 this.logHelper.WriteError(errorMsg);
             }
             int num7 = SqlDataAccess.insertBySp(str5, sqlParameter);
             if (num7 > 0)
             {
                 string[] strArrays = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime" };
                 LogMsg   logMsg1   = new LogMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(strArrays));
                 object[] objArray2 = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime,区域ID:", regionID };
                 logMsg1.Msg = string.Concat(objArray2);
                 this.logHelper.WriteLog(logMsg1);
             }
             else
             {
                 object[] objArray3 = new object[] { "将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num7.ToString(), ",区域ID:", regionID };
                 ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray3));
                 this.logHelper.WriteError(errorMsg1);
             }
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             object[]  objArray4 = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), ",区域ID:", regionID, "报警报文插入数据库发生错误! 信息:", exception.Message };
             ErrorMsg  errorMsg2 = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray4));
             this.logHelper.WriteError(errorMsg2);
         }
     }
     catch (Exception exception3)
     {
         Exception exception2 = exception3;
         LogHelper logHelper  = new LogHelper();
         object[]  objArray5  = new object[] { "将平台检测", carAlarmState.ToString(), ",区域ID:", regionID, "报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message };
         ErrorMsg  errorMsg3  = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray5));
         logHelper.WriteError(errorMsg3);
     }
 }
示例#33
0
 public override void onInitFailed(ErrorMsg message)
 {
 }
示例#34
0
 public EditorData(ErrorMsg msgDelegate)
 {
     this.CallErrorMsg = msgDelegate;
 }
示例#35
0
 public override void onLoginFailed(ErrorMsg errMsg)
 {
     Login();
 }