Ejemplo n.º 1
0
        public HcCountryEntity GetSingleHcCountryRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, Countryname, flag, IsActive FROM HC_Country WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcCountryEntity hcCountryEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcCountryEntity = new HcCountryEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        hcCountryEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["Countryname"] != DBNull.Value)
                    {
                        hcCountryEntity.Countryname = dataReader["Countryname"].ToString();
                    }
                    if (dataReader["flag"] != DBNull.Value)
                    {
                        hcCountryEntity.Flag = dataReader["flag"].ToString();
                    }
                    if (dataReader["IsActive"] != DBNull.Value)
                    {
                        hcCountryEntity.Isactive = dataReader["IsActive"].ToString();
                    }
                }
            }
            return(hcCountryEntity);
        }
Ejemplo n.º 2
0
        public object UpdateHcCountryInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcCountryEntity hcCountryEntity = (HcCountryEntity)param;
                    HcCountryDAL    hcCountryDAL    = new HcCountryDAL();
                    retObj = (object)hcCountryDAL.UpdateHcCountryInfo(hcCountryEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Ejemplo n.º 3
0
        public bool SaveHcCountryInfo(HcCountryEntity hcCountryEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO HC_Country ( Countryname, flag, IsActive) VALUES (  @Countryname,  @Flag,  @Isactive )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Countryname", DbType.String, hcCountryEntity.Countryname);
            db.AddInParameter(dbCommand, "Flag", DbType.String, hcCountryEntity.Flag);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcCountryEntity.Isactive);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Ejemplo n.º 4
0
        public bool UpdateHcCountryInfo(HcCountryEntity hcCountryEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE HC_Country SET Countryname= @Countryname, flag= @Flag, IsActive= @Isactive WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcCountryEntity.Id);
            db.AddInParameter(dbCommand, "Countryname", DbType.String, hcCountryEntity.Countryname);
            db.AddInParameter(dbCommand, "Flag", DbType.String, hcCountryEntity.Flag);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcCountryEntity.Isactive);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Ejemplo n.º 5
0
        public List <SelectListItem> List_Country()
        {
            List <SelectListItem> Items = new List <SelectListItem>();
            HcCountryEntity       obj   = new HcCountryEntity();

            obj.Isactive = "1";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcCountryRecord, obj);

            foreach (DataRow dr in dt.Rows)
            {
                Items.Add(new SelectListItem {
                    Text = dr["Countryname"].ToString(), Value = dr["ID"].ToString()
                });
            }
            return(Items);
        }