private void btnSave_Click(object sender, EventArgs e) { if (ValidateToSavedData()) { CLocBO oBO = new CLocBO(); CResult oResult = new CResult(); CLocation oLoc = new CLocation(); oLoc = GetToSavedData(); if (!m_IsUpdateMode) { oResult = oBO.Create(oLoc); } else { oLoc.Loc_OID = txtSelectedID.Text.Trim(); oResult = oBO.Update(oLoc); } if (oResult.IsSuccess) { ClearFormData(); ReadLocationAllData(); } else { MessageBox.Show(oResult.ErrMsg.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void SetDefaultValue() { for (int i = 0; i < dgItemList.Rows.Count; i++) { DataGridViewComboBoxCell cmbSrcLoc = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSourceLoc"]); foreach (object obj in cmbSrcLoc.Items) { CLocation oloc = (CLocation)obj; cmbSrcLoc.Value = oloc.Loc_OID.Trim(); break; } DataGridViewComboBoxCell cmbSrcInvTyp = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSrcInvType"]); foreach (object obj in cmbSrcInvTyp.Items) { cmbSrcInvTyp.Value = obj; break; } DataGridViewComboBoxCell cmbCurrency = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colCurrency"]); foreach (object obj in cmbCurrency.Items) { CCurrency ocur = (CCurrency)obj; cmbCurrency.Value = ocur.Curr_OID; break; } } }
private void btnDelete_Click(object sender, EventArgs e) { CLocBO oBO = new CLocBO(); CResult oResult = new CResult(); CLocation oLoc = new CLocation(); oLoc = GetToSavedData(); if (m_IsUpdateMode) { if ((MessageBox.Show("Are you sure to Delete this ? ", "Warning ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) == DialogResult.Yes) { oLoc.Loc_OID = txtSelectedID.Text.Trim(); oResult = oBO.Delete(oLoc); if (oResult.IsSuccess) { if (oResult.Data.ToString() == "0") { MessageBox.Show("Deletion Not Possible", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearFormData(); } else { MessageBox.Show("Deleted successfully"); ClearFormData(); } } else { MessageBox.Show(oResult.ErrMsg.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/// <summary> /// Kiểm tra xem tọa độ có thỏa mãn không /// </summary> /// <param name="c"></param> /// <returns></returns> public static bool checkLocation(CLocation c, BasePiece piece) { if (c.X < 0 || c.X > 7 || c.Y < 0 || c.Y > 7) { return(false); } else { //if (ChessBoard.Current.Cells[c.X][c.Y]._currentPiece != null) if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] != 0) { if (piece.player == EPlayer.BLACK) { if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] < 0) { return(false); } } if (piece.player == EPlayer.WHITE) { if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] > 0) { return(false); } } } } return(true); }
public FrmManualIn(CLocation lct) : this() { txtInLct.Text = lct.Address; txtInCSize.Text = lct.Size; this.Text = "手动数据入库 -车位:" + lct.Address.Substring(0, 1) + "边" + Convert.ToInt32(lct.Address.Substring(1, 2)) + "列" + lct.Address.Substring(3, 1) + "层"; }
private void 数据出库ToolStripMenuItem_Click(object sender, EventArgs e) { CLocation lct = (CLocation)contextMenuStripLctn.Tag; if (lct != null) { string line = lct.Address.Substring(0, 1); string list = int.Parse(lct.Address.Substring(1, 2)).ToString(); string layer = lct.Address.Substring(3, 1); DialogResult dr = MessageBox.Show("请确认车位上无车辆!出库车位: " + line + "边" + list + "列" + layer + "层", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); if (dr == DialogResult.OK) { int rit = Program.mng.ManualOutLocation(lct.Address); switch (rit) { case 0: MessageBox.Show("车位出库异常!"); break; case 101: MessageBox.Show("车位地址不正确!"); break; case 102: MessageBox.Show("该车位为无效车位或已禁用!"); break; case 103: MessageBox.Show("该车位未存车!"); break; } } } }
private void dataGridViewTwo_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex > 0 && e.RowIndex > -1) { DataGridView dgv = (DataGridView)sender; CLocation lct = (CLocation)dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag; if (lct != null && lct.Type != EnmLocationType.Invalid) { txtOutHall.Text = ""; if (txtFromAddrs.Text.Trim() == "") { txtFromAddrs.Text = lct.Address; return; } if (txtToAddrs.Text.Trim() == "") { txtToAddrs.Text = lct.Address; } if (txtFromAddrs.Text.Trim() != "" && txtToAddrs.Text.Trim() != "") { txtToAddrs.Text = lct.Address; } } } }
/// <summary> /// 分配车位、ETV /// </summary> private void AllocateLctAndEtv(out CSMG etv, out CLocation lct, IList <CSMG> workList, Dictionary <CSMG, CScope> dicWorkScope, bool isMax) { etv = null; lct = null; IList <CSMG> freeEtvList = FreeDeviceListOfWorkScope(workList); int count = freeEtvList.Count; switch (count) { case 0: FindNearestEtvAndLct(out etv, out lct, workList, dicWorkScope, isMax); break; case 1: etv = freeEtvList[0]; lct = AllocateLocation(dicWorkScope[etv], isMax); break; case 2: FindNearestEtvAndLct(out etv, out lct, freeEtvList, dicWorkScope, isMax); break; default: break; } }
/// <summary> /// 找出离车厅最近的可用ETV /// </summary> private bool FindNearestEtvAndLct(out CSMG etv, out CLocation lct, IList <CSMG> EtvList, Dictionary <CSMG, CScope> dicScope, bool isMax) { etv = null; lct = null; CWSMG cwsmg = new CWSMG(); IList <CSMG> fNeareasEtvs = SortedByAddress(pHall.Address, EtvList, pHall.Region); //排序 if (fNeareasEtvs.Count == 0) { return(false); } foreach (CSMG smg in fNeareasEtvs) { if (cwsmg.CheckEtvMode(smg.ID)) { lct = AllocateLocation(dicScope[smg], isMax); if (lct != null) { etv = smg; return(true); } } } return(false); }
private void btnclick(object sender, EventArgs e) { Rc = new RegistrationClass(); Rc.CreateDatabaseBook(); String t = C_id.ToString(); List <CLocation> res = Rc.SelectBookedLocation(t); List <CLocation> k = Rc.SelectTableLocation(); int o = k.Count; if (res != null) { int i = res.Count; CLocation Loc = res.Last(); CLocation Loc1 = res[0]; Mssage = Loc.Message; Addrss = Loc.address; } RM = new Book(); RM.Message = Mssage; RM.C_id = C_id.Text; RM.D_id = D_id.Text; RM.Address = Addrss; bool r = Rc.InsertBook(RM); if (r) { FindViewById <TextView>(Resource.Id.textView1).Text = "Booked Successfully ! Enjoy Your Ride"; } }
public MainWindow() { InitializeComponent(); CLocation.GetLocationEvent(); CLocation.MainWin = this; LocationConverter locConverter = new LocationConverter(); //set default parameters global.DomainName = "auth.hpicorp.net"; string x = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName; geoIp2.Text = x; Visibility = Visibility.Hidden; global.Locations = new LocationCollection() { new Location(29.991445, -95.585568), new Location(29.991389, -95.580096), new Location(29.988248, -95.579860), new Location(29.987988, -95.585375) }; /// Immmediately start the Check window /// Don't show this window /// This window is unnecessary }
private static void Main(string[] args) { var myLocation = new CLocation(); myLocation.GetLocationEvent(args.Length > 0); Console.WriteLine("Enter any key to quit."); Console.ReadLine(); }
static void Main(string[] args) { CLocation myLocation = new CLocation(); myLocation.GetLocationEvent(); Console.WriteLine("Enter any key to quit."); Console.ReadLine(); }
protected void SetNewLocation(Cell cell) { this._currentCell = cell; cell.SetPiece(this); this.Location = cell.Location; this.transform.DOMove(offsetPosition + new Vector3(this.Location.x * ChessBoard.Current.CELL_SIZE, 0, this.Location.y * ChessBoard.Current.CELL_SIZE), 0.75f); }
/// <summary> /// Kiểm tra xem tọa độ đó có thỏa mãn không [0,7] /// </summary> public static bool CheckLocation(CLocation c) { if (c.X >= 0 && c.X <= 7 && c.Y >= 0 && c.Y <= 7) { return(true); } return(false); }
public void HuongDiTuong() { //Thực hiện kiểm tra 4 đường chéo, cho đến khi gặp điểm dừng //1. Phải trên : x++, y++ CLocation c = new CLocation(this.location.X + 1, this.location.Y + 1); while (CHelper.checkLocation(c, this)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] != 0) { break; } c = new CLocation(c.X + 1, c.Y + 1); } //2. Phải dưới : x++, y-- c = new CLocation(this.location.X + 1, this.location.Y - 1); while (CHelper.checkLocation(c, this)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] != 0) { break; } c = new CLocation(c.X + 1, c.Y - 1); } //3. Trái trên : x--, y++ c = new CLocation(this.location.X - 1, this.location.Y + 1); while (CHelper.checkLocation(c, this)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] != 0) { break; } c = new CLocation(c.X - 1, c.Y + 1); } //4. Trái dưới : x--, y-- c = new CLocation(this.location.X - 1, this.location.Y - 1); while (CHelper.checkLocation(c, this)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.arrayLocationFuture[c.X, c.Y] != 0) { break; } c = new CLocation(c.X - 1, c.Y - 1); } foreach (var item in _targetedCells) { item.SetCellState(ECellState.TARGETED); } }
public override void BeSelectedSameColor() { //Thực hiện kiểm tra 4 đường chéo, cho đến khi gặp điểm dừng //1. Phải trên : x++, y++ CLocation c = new CLocation(this.location.X + 1, this.location.Y + 1); while (CHelper.checkLocationSameColor(c)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.Cells[c.X][c.Y]._currentPiece != null) { break; } c = new CLocation(c.X + 1, c.Y + 1); } //2. Phải dưới : x++, y-- c = new CLocation(this.location.X + 1, this.location.Y - 1); while (CHelper.checkLocationSameColor(c)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.Cells[c.X][c.Y]._currentPiece != null) { break; } c = new CLocation(c.X + 1, c.Y - 1); } //3. Trái trên : x--, y++ c = new CLocation(this.location.X - 1, this.location.Y + 1); while (CHelper.checkLocationSameColor(c)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.Cells[c.X][c.Y]._currentPiece != null) { break; } c = new CLocation(c.X - 1, c.Y + 1); } //4. Trái dưới : x--, y-- c = new CLocation(this.location.X - 1, this.location.Y - 1); while (CHelper.checkLocationSameColor(c)) { _targetedCells.Add(ChessBoard.Current.Cells[c.X][c.Y]); if (ChessBoard.Current.Cells[c.X][c.Y]._currentPiece != null) { break; } c = new CLocation(c.X - 1, c.Y - 1); } foreach (var item in _targetedCells) { item.SetCellState(ECellState.TARGETED); } }
private void 数据入库ToolStripMenuItem_Click(object sender, EventArgs e) { CLocation lct = (CLocation)contextMenuStripLctn.Tag; if (lct != null) { new FrmManualIn(lct).ShowDialog(); } }
//查询车位 private void btnFind_Click(object sender, EventArgs e) { txtFindLct.Text = ""; CLocation lct = Program.mng.SelectLocationOfIccd(txtFindIccd.Text.Trim()); if (lct != null) { txtFindLct.Text = lct.Address; } }
public Registration() { InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); CLocation myLocation = new CLocation(); myLocation.OnPositionChanged += new EventHandler <PositionEventArgs>(myLocation_OnPositionChanged); myLocation.GetLocationEvent(); }
private CLocation GetToSavedData() { CLocation oLoc = new CLocation(); oLoc.Loc_OID = txtSelectedID.Text.Trim(); oLoc.Loc_Branch = currentBranch.CompBrn_Code; oLoc.Loc_Code = txtCode.Text; oLoc.Loc_Name = txtName.Text; return(oLoc); }
private void lstLocationList_Click(object sender, EventArgs e) { if (lstLocationList.Items.Count > 0) { CLocation objLoc = (CLocation)lstLocationList.SelectedItem; txtSelectedID.Text = objLoc.Loc_OID.ToString(); txtCode.Text = objLoc.Loc_Code; txtName.Text = objLoc.Loc_Name; FormControlMode(1); } }
private CLocation GetResultSetToLoc(DataRow dr) { CLocation oLoc = new CLocation(); oLoc.Loc_OID = dr[0].ToString(); oLoc.Loc_Branch = dr[1].ToString(); oLoc.Loc_Code = dr[2].ToString(); oLoc.Loc_Name = dr[3].ToString(); return(oLoc); }
/// <summary> /// 手动入库 /// </summary> public int ManInLocation(string addrs, string iccode, string carSize, int distance, DateTime InDate) { try { CLocation lct = this.SelectLctFromAddrs(addrs); CICCard iccd = new CICCard(); //在使用seticcard时是对象间赋值,应先生成新对象, iccd = new CWICCard().SelectByUserCode(iccode); if (lct == null || iccd == null) { return(101); } if (iccd.Status != CICCard.EnmICCardStatus.Normal) { return(106); } if (lct.Type != CLocation.EnmLocationType.Normal || lct.Status != CLocation.EnmLocationStatus.Space) { return(102); //该车位不合格 } if (lct.ICCardCode != "") { return(103); //车位上有车 } CLocation lctn = this.SelectLctFromICCode(iccd.Code); if (lctn != null) { return(104); //该卡已存车 } if (carSize.CompareTo(lct.Size) > 0) { return(105);//外形不合格 } lct.SetICCard(iccd); lct.Distance = distance; lct.CarSize = carSize; lct.InDate = InDate; lct.Status = CLocation.EnmLocationStatus.Occupy; string msg = "数据入库- 源车位:" + lct.Address + " 状态:" + lct.Status.ToString() + " 卡号:" + lct.ICCardCode; new CWSException(msg, 0); CWData.myDB.ManUpdateLocation(lct); return(100); } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }
private async void AddressButton1_OnClick(object sender, EventArgs e) { try { Usertype = FindViewById <TextView>(Resource.Id.Usertype); Email = FindViewById <TextView>(Resource.Id.Email); Message = FindViewById <TextView>(Resource.Id.Message); var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; TimeSpan ts = TimeSpan.FromTicks(10000); var position = await locator.GetPositionAsync(timeout : ts); Geocoder geocoder = new Geocoder(this); IList <Address> addressList = await geocoder.GetFromLocationAsync(position.Latitude, position.Longitude, 10); Address address = addressList.FirstOrDefault(); if (address != null) { StringBuilder deviceAddress = new StringBuilder(); for (int i = 0; i <= address.MaxAddressLineIndex; i++) { deviceAddress.AppendLine(address.GetAddressLine(i)); } _addressText.Text = deviceAddress.ToString(); RC = new RegistrationClass(); RM = new CLocation(); RM.Email = Email.Text; RM.UserType = Usertype.Text; RM.address = deviceAddress.ToString(); RM.Message = Message.Text; RC.CreateDatabaseLocation(); bool b = RC.InsertCLocation(RM); if (b) { FindViewById <TextView>(Resource.Id.Status).Text = "Location Saved!"; } } else { _addressText.Text = "Unable to determine the address. Try again in a few minutes."; } } catch (Exception a) { Console.Write(a.Message); } }
private void 车位启用ToolStripMenuItem_Click(object sender, EventArgs e) { CLocation lct = (CLocation)contextMenuStripLctn.Tag; if (lct != null) { string line = lct.Address.Substring(0, 1); string list = int.Parse(lct.Address.Substring(1, 2)).ToString(); string layer = lct.Address.Substring(3, 1); DialogResult dr = MessageBox.Show("是否要启用车位: " + line + "边" + list + "列" + layer + "层", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); if (dr == DialogResult.OK) { DisplayHint(Program.mng.ManualEnableLocation(lct.Address)); } } }
public bool InsertCLocation(CLocation item) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "CLocation.db"))) { connection.Insert(item); return(true); } } catch (SQLiteException e) { Log.Info("Message", e.Message); return(false); } }
public CResult Delete(CLocation oLoc) { oResult = new CResult(); conn = oConnManager.GetConnection(out s_DBError); if (conn != null) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.Transaction = oConnManager.BeginTransaction(); try { cmd.CommandText = "sp_Loc_Delete"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Loc_OID", oLoc.Loc_OID); cmd.Parameters.Add("@IsSuccess", SqlDbType.Char, 1); cmd.Parameters["@IsSuccess"].Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); string st = cmd.Parameters["@IsSuccess"].Value.ToString(); oConnManager.Commit(); oResult.Data = st; oResult.IsSuccess = true; } catch (SqlException e) { string sRollbackError = oConnManager.Rollback(); oResult.IsSuccess = false; oResult.ErrMsg = sRollbackError.Equals("") ? oConnManager.GetErrorMessage(e) : sRollbackError; } finally { oConnManager.Close(); } } else { oResult.IsSuccess = false; oResult.ErrMsg = s_DBError; } return(oResult); }
/// <summary> /// 设定对应车位单元格颜色 /// </summary> /// <param name="lct"></param> /// <param name="dgvc"></param> private void SetLocationStatusColor(CLocation lct, DataGridViewCell dgvc) { if (lct.Type == EnmLocationType.Normal) { switch (lct.Status) { case EnmLocationStatus.Space: dgvc.Style.BackColor = Color.LightYellow; break; case EnmLocationStatus.Occupy: dgvc.Style.BackColor = Color.Purple; break; case EnmLocationStatus.Entering: dgvc.Style.BackColor = Color.Violet; break; case EnmLocationStatus.Outing: dgvc.Style.BackColor = Color.SkyBlue; break; case EnmLocationStatus.Temping: //取物后车位被占用状态 dgvc.Style.BackColor = Color.Wheat; break; default: dgvc.Style.BackColor = Color.Gray; break; } } else if (lct.Type == EnmLocationType.Hall) { dgvc.Style.BackColor = Color.DarkKhaki; } else if (lct.Type == EnmLocationType.Disable && lct.Status != EnmLocationStatus.Occupy) { dgvc.Style.BackColor = Color.DarkGray; } else if (lct.Type == EnmLocationType.Invalid) { dgvc.Style.BackColor = Color.DimGray; } dgvc.Style.SelectionBackColor = dgvc.Style.BackColor; }
protected void SetNewLocation(Cell newCell) { setPosCount++; if (setPosCount > 1) { this._currentCell.SetPiece(null); } this._currentCell = newCell; newCell.SetPiece(this); this.Location = newCell.Location; //this.transform.position = offsetPosition + new Vector3(Location.X * ChessBoard.Current.CELL_SIZE, 0, // Location.Y * ChessBoard.Current.CELL_SIZE); this.transform.DOMove(offsetPosition + new Vector3(Location.X * ChessBoard.Current.CELL_SIZE, 0, Location.Y * ChessBoard.Current.CELL_SIZE), 0.75f); }