コード例 #1
0
        public Business Add(Business business)
        {
            BusinessEN businessEN = new BusinessEN();
            businessEN.Name = business.Name;
            businessEN.Category = new CategoryEN();
            businessEN.Category.ID = business.CategoryId;
            businessEN.User = new UserEN();
            businessEN.User.ID = business.UserId;
            businessEN.Description = business.Description;
            businessEN.Latitude = business.Latitude;
            businessEN.Longitude = business.Longitude;
            businessEN.Currency = business.Currency;
            businessEN.Price = business.Price;

            ContactsEN contactsEN = new ContactsEN();
            contactsEN.Business = businessEN;
            contactsEN.Phonenumber = business.Phonenumber;
            contactsEN.EmailID = business.EmailID;
            contactsEN.Address = business.Address;

            BusinessBiz biz = new BusinessBiz();
            businessEN = biz.Add(businessEN, contactsEN);
            business.ID = businessEN.ID;
            return business;
        }
コード例 #2
0
        public bool SaveContact(BusinessEN business, ContactsEN contact)
        {
            MySqlConnection con = CommonDAL.CreateConnection();
            try
            {
                MySql.Data.MySqlClient.MySqlCommand dbcommand = null;
                CommonDAL.OpenConnection(con, "bizcontact_add", out dbcommand);
                dbcommand.Parameters.AddWithValue("param_businessid", business.ID);
                dbcommand.Parameters.AddWithValue("param_phonenumber", contact.Phonenumber);
                dbcommand.Parameters.AddWithValue("param_emailid", contact.EmailID);
                dbcommand.Parameters.AddWithValue("param_address", contact.Address);

                object id = dbcommand.ExecuteScalar();
                contact.ID = Convert.ToInt32(id);
                if (contact.ID != 0)
                {
                    return true;
                }
                return false;
            }
            catch (Exception e1)
            {
                throw new Exception(e1.Message);
            }
            finally
            {
                con.Close();
            }
        }
コード例 #3
0
 public BusinessEN Add(BusinessEN business, ContactsEN contact)
 {
     business = businessDal.Save(business);
     bool isSaved = businessDal.SaveContact(business, contact);
     return business;
 }