ToString() public method

public ToString ( ) : string
return string
Esempio n. 1
1
        public DbScriptControl(Event_dataset_script Data, Int32 ID, uint id)
        {
            InitializeComponent();

            this.Name = ID.ToString();
            eventid = ID;
            script_id = id;
            this.eventCheckbox.Text = "Event: " + ID.ToString();

            this.eventCheckbox.Checked = true;

            for (int n = 0; n < Info.ScriptCommands.GetLength(0); n++)
                this.comboBoxAction.Items.Add(Info.ScriptCommands[n, 0]);

            // set width
            comboBoxAction.DropDownWidth = DropDownWidth(comboBoxAction);
            comboBoxAction.DropDownStyle = ComboBoxStyle.DropDownList;

            this.comboBoxAction.SelectedIndex = Data.command;
            this.textBoxDelay.Text = Data.delay.ToString();

            this.textBox_datalong.Text = Data.datalong.ToString();
            this.textBox_datalong2.Text = Data.datalong2.ToString();

            this.textBox_buddy.Text = Data.buddy.ToString();
            this.textBox_radius.Text = Data.radius.ToString();
            this.textBox_flags.Text = Data.dataflags.ToString();

            this.textBox_dataint1.Text = Data.dataint.ToString();
            this.textBox_dataint2.Text = Data.dataint2.ToString();
            this.textBox_dataint3.Text = Data.dataint3.ToString();
            this.textBox_dataint4.Text = Data.dataint4.ToString();

            this.textBox_posX.Text = Data.position_x.ToString();
            this.textBox_posY.Text = Data.position_y.ToString();
            this.textBox_posZ.Text = Data.position_z.ToString();
            this.textBox_orientation.Text = Data.orientation.ToString();

            this.commentTextbox.Text = Data.comment;

            //switch (comboBoxAction.SelectedIndex)
            //{
            //    case 0:     // talk
            //        textBox_dataint1.ReadOnly = false;
            //        textBox_dataint2.ReadOnly = false;
            //        textBox_dataint3.ReadOnly = false;
            //        textBox_dataint4.ReadOnly = false;
            //        break;
            //    case 3:     // move
            //    case 6:     // teleport
            //    case 10:    // summon
            //        textBox_posX.ReadOnly = false;
            //        textBox_posY.ReadOnly = false;
            //        textBox_posZ.ReadOnly = false;
            //        textBox_orientation.ReadOnly = false;
            //        break;
            //}

            locked = false;
        }
Esempio n. 2
1
        public static INode AddNode(this IGraph myIGraph, Int32 myInt32Id)
        {
            if (myIGraph == null)
                throw new ArgumentNullException("myIGraph must not be null!");

            return myIGraph.AddNode(myInt32Id.ToString());
        }
Esempio n. 3
0
        public ConsoleField(Int32 x, Int32 y, Int32 width, Int32 height, String name)
        {
            if(x < 0)
                throw new ArgumentOutOfRangeException("x", "x may not be less than zero. Given " + x.ToString() + ".");
            if(y < 0)
                throw new ArgumentOutOfRangeException("y", "y may not be less than zero. Given " + y.ToString() + ".");
            if(width < 0)
                throw new ArgumentOutOfRangeException("width", "width may not be less than zero. Given " + width.ToString() + ".");
            if(height < 0)
                throw new ArgumentOutOfRangeException("height", "height may not be less than zero. Given " + height.ToString() + ".");
            if(name == null)
                throw new ArgumentNullException("p_name");
            if((x + width - 1) > Console.WindowWidth)
                throw new ArgumentOutOfRangeException("The console field may not exceed the boundaries of the console window. Console Window is " + Console.WindowWidth + " wide, x=" + x.ToString() + ",width=" + width.ToString());
            if ((y + height - 1) > Console.WindowHeight)
                throw new ArgumentOutOfRangeException("The console field may not exceed the boundaries of the console window. Console Window is " + Console.WindowHeight + " high, y=" + y.ToString() + ",height=" + height.ToString());

            X = x;
            Y = y;
            Width = width;
            Height = height;
            Name = name;

            ConsoleFieldManager.AddField(this);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Whitfield_Project _wc = new Whitfield_Project();
     if (!Page.IsPostBack)
     {
         BindCompetition();
         // 1 Get collection
         NameValueCollection n = Request.QueryString;
         // 2 See if any query string exists
         if (n.HasKeys())
         {
             // 3 Get first key and value
             string k = n.GetKey(0);
             string v = n.Get(0);
             string v1 = n.Get(1);
             // 4
             // Test different keys
             EstNum = Convert.ToInt32(v);
             twc_project_number = Convert.ToInt32(v1);
             hidEstNum.Value = EstNum.ToString();
             hidtwcProjNumber.Value = twc_project_number.ToString();
             ViewState["EstNum"] = EstNum.ToString();
             ViewState["twc_project_number"] = twc_project_number.ToString();
         }
     }
 }
Esempio n. 5
0
File: User.cs Progetto: nikkw/W2C
        public static String GetHashID(Int32 usrId)
        {
            return usrId.ToString();

            if(String.IsNullOrEmpty(UserHash))
            {
                UserHash = Util.Crypto.Encrypt(usrId.ToString());
            }

            return UserHash;
        }
 protected void AddRowTotal(Int32 intRowTotal, string strStatusID)
 {
     if (intRowTotal > 0)
     {
         sbHTML.Append("<td style='border-left-style: solid; border-left-width: 2px; border-left-color: #999999' align='center' class='" + strClassName + "' width='30px'><a href='CP_ReportResults.aspx?RID=" + strReportID + "&V1=8,9,10,11,12&V2=" + strStatusID + "&V3=" + Server.UrlEncode(strAdminCriteria) + "'>" + intRowTotal.ToString() + "</a></td>");
     }
     else
     {
         sbHTML.Append("<td style='border-left-style: solid; border-left-width: 2px; border-left-color: #999999' align='center' class='" + strClassName + "' width='30px'>" + intRowTotal.ToString() + "</td>");
     }
 }
 protected void AddGrade(Int32 intCount, string strStatusID, string strGrade, string strClassName)
 {
     if (intCount > 0)
     {
         sbHTML.Append("<td align='center' class='" + strClassName + "' width='30px'><a href='CP_ReportResults.aspx?RID=" + strReportID + "&V1=" + strGrade + "&V2=" + strStatusID + "&V3=" + Server.UrlEncode(strAdminCriteria) + "'>" + intCount.ToString() + "</a></td>");
     }
     else
     {
         sbHTML.Append("<td align='center' class='" + strClassName + "' width='30px'>" + intCount.ToString() + "</td>");
     }
     if (strStatusID == "1" & strGrade == "12") strGrade12Incomplete = intCount.ToString();
 }
 public void FetchSubMaterials(Int32 EstNum, String work_order_id,DataSet dsrec)
 {
     ViewState["EstNum"] = EstNum.ToString();
     ViewState["WorkOrderID"] = WorkOrderID.ToString();
     hdnEstNum.Value = EstNum.ToString();
     hdnworkorderNumber.Value = work_order_id.ToString();
     BindSubMaterials();
     if (dsrec.Tables[0].Rows.Count > 0)
     {
         grdpl1.DataSource = dsrec;
         grdpl1.DataBind();
     }
 }
 public PageScheme GetScheme(String key, Int32 adminIdx)
 {
     PageLogger.RecordDebugLog("get page schema " + key + "||" + adminIdx.ToString());
     var result =  m_DAL.SelectScheme(key, adminIdx);
     if (result == null)
     {
         result = m_DAL.SelectDefaultScheme(adminIdx);
     }
     if (result != null)
     {
         PageLogger.RecordDebugLog("get page schema " + result.Key + "||" + adminIdx.ToString());
     }
     return result;
 }
Esempio n. 10
0
        public static bool InsertCrawlerMonitorInfo(SqlHelper dbHelper, string xIpAddress, Int32 xPort, ref Int32 MonitorSeq)
        {
            MonitorSeq = 0;

            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xIpAddress", xIpAddress);
                argdic.Add("xPort", xPort.ToString());

                MySqlDataReader datareader = dbHelper.call_proc("spNewInsertCrawlerMonitor", argdic);
                while (datareader.Read())
                {
                    MonitorSeq = Convert.ToInt32(datareader["MonitorSeq"]);
                    break;
                }

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                return false;
            }

            if (MonitorSeq == 0)
                return false;

            return true;
        }
Esempio n. 11
0
        /// <summary>
        /// 删除指定ID的题目类型种类
        /// </summary>
        /// <param name="id">题目类型种类ID</param>
        /// <returns>是否成功删除</returns>
        public static IMethodResult AdminDeleteProblemCategory(Int32 id)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (id <= 0)
            {
                return MethodResult.InvalidRequest(RequestType.ProblemCategory);
            }

            if (ProblemCategoryItemRepository.Instance.CountEntities(id) > 0)
            {
                return MethodResult.FailedAndLog("This category still has some problems, please remove these problem from this category first!");
            }

            Boolean success = ProblemCategoryRepository.Instance.DeleteEntity(id) > 0;

            if (!success)
            {
                return MethodResult.FailedAndLog("No problem category was deleted!");
            }

            ProblemCategoryCache.RemoveProblemCategoryListCache();//删除缓存

            return MethodResult.SuccessAndLog("Admin delete problem category, id = {0}", id.ToString());
        }
Esempio n. 12
0
 /// <summary>
 /// Конструктор, который задает
 /// местоположение узла и его 
 /// графическое отображение
 /// </summary>
 /// <param name="location">Местоположение</param>
 /// <param name="image">Изображение</param>
 public Node(Point location, Bitmap image)
 {
     Location = location;
     _image = image;
     _id = Const.GetNodeId();
     Docket = _id.ToString();
 }
Esempio n. 13
0
        public void ProcessTagReadEvent(object sender, TagReadEventArgs e)
        {
            //The TagReadEventsArgs includes a ThinkifyTag as an element. (See: ThinkifyReader.cs)
            //ThinkifyTag tag;
            //tag = e.tag;

            readCount += 1;

            // Look! We've taken an object oriented language and made it -- not!
            SetText(lblNumReads, readCount.ToString());

            string strTaglist;

            strTaglist = "";

            if (chkReading.Checked)
            {
                foreach (ThinkifyTag T in Reader.TagList)
                {
                    strTaglist = strTaglist + T.EPC + " " + T.ReadCount.ToString() + "\r\n";
                }

                SetText(txtReplys, strTaglist);
            }
        }
		void CreateUsrFromEmailAndReturnKSuccessCallback(Int32 result, object userContext, string methodName)
		{
			KeyStringPair pair = (KeyStringPair)userContext;
			pair.Value = result.ToString();
			this.selector.Value = pair.Value;
			if (oldItemChosen != null) { oldItemChosen(pair); }
		}
Esempio n. 15
0
        public static bool InsertCrawlerRestartLog(SqlHelper dbHelper, string xlogMessage, Int32 xCrawlerSeq, Int32 xCrawlerMonitorSeq
            , Int32 xChannelSeq, Int32 xAuthoritySeq, string xIssueDate)
        {
            try
            {
                Dictionary<string, object> argdic = new Dictionary<string, object>();
                argdic.Add("xlogMessage", xlogMessage);
                argdic.Add("xCrawlerSeq", xCrawlerSeq.ToString());
                argdic.Add("xCrawlerMonitorSeq", xCrawlerMonitorSeq.ToString());
                argdic.Add("xChannelSeq", xChannelSeq.ToString());
                argdic.Add("xAuthoritySeq", xAuthoritySeq.ToString());
                argdic.Add("xIssueDate", xIssueDate);

                MySqlDataReader datareader = dbHelper.call_proc("spNewCrawlerInsertLog", argdic);

                datareader.Close();
                datareader.Dispose();
                datareader = null;
            }
            catch (System.Exception ex)
            {
                return false;
            }

            return true;
        }
Esempio n. 16
0
 /// <summary>
 /// 将Unix时间戳 转换成 DateTime时间
 /// </summary>
 /// <param name="unix">Unix时间戳</param>
 /// <returns></returns>
 public DateTime ToDateTime(Int32 unix)
 {
     DateTime time = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
     Int64 unixNumber = Convert.ToInt64((unix.ToString() + "0000000"));
     TimeSpan toNow = new TimeSpan(unixNumber);
     return time.Add(toNow);
 }
Esempio n. 17
0
        /* Constructors */
        public FormStatistic(Int32 totalJobs, Int32 completedJobs, Int32 expiredJobs)
        {
            InitializeComponent();
            Icon = Resources.Statistic_Icon_16;

            // Calculations
            activeJobs = totalJobs - completedJobs - expiredJobs;

            if (totalJobs == 0)
            {
                jobCompletedSize = 360;
                jobRemainingSize = jobExpiredSize = 0;
                jobsEfficiency = 100;
            }
            else
            {
                jobCompletedSize = 360 * completedJobs / totalJobs;
                jobRemainingSize = 360 * activeJobs / totalJobs;
                jobExpiredSize =  360 - jobRemainingSize - jobCompletedSize;
                jobsEfficiency = 100 * completedJobs / totalJobs;
            }

            // Fill data
            lTotalJobs.Text = totalJobs.ToString();
            lActiveJobs.Text = activeJobs.ToString();
            lCompletedJobs.Text = completedJobs.ToString();
            lExpiredJobs.Text = expiredJobs.ToString();
            lEfficiency.Text = jobsEfficiency.ToString() + "%";
        }
Esempio n. 18
0
 public static String check(Int32 num)
 {
     String tmp;
     switch (num)
     {
         case 10:
             tmp = "A";
             break;
         case 11:
             tmp = "B";
             break;
         case 12:
             tmp = "C";
             break;
         case 13:
             tmp = "D";
             break;
         case 14:
             tmp = "E";
             break;
         case 15:
             tmp = "F";
             break;
         default:
             tmp = num.ToString();
             break;
     }
     return tmp;
 }
Esempio n. 19
0
        public static void Configure(ref Int32 intervalStart, ref Int32 intervalEnd, ref String returnType, ref String actualCode)
        {
            ConfigurationForm form = new ConfigurationForm();

            form.edtEndInt.Text = intervalEnd.ToString();
            form.edtStartInt.Text = intervalStart.ToString();
            form.edtCode.Text = actualCode;

            if (returnType.Equals("Int32"))
                form.cbbReturnType.SelectedIndex = 0;
            else if (returnType.Equals("Double"))
                form.cbbReturnType.SelectedIndex = 1;
            else
                form.cbbReturnType.SelectedIndex = 2;

            form.ControlUIChanges();

            if (form.ShowDialog() == DialogResult.OK)
            {
                intervalEnd = Convert.ToInt32(form.edtEndInt.Text);
                intervalStart = Convert.ToInt32(form.edtStartInt.Text);
                actualCode = form.edtCode.Text;
                returnType = form.cbbReturnType.Text;
            }
        }
Esempio n. 20
0
        public Schedule AddSchedule(int channelId,string title, DateTime start, DateTime end, Int32 ScheduleType)
        {
            Log.Debug("TvBusinessLayer:  GetSetting(int channelId=" + channelId.ToString() + "string title="+title+",DateTime start=" + start.ToString() + ", DateTime end=" + end.ToString() + ",int ScheduleType=" + ScheduleType.ToString());

            Schedule schedule = new Schedule();
            schedule.IdChannel = channelId;
            schedule.ProgramName = title;
            schedule.StartTime = start;
            schedule.EndTime = end;
            schedule.ScheduleType = ScheduleType;

            //retrieve schedule ID from listall!!
            foreach (Schedule myschedule in Schedule.ListAll())
            {
                if ((myschedule.IdChannel == schedule.IdChannel) && (myschedule.ProgramName == schedule.ProgramName) && (myschedule.StartTime == schedule.StartTime) && (myschedule.EndTime == schedule.EndTime) && (myschedule.ScheduleType == schedule.ScheduleType))
                {
                    schedule.Id = myschedule.Id;

                    schedule.PreRecordInterval = myschedule.PreRecordInterval;
                    schedule.PostRecordInterval = myschedule.PostRecordInterval;
                    schedule.MaxAirings = myschedule.MaxAirings;
                    schedule.KeepDate = myschedule.KeepDate;
                    schedule.KeepMethod = myschedule.KeepMethod;
                    schedule.Priority = myschedule.Priority;
                    schedule.RecommendedCard = myschedule.RecommendedCard;
                    schedule.Series = myschedule.Series;
                    break;
                }
            }
            schedule.Persist();

            return schedule;
        }
        public DataSet RetornarAtendimentos(string str_Unidade, string UltimoRegistro, Int32 NumeroLinhas)
        {
            DataSet Ds;

            StringBuilder sbSQL = new System.Text.StringBuilder();

            sbSQL.Length = 0;

            if (NumeroLinhas == 0)
            {
                NumeroLinhas = 1000;
            }

            sbSQL.Append(" SELECT ");
            sbSQL.Append("    cod_pac, cod_prt, tip_atend, data_ent, hora_ent, data_alta, hora_alta, cod_pro, cod_esp, leito ");
            sbSQL.Append(" FROM #0.atendimento  ");
            //sbSQL.Append(" WHERE cdund = '#1' AND cod_pac>'#2' ");
            sbSQL.Append(" WHERE cdund = '#1' AND cod_pac NOT IN (SELECT TRIM(SUBSTR(CLATND,10,10)) FROM #4.TBDWD018 WHERE SUBSTR(CLATND,1,3) = '#1') ");
            sbSQL.Append(" AND ");
            sbSQL.Append(" ROWNUM <= #3 ");
            sbSQL.Append(" ORDER BY cod_pac ");

            sbSQL.Replace("#0", strScheSAT);
            sbSQL.Replace("#1", str_Unidade);
            //sbSQL.Replace("#2", UltimoRegistro);
            sbSQL.Replace("#3", NumeroLinhas.ToString().Trim());
            sbSQL.Replace("#4", strScheINT);

            Ds = m_oRP.RetornarDataSet(sbSQL.ToString(), "ATENDIMENTO", strConnSAT);

            return Ds;
        }
Esempio n. 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Whitfieldcore _wc = new Whitfieldcore();
     if (!Page.IsPostBack)
     {
         // 1 Get collection
         NameValueCollection n = Request.QueryString;
         // 2 See if any query string exists
         if (n.HasKeys())
         {
             // 3 Get first key and value
             string k = n.GetKey(0);
             string v = n.Get(0);
             string v1 = n.Get(1);
             // 4
             // Test different keys
             Clientid = Convert.ToInt32(v);
             EstNum = Convert.ToInt32(v1);
             hidEstNum.Value = EstNum.ToString();
         }
         ViewState["EstNum"] = EstNum.ToString();
         ViewState["Clientid"] = Clientid.ToString();
         BindContacts(Clientid);
     }
 }
Esempio n. 23
0
 public static void CreateLogFile (Int32 iCountTestcases, Int32 iCountErrors)
 {
     FileStream fs = new FileStream("results.txt", FileMode.Create, FileAccess.Write);
     StreamWriter w = new StreamWriter(fs);
     w.WriteLine ("<Testcase>");
     if (iCountErrors > 0)
     {
         w.WriteLine ("	<FinalResults type=\"Fail\" total=\"{0}\" fail=\"{1}\"/>", iCountTestcases.ToString(), iCountErrors.ToString());
     }
     else
     {
         w.WriteLine ("\t<FinalResults type=\"Pass\" total=\"{0}\" fail=\"{1}\"/>", iCountTestcases.ToString(), iCountErrors.ToString());
     }
     w.WriteLine ("</Testcase>");
     w.Close();
 }
Esempio n. 24
0
    private void bb()
    {
        try
        {
         DataView dv = (DataView)(SqlDataSource2.Select(DataSourceSelectArguments.Empty));
         if (dv.Table.Rows.Count != 0)
         {
             Int32 ii;
             for (ii = 0; ii < dv.Table.Rows.Count; ii++)
             {
                 i = Convert.ToInt32(dv.Table.Rows[ii][1]);
             }
             i++;
             no.Text = i.ToString();
         }
         else
         {
             no.Text = "101".ToString();
         }
        }
        catch(Exception t)
        {

            no.Text = "101".ToString();
        }
    }
Esempio n. 25
0
        public static string StringPad(int digits, Int32 value, bool dp)
        {
            string resultVal = "";
            string result = "";
            if (dp)
            {
                float fVal = (float)value / 100;
                resultVal = fVal.ToString("F2");
                StringBuilder sb = new StringBuilder(resultVal);
                sb.Replace('.', ',');
                resultVal = sb.ToString();
            }
            else
            {
                resultVal = value.ToString();
            }

            if (resultVal.Length < digits)              // PadLleft
            {
                int pad = digits - resultVal.Length;
                for (int i = 0; i < pad; i++)
                {
                    result += " ";
                }
                return result + resultVal;
            }
            return resultVal;
        }
Esempio n. 26
0
        public void UpdateView(Int32 operand1, Int32 operand2, Int32 result)
        {
            Txt_Operand1.Text = operand1.ToString();
            Txt_Operand2.Text = operand2.ToString();

            Txt_Result.Text = result.ToString();
        }
Esempio n. 27
0
        public void Check(Int32 externGuess)
        {
            IGuessService clientCB = OperationContext.Current.GetCallbackChannel<IGuessService>();
            Player currentPlayer = _players[clientCB];
            Guess guess = new Guess(externGuess.ToString(), currentPlayer.Name);
            played.Add(guess);

            if (_randomInt == externGuess)
            {
                clientCB.GameOver(true, played);
                foreach (KeyValuePair<IGuessService, Player> copyied in _players)
                {
                    if (copyied.Key != clientCB)
                    {
                        copyied.Key.GameOver(false, played);
                    }
                }
            }
            else
            {
                if (externGuess < _randomInt){guess.Tipp = GuessTipp.ToLow;}
                else { guess.Tipp = GuessTipp.ToHigh; }

                foreach (KeyValuePair<IGuessService, Player> player in _players)
                {
                    player.Key.PlayerGuess(guess);
                }
            }
        }
Esempio n. 28
0
		/// <summary>
		/// 配信開始リクエストを行います。
		/// </summary>
		/// <param name="title">タイトル</param>
		/// <param name="apiKey">APIキー</param>
		/// <param name="description">配信詳細</param>
		/// <param name="tags">タグ</param>
		/// <param name="thumbnailSlot">サムネイルスロット</param>
		/// <param name="idVisible">ID表示の有無</param>
		/// <param name="anonymousOnly">ハンドルネーム制限</param>
		/// <param name="loginOnly">書き込み制限</param>
		/// <param name="testMode">テストモード</param>
		/// <param name="socketId">SocketIOの接続ID</param>
		/// <returns></returns>
		public static async Task<StartInfo> RequestStartBroadcastAsync(String title, String apiKey, String description, IEnumerable<String> tags, Int32 thumbnailSlot, Boolean idVisible, Boolean anonymousOnly, Boolean loginOnly, Boolean testMode, String socketId) {
			try {
				using (var client = WebClientUtil.CreateInstance()) {
					var data = new NameValueCollection {
						{"devkey", devkey},
						{"apikey", apiKey},
						{"title", title},
						{"description", description},
						{"tag", String.Join(" ", tags)},
						{"thumbnail_slot", thumbnailSlot.ToString()},
						{"id_visible", idVisible ? "true" : "false"},
						{"anonymous_only", anonymousOnly ? "true" : "false"},
						{"login_only", loginOnly ? "true" : "false"},
						{"test_mode", testMode ? "true" : "false"},
						{"socket_id", socketId},
					};

					var response = await client.UploadValuesTaskAsync($"{webUrl}/api/start", "POST", data);
					var jsonString = Encoding.UTF8.GetString(response);

					dynamic json = JObject.Parse(jsonString);
					if (json.stream_name == null) {
						return null;
					}

					return new StartInfo(json);
				}
			} catch (WebException) {
				return null;
			}
		}
 public void LoadDisplay(string FriendInvitationKey, Int32 AccountID, string AccountFirstName, string AccountLastName, string SiteName)
 {
     lblFullName.Text = AccountFirstName + " " + AccountLastName;
     lblSiteName1.Text = SiteName;
     lblSiteName2.Text = SiteName;
     imgProfileAvatar.ImageUrl = "~/images/ProfileAvatar/ProfileImage.aspx?AccountID=" + AccountID.ToString();
 }
Esempio n. 30
0
        public IPEndPoint GetValidHost()
        {
            IPEndPoint hostEndPoint = null;
            
            string host = "";
            Int32 portOnHost = -1;

            host = GetHostString();
            portOnHost = GetHostPortInteger();
            if (this.theWay == "N")
            {
                hostEndPoint = GetServerEndpointUsingMachineName(host, portOnHost);
            }
            else
            {
                hostEndPoint = GetServerEndpointUsingIpAddress(host, portOnHost);
            }
            
            TestConnection(hostEndPoint);
            this.host = host;
            this.portOnHost = portOnHost;
            this.portString = portOnHost.ToString();

            
            return hostEndPoint;
        }
Esempio n. 31
0
    private static GameObject entry_loadEntry(EntityView objev)
    {
        ENTITY_ID id = objev.ID;

        //已经被卸载了.
        if (EntityFactory.Instance.m_entityContainer.Get(id) == null)
        {
            return(null);
        }
        EntityViewItem evItem = objev.createinfo;

        ENTITY_TYPE entityType = (ENTITY_TYPE)evItem.EntityType;

        UnityEngine.Object objPrefab = PrefabManager.GetPrefab(entityType);
        if (null == objPrefab)
        {
            Trace.LogError("找不到对应的类型的prefab,请检查PrefabManager中的Init函数,是否忘记加载? " + entityType.ToString());
            return(null);
        }
        GameObject entity = null;

        entity = objPrefab as GameObject;

        if (entity == null)
        {
            Trace.LogError("实例预设体对象失败! " + entityType.ToString());
            return(null);
        }

        entity.name += "-" + id.ToString();
        if (entity.transform.childCount > 0)
        {
            Trace.LogWarning("EntityView GameObject 有子节点!" + entity.transform.GetChild(0).name);
        }

        // 设置游戏对象
        objev.SetGameObject(entity);

        // 设置创建数据
        if (!objev.InitBuildeData(evItem))
        {
            Trace.LogError("初始化实体对象数据失败! id=" + id.ToString());
            return(null);
        }


        //如果是队友,则加入队友列表,
        if (objev.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE && objev.CampFlag == CampFlag.CampFlag_Friend)
        {
            if (!m_friendPlayerList.Contains((uint)objev.ID))
            {
                m_friendPlayerList.Add((uint)objev.ID);
            }
        }

        //string entityname = "UnKnow";
        //Skin sk = SkinManager.GetSkin(objev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN));
        //if (sk != null)
        //{
        //    entityname = sk.ResSkinObj.AssetName;
        //}
        //entity.name = entityname;
        //entity.name += "(entity" + evItem.EntityID.ToString() + ")";

        if (id == MainHeroID)
        {
            entity.transform.parent = null;
            MainHeroView            = objev;

            if (CreateMainHeroEntityEvent != null)
            {
                CreateMainHeroEntityEventArgs e = new CreateMainHeroEntityEventArgs();
                e.MainHeroID   = evItem.nHeroID;
                e.MainHeroUID  = MainHeroID;
                e.nMatchTypeID = GameLogicAPI.getCurRoomMatchType();
                CreateMainHeroEntityEvent(e);
                LogicDataCenter.playerSystemDataManager.Reset();
            }

            ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_MASTER_VIEW_LOADED);
            Trace.Log("Load Hero Entry:" + entity.name);
        }
        else
        {
            entity.transform.parent = Instance.transform;
        }

        objPrefab = null;
        if (ENTITY_TYPE.TYPE_PLAYER_ROLE == entityType)
        {
            // 发送人物加载完指令到逻辑层
            EntityEventHelper.Instance.SendCommand(id, EntityLogicDef.ENTITY_CMD_LOAD_COMPLETED);
        }

        BaseStateMachine bs = entity.GetComponent <BaseStateMachine>();

        //已经有位置信息,创建模型时立即同步瞬移过去,之后的同步消息是走过去
        if (objev.data.nActorID == evItem.EntityID)
        {
            Vector3 pos;
            pos.x = objev.data.fPosition_x;
            pos.y = objev.data.fPosition_y;
            pos.z = objev.data.fPosition_z;

            Vector3 rot;
            rot.x = objev.data.fRotation_x;
            rot.y = objev.data.fRotation_y;
            rot.z = objev.data.fRotation_z;

            //怪物要走传送,不能直接设置位置
            if (entityType == ENTITY_TYPE.TYPE_MONSTER)
            {
                if (bs)
                {
                    cmd_creature_transport data = new cmd_creature_transport();
                    data.fPosition_x = pos.x;
                    data.fPosition_y = pos.y;
                    data.fPosition_z = pos.z;

                    data.fRotation_x = rot.x;
                    data.fRotation_y = rot.y;
                    data.fRotation_z = rot.z;

                    data.bUseAngle = 1;
                    bs.Transport(data);
                }
            }
            else
            {
                entity.transform.SetPosition(pos);
                entity.transform.eulerAngles = rot;
            }
        }

        CheckEntityMaskToRangeSearch(objev);
        //执行延迟处理的消息
        EntityViewCommandHandler.onCommandsDelay(objev);
        return(entity);
    }
        public Employee GetEmployee(System.Int32 id)
        {
            Employee employee = OnGetItem <Employee>(id.ToString());

            return(employee);
        }
Esempio n. 33
0
        /// <summary>
        /// Convert the incoming string into an XML format by replacing some characters by their
        /// XML coding.
        /// </summary>
        /// <param name="inString">String to be converted.</param>
        /// <param name="displaySpaces">Display spaces correctly for attribute values.</param>
        /// <returns>Converted string.</returns>
        public static System.String ConvertString(System.String inString, bool displaySpaces)
        {
            // convert character values so that they can be displayed in XML
            StringBuilder outString = new StringBuilder();

            if ((inString != null) &&
                (inString != System.String.Empty))
            {
                for (int i = 0; i < inString.Length; i++)
                {
                    System.String valueString = String.Empty;
                    System.Int32  charValue   = Convert.ToInt32(inString[i]);

                    if ((charValue >= 0) &&
                        (charValue < 32))
                    {
                        // char in range 0..31
                        switch (charValue)
                        {
                        case 9: valueString = "&#x09;"; break;

                        case 10: valueString = "[LF]"; break;

                        case 12: valueString = "[FF]"; break;

                        case 13: valueString = "[CR]"; break;

                        case 14: valueString = "[SO]"; break;

                        case 15: valueString = "[SI]"; break;

                        case 27: valueString = "[ESC]"; break;

                        default:
                        {
                            System.String charValueString = charValue.ToString("X");
                            while (charValueString.Length < 2)
                            {
                                charValueString = "0" + charValueString;
                            }

                            valueString = "\\" + charValueString;
                            break;
                        }
                        }
                    }
                    else if ((charValue > 126) &&
                             (charValue <= 255))
                    {
                        // char in range 127..255
                        System.String charValueString = charValue.ToString("X");
                        while (charValueString.Length < 2)
                        {
                            charValueString = "0" + charValueString;
                        }

                        valueString = "\\" + charValueString;
                    }
                    else if (charValue > 255)
                    {
                        // the internal compiler marshalling used to convert the strings
                        // from unmanaged to managed results in UNICODE values for these characters
                        // - use a simple switch statement to display the required values
                        switch (charValue)
                        {
                        case 8364: valueString = "\\80"; break;

                        case 8218: valueString = "\\82"; break;

                        case 402: valueString = "\\83"; break;

                        case 8222: valueString = "\\84"; break;

                        case 8230: valueString = "\\85"; break;

                        case 8224: valueString = "\\86"; break;

                        case 8225: valueString = "\\87"; break;

                        case 710: valueString = "\\88"; break;

                        case 8240: valueString = "\\89"; break;

                        case 352: valueString = "\\8A"; break;

                        case 8249: valueString = "\\8B"; break;

                        case 338: valueString = "\\8C"; break;

                        case 381: valueString = "\\8E"; break;

                        case 8216: valueString = "\\91"; break;

                        case 8217: valueString = "\\92"; break;

                        case 8220: valueString = "\\93"; break;

                        case 8221: valueString = "\\94"; break;

                        case 8226: valueString = "\\95"; break;

                        case 8211: valueString = "\\96"; break;

                        case 8212: valueString = "\\97"; break;

                        case 732: valueString = "\\98"; break;

                        case 8482: valueString = "\\99"; break;

                        case 353: valueString = "\\9A"; break;

                        case 8250: valueString = "\\9B"; break;

                        case 339: valueString = "\\9C"; break;

                        case 382: valueString = "\\9E"; break;

                        case 376: valueString = "\\9F"; break;

                        default: break;
                        }
                    }
                    else
                    {
                        switch (charValue)
                        {
                        case 32:                                 // Space
                            if (displaySpaces)
                            {
                                valueString = "&#160;";
                            }
                            else
                            {
                                valueString = inString[i].ToString();
                            }
                            break;

                        case 38: valueString = "&#x26;"; break;                                 // &

                        case 60: valueString = "&#x3C;"; break;                                 // <

                        case 62: valueString = "&#x3E;"; break;                                 // >

                        default:
                            // char in range 32..127
                            valueString = inString[i].ToString();
                            break;
                        }
                    }

                    // add the character value to the string
                    outString.Append(valueString);
                }
            }
            return(outString.ToString());//outString;
        }
Esempio n. 34
0
        public void open(System.Int32 key)
        {
            try
            {
                openConnection();
                command = new SqlCommand("SELECT * FROM " + tbName + " WHERE TrxID=" + key.ToString(), conn);
                dadAdpt.SelectCommand = command;
                dset.Clear();
                iRowCount = dadAdpt.Fill(dset, tbName);
                closeConnection();
                if (iRowCount > 0)
                {
                    dRow = dset.Tables[tbName].Rows[0];
                }

                isValid = false;
            }
            catch (SqlException ex)
            {
                CCFBGlobal.appendErrorToErrorReport("Command Text = " + command.CommandText, ex.GetBaseException().ToString(),
                                                    CCFBGlobal.serverName);
                iRowCount = 0;
                closeConnection();
                isValid = false;
            }
        }
Esempio n. 35
0
        public BaseAttribute GetBaseAttribute(System.Int32 id)
        {
            BaseAttribute baseAttribute = OnGetItem <BaseAttribute>(id.ToString());

            return(baseAttribute);
        }
        public MeasurementUnit GetMeasurementUnit(System.Int32 id)
        {
            MeasurementUnit measurementUnit = OnGetItem <MeasurementUnit>(id.ToString());

            return(measurementUnit);
        }
 private void SnmpTrapFormAdvanced_Load(object sender, EventArgs e)
 {
     ctlMibFile.Text = strMibFile;
     ctlPort.Text    = numPort.ToString();
 }
Esempio n. 38
0
        public CustomerLog GetCustomerLog(System.Int32 id)
        {
            CustomerLog customerLog = OnGetItem <CustomerLog>(id.ToString());

            return(customerLog);
        }
Esempio n. 39
0
 /// <summary>
 /// get int default
 /// </summary>
 /// <param name="AKey"></param>
 /// <param name="ADefault"></param>
 /// <returns></returns>
 public System.Int32 GetInt32Default(String AKey, System.Int32 ADefault)
 {
     return(Convert.ToInt32(GetSystemDefault(AKey, ADefault.ToString())));
 }
Esempio n. 40
0
    public bool PosTest1()
    {
        bool         retVal      = true;
        const string c_TEST_DESC = "PosTest1:Verify the param is a random Int32 ";
        const string c_TEST_ID   = "P001";

        System.Int32 int32Value = TestLibrary.Generator.GetInt32(-55);

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            Decimal decimalValue = new Decimal(int32Value);
            if (decimalValue != Convert.ToDecimal(int32Value))
            {
                string errorDesc = "Value is not " + decimalValue.ToString() + " as expected: param is " + int32Value.ToString();
                TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID + " TestId-" + c_TEST_ID, "Unexpected exception: " + e);
            retVal = false;
        }


        return(retVal);
    }
Esempio n. 41
0
        public void delete(System.Int32 ID)
        {
            SqlCommand commDelete = new SqlCommand(" DELETE FROM " + tbName + " WHERE ItemKey=" + ID.ToString(), conn);

            openConnection();
            commDelete.ExecuteNonQuery();
            closeConnection();
        }
Esempio n. 42
0
        public Product GetProduct(System.Int32 id)
        {
            Product product = OnGetItem <Product>(id.ToString());

            return(product);
        }
 public bool DeleteMeasurementUnit(System.Int32 id)
 {
     return(OnDeleteItem <MeasurementUnit>(id.ToString()));
 }
Esempio n. 44
0
 public bool DeleteProduct(System.Int32 id)
 {
     return(OnDeleteItem <Product>(id.ToString()));
 }
Esempio n. 45
0
 public bool DeleteBaseAttribute(System.Int32 id)
 {
     return(OnDeleteItem <BaseAttribute>(id.ToString()));
 }
Esempio n. 46
0
        static void Main(string[] args)
        {
            System.Int32 a = new System.Int32();
            int          b = new int();
            int          c = 1;

            a = 1;
            b = 1;

            bool d = false;

            bool e = false;

            if (c == 1)
            {
                int f = 100;
                Console.WriteLine(f);
            }
            else
            {
                bool f = true;
            }

            System.Int32 g = new System.Int32();
            g = 400;

            Console.WriteLine(g.ToString());

            System.DateTime h = new DateTime();
            Console.WriteLine(h);

            Console.WriteLine(DateTime.IsLeapYear(2018));


            int     l = 10;
            decimal k = 0.1M;
            decimal n = k + k + k + k + k + k + k + k + k + k;

            Console.WriteLine(n);

            int o = 10;

            o += 1;

            o = 1;
            o++;
            if (o == 1)
            {
                Console.WriteLine("o = 1");
            }
            Console.WriteLine(o);

            //checked
            //{
            //    int p = int.MaxValue;
            //    Console.WriteLine(p);
            //    p++;
            //    Console.WriteLine(p);
            //}


            double q = 0.34534545398479348;

            Console.WriteLine(q);
            string w = q.ToString("P2");

            Console.WriteLine(w);


            bool s = true;

            Console.WriteLine(s);

            DateTime x = new DateTime(2020, 9, 10);
            DateTime y = DateTime.Now;

            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.WriteLine();
            Console.WriteLine(x);
            x = x.AddMinutes(200);
            Console.WriteLine(x);

            Console.WriteLine(x.ToString("MMMM yy"));


            DateTime z1 = DateTime.Now;
            DateTime z2 = new DateTime(2020, 9, 1);
            TimeSpan z3 = z1 - z2;

            TimeSpan z4 = new TimeSpan(15, 0, 0);
            TimeSpan z5 = new TimeSpan(17, 25, 0);
            TimeSpan z6 = z5 - z4;

            Console.WriteLine(z6.TotalMinutes);
        }
Esempio n. 47
0
 public override string ToString()
 {
     return("[" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + "]");
 }
Esempio n. 48
0
        private void ExecuteFullQuery(string AContext = null, TDataBase ADataBase = null)
        {
            TDataBase      DBConnectionObj = null;
            TDBTransaction ReadTransaction = new TDBTransaction();
            bool           SeparateDBConnectionEstablished = false;

            if (FFindParameters.FParametersGivenSeparately)
            {
                string SQLOrderBy       = "";
                string SQLWhereCriteria = "";

                if (FFindParameters.FPagedTableWhereCriteria != "")
                {
                    SQLWhereCriteria = "WHERE " + FFindParameters.FPagedTableWhereCriteria;
                }

                if (FFindParameters.FPagedTableOrderBy != "")
                {
                    SQLOrderBy = " ORDER BY " + FFindParameters.FPagedTableOrderBy;
                }

                FSelectSQL = "SELECT " + FFindParameters.FPagedTableColumns + " FROM " + FFindParameters.FPagedTable +
                             ' ' +
                             SQLWhereCriteria + SQLOrderBy;
            }
            else
            {
                FSelectSQL = FFindParameters.FSqlQuery;
            }

            TLogging.LogAtLevel(9, (this.GetType().FullName + ".ExecuteFullQuery SQL:" + FSelectSQL));

            // clear temp table. do not recreate because it may be typed
            FTmpDataTable.Clear();

            try
            {
                if (ADataBase == null)
                {
                    ADataBase = new TDataBase();
                    ADataBase.EstablishDBConnection(AContext + " Connection");
                    SeparateDBConnectionEstablished = true;
                }

                ReadTransaction = ADataBase.BeginTransaction(IsolationLevel.ReadCommitted,
                                                             -1, AContext + " Transaction");

                // Fill temporary table with query results (all records)
                FTotalRecords = ADataBase.SelectUsingDataAdapter(FSelectSQL, ReadTransaction,
                                                                 ref FTmpDataTable, out FDataAdapterCanceller,
                                                                 delegate(ref IDictionaryEnumerator AEnumerator)
                {
                    if (FFindParameters.FColumNameMapping != null)
                    {
                        AEnumerator = FFindParameters.FColumNameMapping.GetEnumerator();

                        return(FFindParameters.FPagedTable + "_for_paging");
                    }
                    else
                    {
                        return(String.Empty);
                    }
                }, 60, FFindParameters.FParametersArray);
            }
            catch (PostgresException Exp)
            {
                if (Exp.SqlState == "57014")  // Exception with Code 57014 is what Npgsql raises as a response to a Cancel request of a Command
                {
                    TLogging.LogAtLevel(7, this.GetType().FullName + ".ExecuteFullQuery: Query got cancelled; proper reply from Npgsql!");
                }
                else
                {
                    TLogging.Log(this.GetType().FullName + ".ExecuteFullQuery: Query got cancelled; general PostgresException occured: " + Exp.ToString());
                }

                TProgressTracker.SetCurrentState(FProgressID, "Query cancelled!", 0.0m);
                TProgressTracker.CancelJob(FProgressID);
                return;
            }
            catch (Exception Exp)
            {
                TLogging.Log(this.GetType().FullName + ".ExecuteFullQuery: Query got cancelled; general Exception occured: " + Exp.ToString());

                TProgressTracker.SetCurrentState(FProgressID, "Query cancelled!", 0.0m);
                TProgressTracker.CancelJob(FProgressID);

                return;
            }
            finally
            {
                ReadTransaction.Rollback();

                // Close separate DB Connection if we opened one earlier
                if (SeparateDBConnectionEstablished)
                {
                    DBConnectionObj.CloseDBConnection();
                }
            }

            TLogging.LogAtLevel(7,
                                (this.GetType().FullName + ".ExecuteFullQuery: FDataAdapter.Fill finished. FTotalRecords: " + FTotalRecords.ToString()));

            FPageDataTable           = FTmpDataTable.Clone();
            FPageDataTable.TableName = FFindParameters.FSearchName;
            TProgressTracker.SetCurrentState(FProgressID, "Query executed.", 100.0m);
            TProgressTracker.FinishJob(FProgressID);
        }
Esempio n. 49
0
 public override string ToString()
 {
     return ( m_strNum + " (год: " + m_iYear.ToString() + ", месяц: " + m_iMonth.ToString() + " от " + m_dtSalePrognosisDate.ToShortDateString() + ")" );
 }
Esempio n. 50
0
 public static System.Int32 GetInt32Default(String AKey, System.Int32 ADefault = 0, TDataBase ADataBase = null)
 {
     return(Convert.ToInt32(GetUserDefault(AKey, ADefault.ToString())));
 }
Esempio n. 51
0
 /// <summary>
 /// todoComment
 /// </summary>
 /// <param name="AKey"></param>
 /// <param name="ADefault"></param>
 /// <returns></returns>
 public static System.Int32 GetInt32Default(String AKey, System.Int32 ADefault)
 {
     return(Convert.ToInt32(TInternal.GetUserDefault(AKey, ADefault.ToString())));
 }
Esempio n. 52
0
        /// <summary>
        /// Called by a Client to request connection to the Petra Server.
        ///
        /// Authenticate the user and create a sesssion for the user.
        ///
        /// </summary>
        /// <param name="AUserName">Username with which the Client connects</param>
        /// <param name="APassword">Password with which the Client connects</param>
        /// <param name="AClientComputerName">Computer name of the Client</param>
        /// <param name="AClientExeVersion"></param>
        /// <param name="AClientIPAddress">IP Address of the Client</param>
        /// <param name="AClientServerConnectionType">Type of the connection (eg. LAN, Remote)</param>
        /// <param name="AClientID">Server-assigned ID of the Client</param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="ASiteKey"></param>
        /// <param name="ADataBase"></param>
        public static TConnectedClient ConnectClient(String AUserName,
                                                     String APassword,
                                                     String AClientComputerName,
                                                     String AClientIPAddress,
                                                     System.Version AClientExeVersion,
                                                     TClientServerConnectionType AClientServerConnectionType,
                                                     out System.Int32 AClientID,
                                                     out String AWelcomeMessage,
                                                     out Boolean ASystemEnabled,
                                                     out System.Int64 ASiteKey,
                                                     TDataBase ADataBase = null)
        {
            TDataBase      DBConnectionObj      = null;
            TDBTransaction ReadWriteTransaction = new TDBTransaction();
            bool           SystemEnabled        = true;
            string         WelcomeMessage       = String.Empty;
            Int64          SiteKey = -1;

            TConnectedClient ConnectedClient = null;

            if (TLogging.DL >= 10)
            {
                TLogging.Log(
                    "Loaded Assemblies in AppDomain " + Thread.GetDomain().FriendlyName + " (at call of ConnectClient):", TLoggingType.ToConsole |
                    TLoggingType.ToLogfile);

                foreach (Assembly tmpAssembly in Thread.GetDomain().GetAssemblies())
                {
                    TLogging.Log(tmpAssembly.FullName, TLoggingType.ToConsole | TLoggingType.ToLogfile);
                }
            }

            /*
             * Every Client Connection request is coming in in a separate Thread
             * (.NET Remoting does that for us and this is good!). However, the next block
             * of code must be executed only by exactly ONE thread at the same time to
             * preserve the integrity of Client tracking!
             */
            try
            {
                // TODORemoting if (Monitor.TryEnter(UConnectClientMonitor, TSrvSetting.ClientConnectionTimeoutAfterXSeconds * 1000))
                {
                    if (Thread.CurrentThread.Name == String.Empty)
                    {
                        Thread.CurrentThread.Name = "Client_" + AUserName + "__CLIENTCONNECTION_THREAD";
                    }

                    #region Logging

                    if (TLogging.DL >= 4)
                    {
                        Console.WriteLine(FormatClientList(false));
                        Console.WriteLine(FormatClientList(true));
                    }

                    if (TLogging.DL >= 4)
                    {
                        TLogging.Log("Client '" + AUserName + "' is connecting...", TLoggingType.ToConsole | TLoggingType.ToLogfile);
                    }
                    else
                    {
                        TLogging.Log("Client '" + AUserName + "' is connecting...", TLoggingType.ToLogfile);
                    }

                    #endregion

                    // check for username, if it is an email address
                    if (AUserName.Contains('@'))
                    {
                        AUserName = GetUserIDFromEmail(AUserName);
                    }

                    #region Variable assignments
                    // we are not really using the ClientID anymore, but the session ID!
                    AClientID = (short)0;
                    string ClientName = AUserName.ToUpper() + "_" + AClientID.ToString();
                    #endregion

                    ConnectedClient = new TConnectedClient(AClientID, AUserName.ToUpper(), ClientName, AClientComputerName, AClientIPAddress,
                                                           AClientServerConnectionType, ClientName);

                    #region Client Version vs. Server Version check

                    if (TLogging.DL >= 9)
                    {
                        Console.WriteLine(
                            "Client EXE Program Version: " + AClientExeVersion.ToString() + "; Server EXE Program Version: " +
                            TSrvSetting.ApplicationVersion.ToString());
                    }

                    if (TSrvSetting.ApplicationVersion.Compare(new TFileVersionInfo(AClientExeVersion)) != 0)
                    {
                        ConnectedClient.SessionStatus = TSessionStatus.adsStopped;
                        #region Logging

                        if (TLogging.DL >= 4)
                        {
                            TLogging.Log(
                                "Client '" + AUserName + "' tried to connect, but its Program Version (" + AClientExeVersion.ToString() +
                                ") doesn't match! Aborting Client Connection!", TLoggingType.ToConsole | TLoggingType.ToLogfile);
                        }
                        else
                        {
                            TLogging.Log(
                                "Client '" + AUserName + "' tried to connect, but its Program Version (" + AClientExeVersion.ToString() +
                                ") doesn't match! Aborting Client Connection!", TLoggingType.ToLogfile);
                        }

                        #endregion
                        throw new EClientVersionMismatchException(String.Format(StrClientServerExeProgramVersionMismatchMessage,
                                                                                AClientExeVersion.ToString(), TSrvSetting.ApplicationVersion.ToString()));
                    }

                    #endregion

                    #region Login request verification (incl. User authentication)
                    DBConnectionObj = DBAccess.Connect("ConnectClient (User Login)", ADataBase);
                    bool SubmitOK = false;

                    DBConnectionObj.WriteTransaction(ref ReadWriteTransaction,
                                                     ref SubmitOK,
                                                     delegate
                    {
                        // Perform login checks such as User authentication and Site Key check
                        try
                        {
                            PerformLoginChecks(AUserName,
                                               APassword,
                                               AClientComputerName,
                                               AClientIPAddress,
                                               out SystemEnabled,
                                               ReadWriteTransaction);
                        }
                        #region Exception handling
                        catch (EPetraSecurityException)
                        {
                            #region Logging

                            if (TLogging.DL >= 4)
                            {
                                TLogging.Log(
                                    "Client '" + AUserName + "' tried to connect, but it failed the Login Checks. Aborting Client Connection!",
                                    TLoggingType.ToConsole | TLoggingType.ToLogfile);
                            }
                            else
                            {
                                TLogging.Log(
                                    "Client '" + AUserName + "' tried to connect, but it failed the Login Checks. Aborting Client Connection!",
                                    TLoggingType.ToLogfile);
                            }

                            #endregion

                            ConnectedClient.SessionStatus = TSessionStatus.adsStopped;

                            // We need to set this flag to true here to get the failed login to be stored in the DB!!!
                            SubmitOK = true;

                            throw;
                        }
                        catch (Exception)
                        {
                            ConnectedClient.SessionStatus = TSessionStatus.adsStopped;
                            throw;
                        }
                        #endregion

                        // Login Checks were successful!
                        ConnectedClient.SessionStatus = TSessionStatus.adsConnectingLoginOK;

                        // Retrieve Welcome message and SiteKey
                        try
                        {
                            if (UMaintenanceLogonMessage != null)
                            {
                                WelcomeMessage = UMaintenanceLogonMessage.GetLogonMessage(AUserName, true, ReadWriteTransaction);
                            }
                            else
                            {
                                WelcomeMessage = "Welcome";
                            }

                            // we could do this directly, or via an interface, similar to LogonMessage, see above
                            string sql = "SELECT s_default_value_c FROM s_system_defaults WHERE s_default_code_c = 'SiteKey'";

                            try
                            {
                                SiteKey = Convert.ToInt64(DBConnectionObj.ExecuteScalar(sql, ReadWriteTransaction));
                            }
                            catch (EOPDBException)
                            {
                                // there is no site key defined yet.
                                SiteKey = -1;
                            }
                        }
                        catch (Exception)
                        {
                            ConnectedClient.SessionStatus = TSessionStatus.adsStopped;
                            throw;
                        }

                        SubmitOK = true;
                    });
                    #endregion

                    /*
                     * Uncomment the following statement to be able to better test how the
                     * Client reacts when it tries to connect and receives a
                     * ELoginFailedServerTooBusyException.
                     */

                    // Thread.Sleep(7000);

                    /*
                     * Notify all waiting Clients (that have not timed out yet) that they can
                     * now try to connect...
                     */
                    // TODORemoting Monitor.PulseAll(UConnectClientMonitor);
                }
// TODORemoting               else
                {
                    /*
                     * Throw Exception to tell any timed-out connecting Client that the Server
                     * is too busy to accept connect requests at the moment.
                     */
// TODORemoting                   throw new ELoginFailedServerTooBusyException();
                }
            }
            finally
            {
// TODORemoting               Monitor.Exit(UConnectClientMonitor);
            }

            ConnectedClient.StartSession();

            #region Logging

            //
            // Assemblies successfully loaded into Client AppDomain
            //
            if (TLogging.DL >= 4)
            {
                TLogging.Log(
                    "Client '" + AUserName + "' successfully connected. ClientID: " + AClientID.ToString(),
                    TLoggingType.ToConsole | TLoggingType.ToLogfile);
            }
            else
            {
                TLogging.Log("Client '" + AUserName + "' successfully connected. ClientID: " + AClientID.ToString(), TLoggingType.ToLogfile);
            }

            #endregion

            ASystemEnabled  = SystemEnabled;
            AWelcomeMessage = WelcomeMessage;
            ASiteKey        = SiteKey;

            return(ConnectedClient);
        }
 public bool DeleteEmployee(System.Int32 id)
 {
     return(OnDeleteItem <Employee>(id.ToString()));
 }
Esempio n. 54
0
        public Customer GetCustomer(System.Int32 id)
        {
            Customer customer = OnGetItem <Customer>(id.ToString());

            return(customer);
        }
Esempio n. 55
0
    /// <summary>
    /// 释放实体
    /// </summary>
    /// <param name="objev"></param>
    /// <returns></returns>
    public static bool ReleaseEntity(EntityView objev)
    {
        if (objev == null)
        {
            Trace.LogError("释放实体时找不到目标实体!");
            return(false);
        }

        if (m_friendPlayerList.Count > 0)
        {
            if (m_friendPlayerListIndex >= 0 && m_friendPlayerListIndex < m_friendPlayerList.Count && objev.ID == m_friendPlayerList[m_friendPlayerListIndex])
            {
                if (SoldierCamera.MainInstance() != null && EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.gameObject != null)
                {
                    SoldierCamera.MainInstance <SoldierCamera>().SwitchLookAtSolider(EntityFactory.MainHeroView); //切回到主角
                }
            }

            if (m_friendPlayerList.Contains((uint)objev.ID))
            {
                m_friendPlayerList.Remove((uint)objev.ID);
            }
        }

        ENTITY_ID   id   = objev.ID;
        ENTITY_TYPE type = objev.Type;

        m_NeedToLoadEntity.Remove(id);
        EntityFactory.Instance.m_entityContainer.Remove(ref objev);

        bool isHero = objev.IsHero;

        // 主角特殊处理一下
        if (isHero)
        {
            Initialize.Instance.ResetGameManager();
            MainHero     = null;
            MainHeroView = null;
            MainHeroID   = 0;
        }
        LogicDataCenter.warMinimapDataManager.RemoveObject(objev);
        LogicDataCenter.warOBDataManager.RemoveObject(objev);
        objev.Destroy();

        EntityFactory.Instance.EntityNum--;

        switch (type)
        {
        case ENTITY_TYPE.TYPE_PLAYER_ROLE:  { EntityFactory.Instance.ActorNum--; break; }

        case ENTITY_TYPE.TYPE_MONSTER:      { EntityFactory.Instance.MonsterNum--; break; }

        default: break;
        }

        objev = null;

        if (type == ENTITY_TYPE.TYPE_PLAYER_ROLE)
        {
            if (isHero)
            {
                Trace.Log("释放主角实体对象, id=" + id.ToString() + ", type=" + type.ToString());
            }
            else
            {
                Trace.Log("释放实体对象, id=" + id.ToString() + ", type=" + type.ToString());
            }
        }

        return(true);
    }
Esempio n. 56
0
        public static System.DateTime GetPeriodStartDate(
            System.Int32 ALedgerNumber,
            System.Int32 AYear,
            System.Int32 ADiffPeriod,
            System.Int32 APeriod)
        {
            System.Int32 RealYear       = 0;
            System.Int32 RealPeriod     = 0;
            System.Type  typeofTable    = null;
            TCacheable   CachePopulator = new TCacheable();
            DateTime     ReturnValue    = DateTime.Now;

            GetRealPeriod(ALedgerNumber, ADiffPeriod, AYear, APeriod, out RealPeriod, out RealYear);
            DataTable CachedDataTable = CachePopulator.GetCacheableTable(TCacheableFinanceTablesEnum.AccountingPeriodList,
                                                                         "",
                                                                         false,
                                                                         ALedgerNumber,
                                                                         out typeofTable);
            string whereClause = AAccountingPeriodTable.GetLedgerNumberDBName() + " = " + ALedgerNumber.ToString() + " and " +
                                 AAccountingPeriodTable.GetAccountingPeriodNumberDBName() + " = " + RealPeriod.ToString();

            DataRow[] filteredRows = CachedDataTable.Select(whereClause);

            if (filteredRows.Length > 0)
            {
                ReturnValue = ((AAccountingPeriodRow)filteredRows[0]).PeriodStartDate;

                ALedgerTable Ledger = (ALedgerTable)CachePopulator.GetCacheableTable(TCacheableFinanceTablesEnum.LedgerDetails,
                                                                                     "",
                                                                                     false,
                                                                                     ALedgerNumber,
                                                                                     out typeofTable);

                ReturnValue = ReturnValue.AddYears(RealYear - Ledger[0].CurrentFinancialYear);
            }

            return(ReturnValue);
        }
Esempio n. 57
0
 public bool DeleteCustomer(System.Int32 id)
 {
     return(OnDeleteItem <Customer>(id.ToString()));
 }
Esempio n. 58
0
 public static string GetUTCTime()
 {
     System.Int32 unixTimestamp = (System.Int32)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalSeconds;
     return(unixTimestamp.ToString());
 }
Esempio n. 59
0
        public void delete(System.Int32 key)
        {
            SqlCommand commDelete = new SqlCommand(" DELETE FROM " + tbName + " WHERE ID=" + key.ToString(), conn);

            openConnection();
            commDelete.BeginExecuteNonQuery();
            closeConnection();
        }
Esempio n. 60
0
 public override string ToString()
 {
     return(Int32Value.ToString());
 }