public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_SLIDESHOW slideshow     = repo.Retrieve(id);
                TOURIS_TV_SLIDESHOW slideshowView = new TOURIS_TV_SLIDESHOW();

                if (slideshow != null)
                {
                    slideshowView.ID     = slideshow.ID;
                    slideshowView.TITTLE = slideshow.TITTLE;
                    slideshowView.CONTENT_DESCRIPTION = slideshow.CONTENT_DESCRIPTION;
                    slideshowView.CLASS              = slideshow.CLASS;
                    slideshowView.PHOTO_PATH         = slideshow.PHOTO_PATH;
                    slideshowView.URL                = slideshow.URL;
                    slideshowView.CREATED_BY         = slideshow.CREATED_BY;
                    slideshowView.CREATED_TIME       = slideshow.CREATED_TIME;
                    slideshowView.LAST_MODIFIED_BY   = slideshow.LAST_MODIFIED_BY;
                    slideshowView.LAST_MODIFIED_TIME = slideshow.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { slideshowView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #2
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_MENU menu     = repo.Retrieve(id);
                TOURIS_TV_MENU menuView = new TOURIS_TV_MENU();

                if (menu != null)
                {
                    menuView.ID                 = menu.ID;
                    menuView.MENU_NAME          = menu.MENU_NAME;
                    menuView.MENU_DESCRIPTION   = menu.MENU_DESCRIPTION;
                    menuView.MENU_PARENT_ID     = menu.MENU_PARENT_ID;
                    menuView.CREATED_BY         = menu.CREATED_BY;
                    menuView.CREATED_TIME       = menu.CREATED_TIME;
                    menuView.LAST_MODIFIED_BY   = menu.LAST_MODIFIED_BY;
                    menuView.LAST_MODIFIED_TIME = menu.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { menuView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #3
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_COUNTRY country     = repo.Retrieve(id);
                TOURIS_TV_COUNTRY countryView = new TOURIS_TV_COUNTRY();

                if (country != null)
                {
                    countryView.ID                  = country.ID;
                    countryView.COUNTRY_CODE        = country.COUNTRY_CODE;
                    countryView.COUNTRY_NAME        = country.COUNTRY_NAME;
                    countryView.COUNTRY_DESCRIPTION = country.COUNTRY_DESCRIPTION;
                    countryView.CREATED_BY          = country.CREATED_BY;
                    countryView.CREATED_TIME        = country.CREATED_TIME;
                    countryView.LAST_MODIFIED_BY    = country.LAST_MODIFIED_BY;
                    countryView.LAST_MODIFIED_TIME  = country.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { countryView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_SUB_CATEGORY_PHOTO subCategoryPhoto     = repo.Retrieve(id);
                TOURIS_TV_SUB_CATEGORY_PHOTO subCategoryPhotoView = new TOURIS_TV_SUB_CATEGORY_PHOTO();

                if (subCategoryPhoto != null)
                {
                    subCategoryPhotoView.ID = subCategoryPhoto.ID;
                    subCategoryPhotoView.SUB_CATEGORY_ID    = subCategoryPhoto.SUB_CATEGORY_ID;
                    subCategoryPhotoView.SUB_CATEGORY_NAME  = subCategoryPhoto.TOURIS_TM_SUB_CATEGORY.SUB_CATEGORY_NAME;
                    subCategoryPhotoView.PHOTO_NAME         = subCategoryPhoto.PHOTO_NAME;
                    subCategoryPhotoView.PHOTO_DESCRIPTION  = subCategoryPhoto.PHOTO_DESCRIPTION;
                    subCategoryPhotoView.PHOTO_PATH         = subCategoryPhoto.PHOTO_PATH;
                    subCategoryPhotoView.CREATED_BY         = subCategoryPhoto.CREATED_BY;
                    subCategoryPhotoView.CREATED_TIME       = subCategoryPhoto.CREATED_TIME;
                    subCategoryPhotoView.LAST_MODIFIED_BY   = subCategoryPhoto.LAST_MODIFIED_BY;
                    subCategoryPhotoView.LAST_MODIFIED_TIME = subCategoryPhoto.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { subCategoryPhotoView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #5
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_PROVINCE province     = repo.Retrieve(id);
                TOURIS_TV_PROVINCE provinceView = new TOURIS_TV_PROVINCE();

                if (province != null)
                {
                    provinceView.ID                   = province.ID;
                    provinceView.COUNTRY_ID           = province.COUNTRY_ID;
                    provinceView.COUNTRY_NAME         = province.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                    provinceView.PROVINCE_CODE        = province.PROVINCE_CODE;
                    provinceView.PROVINCE_NAME        = province.PROVINCE_NAME;
                    provinceView.PROVINCE_DESCRIPTION = province.PROVINCE_DESCRIPTION;
                    provinceView.CREATED_BY           = province.CREATED_BY;
                    provinceView.CREATED_TIME         = province.CREATED_TIME;
                    provinceView.LAST_MODIFIED_BY     = province.LAST_MODIFIED_BY;
                    provinceView.LAST_MODIFIED_TIME   = province.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { provinceView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_CONTACT_US contactUs     = repo.Retrieve(id);
                TOURIS_TV_CONTACT_US contactUsView = new TOURIS_TV_CONTACT_US();

                if (contactUs != null)
                {
                    contactUsView.ID                 = contactUs.ID;
                    contactUsView.NAME_SENDER        = contactUs.NAME_SENDER;
                    contactUsView.EMAIL_SENDER       = contactUs.EMAIL_SENDER;
                    contactUsView.PHONE_SENDER       = contactUs.PHONE_SENDER;
                    contactUsView.DESCRIPTION        = contactUs.DESCRIPTION;
                    contactUsView.CREATED_BY         = contactUs.CREATED_BY;
                    contactUsView.CREATED_TIME       = contactUs.CREATED_TIME;
                    contactUsView.LAST_MODIFIED_BY   = contactUs.LAST_MODIFIED_BY;
                    contactUsView.LAST_MODIFIED_TIME = contactUs.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { contactUsView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #7
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_CATEGORY category     = repo.Retrieve(id);
                TOURIS_TV_CATEGORY categoryView = new TOURIS_TV_CATEGORY();

                if (category != null)
                {
                    categoryView.ID                   = category.ID;
                    categoryView.CATEGORY_CODE        = category.CATEGORY_CODE;
                    categoryView.CATEGORY_NAME        = category.CATEGORY_NAME;
                    categoryView.CATEGORY_DESCRIPTION = category.CATEGORY_DESCRIPTION;
                    categoryView.URL                  = category.URL;
                    categoryView.CLASS                = category.CLASS;
                    categoryView.PHOTO_PATH           = category.PHOTO_PATH;
                    categoryView.CREATED_BY           = category.CREATED_BY;
                    categoryView.CREATED_TIME         = category.CREATED_TIME;
                    categoryView.LAST_MODIFIED_BY     = category.LAST_MODIFIED_BY;
                    categoryView.LAST_MODIFIED_TIME   = category.LAST_MODIFIED_TIME;

                    if (category.TOURIS_TM_SUB_CATEGORY.Count > 0)
                    {
                        foreach (var item in category.TOURIS_TM_SUB_CATEGORY)
                        {
                            TOURIS_TV_SUB_CATEGORY subCategory = new TOURIS_TV_SUB_CATEGORY();
                            subCategory.ID          = item.ID;
                            subCategory.ADDRESS     = item.ADDRESS;
                            subCategory.CATEGORY_ID = item.CATEGORY_ID;
                            subCategory.END_TIME    = item.END_TIME;
                            subCategory.START_TIME  = item.START_TIME;
                            subCategory.SUB_CATEGORY_DESCRIPTION = item.SUB_CATEGORY_DESCRIPTION;
                            subCategory.SUB_CATEGORY_NAME        = item.SUB_CATEGORY_NAME;
                            subCategory.VILLAGE_ID = item.VILLAGE_ID;
                            subCategory.PHOTO_PATH = item.PHOTO_PATH;

                            categoryView.TOURIS_TV_SUB_CATEGORY.Add(subCategory);
                        }
                    }

                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { categoryView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_SUB_CATEGORY> subCategories    = repo.GridBind();
                List <TOURIS_TV_SUB_CATEGORY> subCategoryViews = new List <TOURIS_TV_SUB_CATEGORY>();

                if (subCategories.Count > 0)
                {
                    foreach (var item in subCategories)
                    {
                        TOURIS_TV_SUB_CATEGORY subCategoryView = new TOURIS_TV_SUB_CATEGORY();
                        subCategoryView.ID                       = item.ID;
                        subCategoryView.CATEGORY_ID              = item.CATEGORY_ID;
                        subCategoryView.CATEGORY_NAME            = item.TOURIS_TM_CATEGORY.CATEGORY_NAME;
                        subCategoryView.COUNTRY_ID               = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.ID;
                        subCategoryView.COUNTRY_NAME             = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                        subCategoryView.PROVINCE_ID              = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.ID;
                        subCategoryView.PROVINCE_NAME            = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                        subCategoryView.CITY_ID                  = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.ID;
                        subCategoryView.CITY_NAME                = item.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.CITY_NAME;
                        subCategoryView.VILLAGE_ID               = item.VILLAGE_ID;
                        subCategoryView.VILLAGE_NAME             = item.TOURIS_TM_VILLAGE.VILLAGE_NAME;
                        subCategoryView.SUB_CATEGORY_NAME        = item.SUB_CATEGORY_NAME;
                        subCategoryView.SUB_CATEGORY_DESCRIPTION = item.SUB_CATEGORY_DESCRIPTION;
                        subCategoryView.ADDRESS                  = item.ADDRESS;
                        subCategoryView.START_TIME               = item.START_TIME;
                        subCategoryView.END_TIME                 = item.END_TIME;
                        subCategoryView.PHOTO_PATH               = item.PHOTO_PATH;
                        subCategoryView.LATITUDE                 = item.LATITUDE;
                        subCategoryView.LONGITUDE                = item.LONGITUDE;
                        subCategoryView.CREATED_BY               = item.CREATED_BY;
                        subCategoryView.CREATED_TIME             = item.CREATED_TIME;
                        subCategoryView.LAST_MODIFIED_BY         = item.LAST_MODIFIED_BY;
                        subCategoryView.LAST_MODIFIED_TIME       = item.LAST_MODIFIED_TIME;

                        subCategoryViews.Add(subCategoryView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { subCategoryViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_SUB_CATEGORY subCategory     = repo.Retrieve(id);
                TOURIS_TV_SUB_CATEGORY subCategoryView = new TOURIS_TV_SUB_CATEGORY();

                if (subCategory != null)
                {
                    subCategoryView.ID                       = subCategory.ID;
                    subCategoryView.CATEGORY_ID              = subCategory.CATEGORY_ID;
                    subCategoryView.CATEGORY_NAME            = subCategory.TOURIS_TM_CATEGORY.CATEGORY_NAME;
                    subCategoryView.COUNTRY_ID               = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.ID;
                    subCategoryView.COUNTRY_NAME             = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                    subCategoryView.PROVINCE_ID              = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.ID;
                    subCategoryView.PROVINCE_NAME            = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                    subCategoryView.CITY_ID                  = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.ID;
                    subCategoryView.CITY_NAME                = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.CITY_NAME;
                    subCategoryView.DISTRICT_ID              = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.ID;
                    subCategoryView.DISTRICT_NAME            = subCategory.TOURIS_TM_VILLAGE.TOURIS_TM_DISTRICT.DISTRICT_NAME;
                    subCategoryView.VILLAGE_NAME             = subCategory.TOURIS_TM_VILLAGE.VILLAGE_NAME;
                    subCategoryView.VILLAGE_ID               = subCategory.VILLAGE_ID;
                    subCategoryView.SUB_CATEGORY_NAME        = subCategory.SUB_CATEGORY_NAME;
                    subCategoryView.SUB_CATEGORY_DESCRIPTION = subCategory.SUB_CATEGORY_DESCRIPTION;
                    subCategoryView.ADDRESS                  = subCategory.ADDRESS;
                    subCategoryView.START_TIME               = subCategory.START_TIME;
                    subCategoryView.END_TIME                 = subCategory.END_TIME;
                    subCategoryView.PHOTO_PATH               = subCategory.PHOTO_PATH;
                    subCategoryView.LATITUDE                 = subCategory.LATITUDE;
                    subCategoryView.LONGITUDE                = subCategory.LONGITUDE;
                    subCategoryView.CREATED_BY               = subCategory.CREATED_BY;
                    subCategoryView.CREATED_TIME             = subCategory.CREATED_TIME;
                    subCategoryView.LAST_MODIFIED_BY         = subCategory.LAST_MODIFIED_BY;
                    subCategoryView.LAST_MODIFIED_TIME       = subCategory.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { subCategoryView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #10
0
        public IHttpActionResult ChangePassword(CUSTOM_CHANGE_PASSWORD changePassword)
        {
            ApiResData res = new ApiResData();

            try
            {
                if (!ModelState.IsValid)
                {
                    rs.SetErrorStatus(eFunc.fg.SFailed);
                    resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.DataNf, new Exception(eFunc.fg.DataIsntValid)));
                    return(Content(HttpStatusCode.NotFound, resObj));
                }

                rs = repo.ChangePassword(changePassword.IdUser, changePassword.OldPassword, changePassword.NewPassword);

                resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #11
0
        public IHttpActionResult GetVillageByDistrictId(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_VILLAGE> villages    = repo.GetVillageByDistrictId(id);
                List <TOURIS_TV_VILLAGE> vilageViews = new List <TOURIS_TV_VILLAGE>();

                if (villages.Count > 0)
                {
                    foreach (var item in villages)
                    {
                        TOURIS_TV_VILLAGE villageView = new TOURIS_TV_VILLAGE();
                        villageView.ID                  = item.ID;
                        villageView.COUNTRY_ID          = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.ID;
                        villageView.COUNTRY_NAME        = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                        villageView.PROVINCE_ID         = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.ID;
                        villageView.PROVINCE_NAME       = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                        villageView.CITY_ID             = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.ID;
                        villageView.CITY_NAME           = item.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.CITY_NAME;
                        villageView.DISTRICT_ID         = item.TOURIS_TM_DISTRICT.ID;
                        villageView.DISTRICT_NAME       = item.TOURIS_TM_DISTRICT.DISTRICT_NAME;
                        villageView.VILLAGE_NAME        = item.VILLAGE_NAME;
                        villageView.VILLAGE_DESCRIPTION = item.VILLAGE_DESCRIPTION;
                        villageView.CREATED_BY          = item.CREATED_BY;
                        villageView.CREATED_TIME        = item.CREATED_TIME;
                        villageView.LAST_MODIFIED_BY    = item.LAST_MODIFIED_BY;
                        villageView.LAST_MODIFIED_TIME  = item.LAST_MODIFIED_TIME;

                        vilageViews.Add(villageView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { vilageViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #12
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_SOSMED> sosmed      = repo.GridBind();
                List <TOURIS_TV_SOSMED> sosmedViews = new List <TOURIS_TV_SOSMED>();

                if (sosmed.Count > 0)
                {
                    foreach (var item in sosmed)
                    {
                        TOURIS_TV_SOSMED sosmedView = new TOURIS_TV_SOSMED();
                        sosmedView.ID                 = item.ID;
                        sosmedView.TYPE               = item.TYPE;
                        sosmedView.NAME               = item.NAME;
                        sosmedView.DESCRIPTION        = item.DESCRIPTION;
                        sosmedView.ICON               = item.ICON;
                        sosmedView.URL                = item.URL;
                        sosmedView.DATA_EMBED         = item.DATA_EMBED;
                        sosmedView.HEIGHT             = item.HEIGHT;
                        sosmedView.WIDTH              = item.WIDTH;
                        sosmedView.DATA_WIDGET_ID     = item.DATA_WIDGET_ID;
                        sosmedView.CREATED_BY         = item.CREATED_BY;
                        sosmedView.CREATED_TIME       = item.CREATED_TIME;
                        sosmedView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        sosmedView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        sosmedViews.Add(sosmedView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { sosmedViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #13
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_DISTRICT> districts     = repo.GridBind();
                List <TOURIS_TV_DISTRICT> districtViews = new List <TOURIS_TV_DISTRICT>();

                if (districts.Count > 0)
                {
                    foreach (var item  in districts)
                    {
                        TOURIS_TV_DISTRICT districtView = new TOURIS_TV_DISTRICT();
                        districtView.ID                   = item.ID;
                        districtView.CITY_ID              = item.CITY_ID;
                        districtView.PROVINCE_NAME        = item.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                        districtView.COUNTRY_NAME         = item.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                        districtView.CITY_NAME            = item.TOURIS_TM_CITY.CITY_NAME;
                        districtView.DISTRICT_CODE        = item.DISTRICT_CODE;
                        districtView.DISTRICT_NAME        = item.DISTRICT_NAME;
                        districtView.DISTRICT_DESCRIPTION = item.DISTRICT_DESCRIPTION;
                        districtView.CREATED_BY           = item.CREATED_BY;
                        districtView.CREATED_TIME         = item.CREATED_TIME;
                        districtView.LAST_MODIFIED_BY     = item.LAST_MODIFIED_BY;
                        districtView.LAST_MODIFIED_TIME   = item.LAST_MODIFIED_TIME;

                        districtViews.Add(districtView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { districtViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #14
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_VILLAGE village     = repo.Retrieve(id);
                TOURIS_TV_VILLAGE villageView = new TOURIS_TV_VILLAGE();

                if (village != null)
                {
                    villageView.ID                  = village.ID;
                    villageView.COUNTRY_ID          = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.ID;
                    villageView.COUNTRY_NAME        = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                    villageView.PROVINCE_ID         = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.ID;
                    villageView.PROVINCE_NAME       = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                    villageView.CITY_ID             = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.ID;
                    villageView.CITY_NAME           = village.TOURIS_TM_DISTRICT.TOURIS_TM_CITY.CITY_NAME;
                    villageView.DISTRICT_ID         = village.DISTRICT_ID;
                    villageView.DISTRICT_NAME       = village.TOURIS_TM_DISTRICT.DISTRICT_NAME;
                    villageView.VILLAGE_CODE        = village.VILLAGE_CODE;
                    villageView.VILLAGE_NAME        = village.VILLAGE_NAME;
                    villageView.VILLAGE_DESCRIPTION = village.VILLAGE_DESCRIPTION;
                    villageView.CREATED_BY          = village.CREATED_BY;
                    villageView.CREATED_TIME        = village.CREATED_TIME;
                    villageView.LAST_MODIFIED_BY    = village.LAST_MODIFIED_BY;
                    villageView.LAST_MODIFIED_TIME  = village.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { villageView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #15
0
        public IHttpActionResult GetCityByProvinceId(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_CITY> cities    = repo.GetCityByProvinceId(id);
                List <TOURIS_TV_CITY> cityViews = new List <TOURIS_TV_CITY>();

                if (cities.Count > 0)
                {
                    foreach (var item in cities)
                    {
                        TOURIS_TV_CITY cityView = new TOURIS_TV_CITY();
                        cityView.ID                 = item.ID;
                        cityView.PROVINCE_ID        = item.PROVINCE_ID;
                        cityView.PROVINCE_NAME      = item.TOURIS_TM_PROVINCE.PROVINCE_NAME;
                        cityView.COUNTRY_NAME       = item.TOURIS_TM_PROVINCE.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                        cityView.CITY_CODE          = item.CITY_CODE;
                        cityView.CITY_NAME          = item.CITY_NAME;
                        cityView.CITY_DESCRIPTION   = item.CITY_DESCRIPTION;
                        cityView.CREATED_BY         = item.CREATED_BY;
                        cityView.CREATED_TIME       = item.CREATED_TIME;
                        cityView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        cityView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        cityViews.Add(cityView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { cityViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #16
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_CATEGORY> categories    = repo.GridBind();
                List <TOURIS_TV_CATEGORY> categoryViews = new List <TOURIS_TV_CATEGORY>();

                if (categories.Count > 0)
                {
                    foreach (var item in categories)
                    {
                        TOURIS_TV_CATEGORY categoryView = new TOURIS_TV_CATEGORY();
                        categoryView.ID                   = item.ID;
                        categoryView.CATEGORY_CODE        = item.CATEGORY_CODE;
                        categoryView.CATEGORY_NAME        = item.CATEGORY_NAME;
                        categoryView.CATEGORY_DESCRIPTION = item.CATEGORY_DESCRIPTION;
                        categoryView.URL                  = item.URL;
                        categoryView.CLASS                = item.CLASS;
                        categoryView.PHOTO_PATH           = item.PHOTO_PATH;
                        categoryView.CREATED_BY           = item.CREATED_BY;
                        categoryView.CREATED_TIME         = item.CREATED_TIME;
                        categoryView.LAST_MODIFIED_BY     = item.LAST_MODIFIED_BY;
                        categoryView.LAST_MODIFIED_TIME   = item.LAST_MODIFIED_TIME;

                        categoryViews.Add(categoryView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { categoryViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #17
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_PROVINCE> countries     = repo.GridBind();
                List <TOURIS_TV_PROVINCE> provinceViews = new List <TOURIS_TV_PROVINCE>();

                if (countries.Count > 0)
                {
                    foreach (var item in countries)
                    {
                        TOURIS_TV_PROVINCE provinceView = new TOURIS_TV_PROVINCE();
                        provinceView.ID                   = item.ID;
                        provinceView.COUNTRY_ID           = item.COUNTRY_ID;
                        provinceView.COUNTRY_NAME         = item.TOURIS_TM_COUNTRY.COUNTRY_NAME;
                        provinceView.PROVINCE_CODE        = item.PROVINCE_CODE;
                        provinceView.PROVINCE_NAME        = item.PROVINCE_NAME;
                        provinceView.PROVINCE_DESCRIPTION = item.PROVINCE_DESCRIPTION;
                        provinceView.CREATED_BY           = item.CREATED_BY;
                        provinceView.CREATED_TIME         = item.CREATED_TIME;
                        provinceView.LAST_MODIFIED_BY     = item.LAST_MODIFIED_BY;
                        provinceView.LAST_MODIFIED_TIME   = item.LAST_MODIFIED_TIME;

                        provinceViews.Add(provinceView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { provinceViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #18
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_SLIDESHOW> countries      = repo.GridBind();
                List <TOURIS_TV_SLIDESHOW> slideshowViews = new List <TOURIS_TV_SLIDESHOW>();

                if (countries.Count > 0)
                {
                    foreach (var item in countries)
                    {
                        TOURIS_TV_SLIDESHOW slideshowView = new TOURIS_TV_SLIDESHOW();
                        slideshowView.ID     = item.ID;
                        slideshowView.TITTLE = item.TITTLE;
                        slideshowView.CONTENT_DESCRIPTION = item.CONTENT_DESCRIPTION;
                        slideshowView.CLASS              = item.CLASS;
                        slideshowView.PHOTO_PATH         = item.PHOTO_PATH;
                        slideshowView.URL                = item.URL;
                        slideshowView.CREATED_BY         = item.CREATED_BY;
                        slideshowView.CREATED_TIME       = item.CREATED_TIME;
                        slideshowView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        slideshowView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        slideshowViews.Add(slideshowView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { slideshowViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_SUB_CATEGORY_PHOTO> subCategoryPhotoPhotos = repo.GridBind();
                List <TOURIS_TV_SUB_CATEGORY_PHOTO> subCategoryPhotoViews  = new List <TOURIS_TV_SUB_CATEGORY_PHOTO>();

                if (subCategoryPhotoPhotos.Count > 0)
                {
                    foreach (var item in subCategoryPhotoPhotos)
                    {
                        TOURIS_TV_SUB_CATEGORY_PHOTO subCategoryPhotoView = new TOURIS_TV_SUB_CATEGORY_PHOTO();
                        subCategoryPhotoView.ID = item.ID;
                        subCategoryPhotoView.SUB_CATEGORY_ID    = item.SUB_CATEGORY_ID;
                        subCategoryPhotoView.SUB_CATEGORY_NAME  = item.TOURIS_TM_SUB_CATEGORY.SUB_CATEGORY_NAME;
                        subCategoryPhotoView.PHOTO_NAME         = item.PHOTO_NAME;
                        subCategoryPhotoView.PHOTO_DESCRIPTION  = item.PHOTO_DESCRIPTION;
                        subCategoryPhotoView.PHOTO_PATH         = item.PHOTO_PATH;
                        subCategoryPhotoView.CREATED_BY         = item.CREATED_BY;
                        subCategoryPhotoView.CREATED_TIME       = item.CREATED_TIME;
                        subCategoryPhotoView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        subCategoryPhotoView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        subCategoryPhotoViews.Add(subCategoryPhotoView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { subCategoryPhotoViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadGateway, resObj));
            }
        }
Пример #20
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_CONTACT_US> contactUses    = repo.GridBind();
                List <TOURIS_TV_CONTACT_US> contactUsViews = new List <TOURIS_TV_CONTACT_US>();

                if (contactUses.Count > 0)
                {
                    foreach (var item in contactUses)
                    {
                        TOURIS_TV_CONTACT_US contactUsView = new TOURIS_TV_CONTACT_US();
                        contactUsView.ID                 = item.ID;
                        contactUsView.NAME_SENDER        = item.NAME_SENDER;
                        contactUsView.EMAIL_SENDER       = item.EMAIL_SENDER;
                        contactUsView.PHONE_SENDER       = item.PHONE_SENDER;
                        contactUsView.DESCRIPTION        = item.DESCRIPTION;
                        contactUsView.CREATED_BY         = item.CREATED_BY;
                        contactUsView.CREATED_TIME       = item.CREATED_TIME;
                        contactUsView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        contactUsView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        contactUsViews.Add(contactUsView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { contactUsViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #21
0
        public IHttpActionResult RetrieveData(int id)
        {
            ApiResData res = new ApiResData();

            try
            {
                TOURIS_TM_SOSMED sosmed     = repo.Retrieve(id);
                TOURIS_TV_SOSMED sosmedView = new TOURIS_TV_SOSMED();

                if (sosmed != null)
                {
                    sosmedView.ID                 = sosmed.ID;
                    sosmedView.TYPE               = sosmed.TYPE;
                    sosmedView.NAME               = sosmed.NAME;
                    sosmedView.DESCRIPTION        = sosmed.DESCRIPTION;
                    sosmedView.ICON               = sosmed.ICON;
                    sosmedView.URL                = sosmed.URL;
                    sosmedView.DATA_EMBED         = sosmed.DATA_EMBED;
                    sosmedView.HEIGHT             = sosmed.HEIGHT;
                    sosmedView.WIDTH              = sosmed.WIDTH;
                    sosmedView.DATA_WIDGET_ID     = sosmed.DATA_WIDGET_ID;
                    sosmedView.CREATED_BY         = sosmed.CREATED_BY;
                    sosmedView.CREATED_TIME       = sosmed.CREATED_TIME;
                    sosmedView.LAST_MODIFIED_BY   = sosmed.LAST_MODIFIED_BY;
                    sosmedView.LAST_MODIFIED_TIME = sosmed.LAST_MODIFIED_TIME;
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { sosmedView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #22
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_MENU> menus     = repo.GridBind();
                List <TOURIS_TV_MENU> menuViews = new List <TOURIS_TV_MENU>();

                if (menus.Count > 0)
                {
                    foreach (var item in menus)
                    {
                        TOURIS_TV_MENU menuView = new TOURIS_TV_MENU();
                        menuView.ID                 = item.ID;
                        menuView.MENU_NAME          = item.MENU_NAME;
                        menuView.MENU_DESCRIPTION   = item.MENU_DESCRIPTION;
                        menuView.MENU_PARENT_ID     = item.MENU_PARENT_ID;
                        menuView.CREATED_BY         = item.CREATED_BY;
                        menuView.CREATED_TIME       = item.CREATED_TIME;
                        menuView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        menuView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        menuViews.Add(menuView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { menuViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #23
0
        public IHttpActionResult GridBind()
        {
            ApiResData res = new ApiResData();

            try
            {
                List <TOURIS_TM_USER> users     = repo.GridBind();
                List <TOURIS_TV_USER> userViews = new List <TOURIS_TV_USER>();

                if (users.Count > 0)
                {
                    foreach (var item in users)
                    {
                        TOURIS_TV_USER userView = new TOURIS_TV_USER();
                        userView.ID                 = item.ID;
                        userView.USER_ID            = item.USER_ID;
                        userView.USER_MAIL          = item.USER_MAIL;
                        userView.USER_NAME          = item.USER_NAME;
                        userView.IS_SUPER_ADMIN     = item.IS_SUPER_ADMIN;
                        userView.LAST_LOGIN         = item.LAST_LOGIN;
                        userView.PASSWORD           = item.PASSWORD;
                        userView.CREATED_BY         = item.CREATED_BY;
                        userView.CREATED_TIME       = item.CREATED_TIME;
                        userView.LAST_MODIFIED_BY   = item.LAST_MODIFIED_BY;
                        userView.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME;

                        if (item.TOURIS_TM_USER_PROFILE.Count > 0)
                        {
                            TOURIS_TV_USER_PROFILE userProfileView = new TOURIS_TV_USER_PROFILE();
                            userProfileView.ID                 = item.ID;
                            userProfileView.USER_ID_ID         = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().USER_ID_ID;
                            userProfileView.PHOTO_PATH         = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().PHOTO_PATH;
                            userProfileView.GENDER             = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().GENDER;
                            userProfileView.BORN               = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().BORN;
                            userProfileView.ADDRESS            = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().ADDRESS;
                            userProfileView.DESCRIPTION        = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().DESCRIPTION;
                            userProfileView.JOB                = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().JOB;
                            userProfileView.COMPANY            = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().COMPANY;
                            userProfileView.HOBBY              = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().HOBBY;
                            userProfileView.CREATED_BY         = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_BY;
                            userProfileView.CREATED_TIME       = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_TIME;
                            userProfileView.LAST_MODIFIED_BY   = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_BY;
                            userProfileView.LAST_MODIFIED_TIME = item.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_TIME;

                            if (item.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED.Count > 0)
                            {
                                foreach (var itemSosmed in item.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED)
                                {
                                    TOURIS_TV_USER_PROFILE_SOSMED userProfileSosmedView = new TOURIS_TV_USER_PROFILE_SOSMED();
                                    userProfileSosmedView.ID = item.ID;
                                    userProfileSosmedView.USER_PROFILE_ID    = itemSosmed.USER_PROFILE_ID;
                                    userProfileSosmedView.SOSMED_NAME        = itemSosmed.SOSMED_NAME;
                                    userProfileSosmedView.SOSMED_PATH        = itemSosmed.SOSMED_PATH;
                                    userProfileSosmedView.CREATED_BY         = itemSosmed.CREATED_BY;
                                    userProfileSosmedView.CREATED_TIME       = itemSosmed.CREATED_TIME;
                                    userProfileSosmedView.LAST_MODIFIED_BY   = itemSosmed.LAST_MODIFIED_BY;
                                    userProfileSosmedView.LAST_MODIFIED_TIME = itemSosmed.LAST_MODIFIED_TIME;

                                    userProfileView.TOURIS_TV_USER_PROFILE_SOSMED.Add(userProfileSosmedView);
                                }
                            }

                            userView.TOURIS_TV_USER_PROFILE.Add(userProfileView);
                        }

                        userViews.Add(userView);
                    }
                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { userViews }, null));
                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Пример #24
0
        public IHttpActionResult Login(CUSTOM_LOGIN login)
        {
            ApiResData res = new ApiResData();

            try
            {
                if (!ModelState.IsValid)
                {
                    rs.SetErrorStatus(eFunc.fg.SFailed);
                    resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.DataNf, new Exception(eFunc.fg.DataIsntValid)));
                    return(Content(HttpStatusCode.NotFound, resObj));
                }

                TOURIS_TM_USER user     = repo.Login(login.Email, login.Password);
                TOURIS_TV_USER userView = new TOURIS_TV_USER();

                if (user != null)
                {
                    userView.ID                 = user.ID;
                    userView.USER_ID            = user.USER_ID;
                    userView.USER_MAIL          = user.USER_MAIL;
                    userView.USER_NAME          = user.USER_NAME;
                    userView.IS_SUPER_ADMIN     = user.IS_SUPER_ADMIN;
                    userView.LAST_LOGIN         = user.LAST_LOGIN;
                    userView.PASSWORD           = user.PASSWORD;
                    userView.PHOTO_PATH         = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().PHOTO_PATH;
                    userView.GENDER             = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().GENDER;
                    userView.BORN               = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().BORN;
                    userView.ADDRESS            = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().ADDRESS;
                    userView.DESCRIPTION        = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().DESCRIPTION;
                    userView.JOB                = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().JOB;
                    userView.COMPANY            = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().COMPANY;
                    userView.HOBBY              = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().HOBBY;
                    userView.CREATED_BY         = user.CREATED_BY;
                    userView.CREATED_TIME       = user.CREATED_TIME;
                    userView.LAST_MODIFIED_BY   = user.LAST_MODIFIED_BY;
                    userView.LAST_MODIFIED_TIME = user.LAST_MODIFIED_TIME;

                    if (user.TOURIS_TM_USER_PROFILE != null)
                    {
                        TOURIS_TV_USER_PROFILE userProfileView = new TOURIS_TV_USER_PROFILE();
                        userProfileView.ID                 = user.ID;
                        userProfileView.USER_ID_ID         = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().USER_ID_ID;
                        userProfileView.PHOTO_PATH         = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().PHOTO_PATH;
                        userProfileView.GENDER             = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().GENDER;
                        userProfileView.BORN               = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().BORN;
                        userProfileView.ADDRESS            = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().ADDRESS;
                        userProfileView.DESCRIPTION        = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().DESCRIPTION;
                        userProfileView.JOB                = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().JOB;
                        userProfileView.COMPANY            = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().COMPANY;
                        userProfileView.HOBBY              = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().HOBBY;
                        userProfileView.CREATED_BY         = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_BY;
                        userProfileView.CREATED_TIME       = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().CREATED_TIME;
                        userProfileView.LAST_MODIFIED_BY   = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_BY;
                        userProfileView.LAST_MODIFIED_TIME = user.TOURIS_TM_USER_PROFILE.FirstOrDefault().LAST_MODIFIED_TIME;

                        if (user.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED.Count > 0)
                        {
                            foreach (var itemSosmed in user.TOURIS_TM_USER_PROFILE.FirstOrDefault().TOURIS_TM_USER_PROFILE_SOSMED)
                            {
                                TOURIS_TV_USER_PROFILE_SOSMED userProfileSosmedView = new TOURIS_TV_USER_PROFILE_SOSMED();
                                userProfileSosmedView.ID = user.ID;
                                userProfileSosmedView.USER_PROFILE_ID    = itemSosmed.USER_PROFILE_ID;
                                userProfileSosmedView.SOSMED_NAME        = itemSosmed.SOSMED_NAME;
                                userProfileSosmedView.SOSMED_PATH        = itemSosmed.SOSMED_PATH;
                                userProfileSosmedView.CREATED_BY         = itemSosmed.CREATED_BY;
                                userProfileSosmedView.CREATED_TIME       = itemSosmed.CREATED_TIME;
                                userProfileSosmedView.LAST_MODIFIED_BY   = itemSosmed.LAST_MODIFIED_BY;
                                userProfileSosmedView.LAST_MODIFIED_TIME = itemSosmed.LAST_MODIFIED_TIME;

                                userProfileView.TOURIS_TV_USER_PROFILE_SOSMED.Add(userProfileSosmedView);
                            }
                        }

                        userView.TOURIS_TV_USER_PROFILE.Add(userProfileView);
                    }

                    rs.SetSuccessStatus();
                }
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { userView }, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResGetDataTable(new object[] { rs }, new Exception(eFunc.fg.DataNf)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }