public void Update(EventLocation obj)
        {
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SP_UPDATE_EVENT_LOCATION;

            #region [Parameters]

            SqlParameter parameter = new SqlParameter(PN_EVENT_LOCATION_ID, System.Data.SqlDbType.Int);
            parameter.Value = obj.ID;
            parameter.Direction = System.Data.ParameterDirection.Input;
            _command.Parameters.Add(parameter);

            parameter = new SqlParameter(PN_EVENT_LOCATION_IS_DELETED, System.Data.SqlDbType.Bit);
            parameter.Value = obj.IsDeleted;
            parameter.Direction = System.Data.ParameterDirection.Input;
            _command.Parameters.Add(parameter);

            parameter = new SqlParameter(PN_EVENT_LOCATION_NAME, System.Data.SqlDbType.NVarChar);
            parameter.Value = obj.Name;
            parameter.Direction = System.Data.ParameterDirection.Input;
            _command.Parameters.Add(parameter);

            #endregion

            _connection.Open();
            _command.ExecuteNonQuery();
            _connection.Close();
        }
Esempio n. 2
0
        public static void Update(EventLocation obj)
        {
            if (obj == null)
                throw new Exception("Object is null");

            EventLocationDataMapper objCaller = new EventLocationDataMapper();

            objCaller.Update(obj);
        }
Esempio n. 3
0
        public static int Add(EventLocation obj)
        {
            if (obj == null)
                throw new Exception("Object is null");

            EventLocationDataMapper objCaller = new EventLocationDataMapper();

            return objCaller.Add(obj);
        }
Esempio n. 4
0
        public void PopulateEventLocation(SqlDataReader _dtr, EventLocation obj)
        {
            int columnIndex = 0;
            columnIndex = _dtr.GetOrdinal(EventLocationDataMapper.CN_EVENT_LOCATION_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.ID = _dtr.GetInt32((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(EventLocationDataMapper.CN_EVENT_LOCATION_IS_DELETED);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.IsDeleted = _dtr.GetBoolean((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(EventLocationDataMapper.CN_EVENT_LOCATION_NAME);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Name = _dtr.GetString((columnIndex));
            }
        }
 private void GetEntityFromReader(SqlDataReader _dtr, EventLocation obj)
 {
     PopulateEventLocation(_dtr, obj);
 }
 public EventLocation GetEventLocation(SqlDataReader _dtr, IList<EventLocation> colobj)
 {
     EventLocation obj = colobj.Where(t => t.ID == Convert.ToInt32(_dtr[CN_EVENT_LOCATION_ID].ToString())).FirstOrDefault();
     if (null == obj)
     {
         obj = new EventLocation();
         colobj.Add(obj);
     }
     return obj;
 }
        public EventLocation GetByID(int ID)
        {
            EventLocation obj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SP_GET_EVENT_LOCATION_BY_ID;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_EVENT_LOCATION_ID, SqlDbType.Int);
            parameterID.Value = ID;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        while (_dtreader.Read())
                        {
                            if (obj == null)
                                obj = new EventLocation();
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dtreader.Close();
                _connection.Close();
            }

            return obj;
        }
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                EventLocation eventLocation = new EventLocation();
                eventLocation.IsDeleted = false;
                eventLocation.Name = txtName.Text;

                EventLocationManager.Add(eventLocation);

                dvProblems.InnerText = Resources.EventResource.SavedSuccessfully;
                AddMode();
                BindGrid();
            }
            catch (Exception ex)
            {
                dvProblems.InnerText = Resources.EventResource.ResourceManager.GetString(ex.Message);
            }
            upnlGrid.Update();
        }