コード例 #1
0
 private void btnDeleteBusRegist_Click(object sender, EventArgs e)
 {
     try
     {
         BusProperty deleteProp = _busPropertBll.GetBLL(selectedID);
         selectedID = 0;
         _busPropertBll.DeleteBLL(deleteProp);
         RefleshGrid();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
        private void btnSaveBusRegist_Click(object sender, EventArgs e)
        {
            try
            {
                BusProperty newBusPropery = new BusProperty();
                newBusPropery.Name = txtBusProperty.Text;
                _busPropertBll.SaveBLL(newBusPropery);


                RefleshGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void btnUpdateBusRegist_Click(object sender, EventArgs e)
        {
            try
            {
                BusProperty updateBusPropery = _busPropertBll.GetBLL(selectedID);
                updateBusPropery.Name = txtBusProperty.Text;
                _busPropertBll.UpdateBLL(updateBusPropery);



                RefleshGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
 private void dgvBusProperyList_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     try
     {
         if (dgvBusProperyList.SelectedRows.Count > 0)
         {
             DataGridViewRow dr            = dgvBusProperyList.SelectedRows[0];
             string          updateIdInput = dr.Cells[0].Value.ToString();
             selectedID = int.Parse(updateIdInput);
             BusProperty updateBusProperty = _busPropertBll.GetBLL(selectedID);
             txtBusProperty.Text = updateBusProperty.Name;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
        public static BaseResponse <List <BusProperty> > ParseAllProperties(IEnumerable <XElement> elements)
        {
            var response = new BaseResponse <List <BusProperty> >();

            var properties = new List <BusProperty>();

            foreach (var item in elements.ToList())
            {
                var property = new BusProperty();
                property.Index       = Convert.ToInt32(item.Element(XName.Get("O_Tip_Ozellik")).Value.ToString());
                property.Name        = item.Element(XName.Get("O_Tip_Ozellik_Aciklama")).Value.ToString();
                property.Description = item.Element(XName.Get("O_Tip_Ozellik_Detay")).Value.ToString();
                property.Icon        = item.Element(XName.Get("O_Tip_Ozellik_Icon")).Value.ToString();
                properties.Add(property);
            }
            properties = properties.Where(x => !x.Name.Contains("Tanımsız")).ToList();

            response.Result = properties;
            return(response);
        }
コード例 #6
0
        private void btnAddListBox_Click(object sender, EventArgs e)
        {
            BusProperty useBusProperty = (BusProperty)cmbBusPropertyTablo.SelectedItem;

            lstBusProperty.Items.Add(useBusProperty);
        }
コード例 #7
0
        public BusType Get(int key)
        {
            /*
             * alter proc sp_GetBusTypeById
             *  @Id int
             *  as
             *  begin
             *  select * from BusType where ID = @Id
             *  end
             */
            _sqlComm.CommandText = "sp_GetBusTypeById";
            _sqlComm.CommandType = CommandType.StoredProcedure;
            _sqlComm.Parameters.Clear();
            _sqlComm.Parameters.AddWithValue("@Id", key);
            BusType busType = new BusType();

            try
            {
                if (_sqlComm.Connection.State == ConnectionState.Closed)
                {
                    _sqlComm.Connection.Open();
                }
                SqlDataReader reader = _sqlComm.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        busType               = new BusType();
                        busType.ID            = Convert.ToInt32(reader["ID"]);
                        busType.Name          = reader["Name"].ToString();
                        busType.SeatCount     = Convert.ToInt32(reader["SeatCount"]);
                        busType.BackDoorIndex = Convert.ToInt32(reader["BackDoorIndex"]);
                    }
                }
                else
                {
                    throw new Exception("Bu Bus tipinine ait kayıt bulunamadı !!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Bu Bus tipinine ait kayt bulunamadı !!" + ex.Message);
            }

            finally
            {
                _sqlComm.Connection.Close();
            }

            /*
             *
             *  begin try
             * drop procedure sp_GetBusProperyBusTypeByID
             * end try
             * begin catch
             * end catch
             * go
             * create procedure sp_GetBusProperyBusTypeByID
             *  @busTypeID int
             *  as
             *  begin
             *      select BusTypeID,BusPropertyID from  BusPropertyBusType  where BusTypeID=@busTypeID
             *  end
             *
             */
            _sqlComm.CommandText = "sp_GetBusProperyBusTypeByID";
            _sqlComm.CommandType = CommandType.StoredProcedure;
            _sqlComm.Parameters.Clear();
            _sqlComm.Parameters.AddWithValue("@busTypeID", key);

            try
            {
                if (_sqlComm.Connection.State == ConnectionState.Closed)
                {
                    _sqlComm.Connection.Open();
                }
                SqlDataReader reader = _sqlComm.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        BusPropertyDataMapper busPropertyDataMapper = new BusPropertyDataMapper();
                        int         busPropertyID = (int)reader[1];
                        BusProperty busPropery    = busPropertyDataMapper.Get(busPropertyID);
                        busType.BusPropertList.Add(busPropery);
                    }
                }



                return(busType);
            }
            catch (Exception ex)
            {
                throw new Exception("Bu Bus tipinine ait kayt bulunamadı !!" + ex.Message);
            }

            finally
            {
                _sqlComm.Connection.Close();
            }
        }