Exemplo n.º 1
0
        private ResultStatus AddBooking(GEMA_TR_BOOKING booking, ref int booking_id)
        {
            _ctx.GEMA_TR_BOOKING.Add(booking);
            _ctx.SaveChanges();

            booking_id = _ctx.GEMA_TR_BOOKING.Where(x => x.TR_NUMBER == booking.TR_NUMBER).FirstOrDefault().ID;
            rs.SetSuccessStatus();

            return(rs);
        }
        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));
            }
        }
Exemplo n.º 3
0
        public ResultStatus Add(TOURIS_TM_SUB_CATEGORY_PHOTO subCategoryPhoto)
        {
            try
            {
                _ctx.TOURIS_TM_SUB_CATEGORY_PHOTO.Add(subCategoryPhoto);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 4
0
        public ResultStatus Add(SBH_TM_NEWS news)
        {
            try
            {
                _ctx.SBH_TM_NEWS.Add(news);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 5
0
        public ResultStatus Add(GEMA_TM_CATEGORY category)
        {
            try
            {
                _ctx.GEMA_TM_CATEGORY.Add(category);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 6
0
        public ResultStatus Add(SBH_TM_GALERY_FOTO galery)
        {
            try
            {
                _ctx.SBH_TM_GALERY_FOTO.Add(galery);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 7
0
        public ResultStatus Add(TOURIS_TM_MENU menu)
        {
            try
            {
                _ctx.TOURIS_TM_MENU.Add(menu);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 8
0
        public ResultStatus Add(TOURIS_TM_CONTACT_US contactUs)
        {
            try
            {
                _ctx.TOURIS_TM_CONTACT_US.Add(contactUs);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 9
0
        public ResultStatus Add(GEMA_TM_SLIDESHOW slideshow)
        {
            try
            {
                _ctx.GEMA_TM_SLIDESHOW.Add(slideshow);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 10
0
        public ResultStatus Add(TOURIS_TM_COUNTRY country)
        {
            try
            {
                _ctx.TOURIS_TM_COUNTRY.Add(country);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 11
0
        public ResultStatus Add(TOURIS_TM_VILLAGE village)
        {
            try
            {
                _ctx.TOURIS_TM_VILLAGE.Add(village);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 12
0
        public ResultStatus Add(GEMA_TM_PRICEL_LIST priceList)
        {
            try
            {
                _ctx.GEMA_TM_PRICEL_LIST.Add(priceList);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 13
0
        public ResultStatus Add(TOURIS_TM_DISTRICT district)
        {
            try
            {
                _ctx.TOURIS_TM_DISTRICT.Add(district);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 14
0
        public ResultStatus Add(TOURIS_TM_PROVINCE province)
        {
            try
            {
                _ctx.TOURIS_TM_PROVINCE.Add(province);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 15
0
        public ResultStatus Add(TOURIS_TM_SOSMED sosmed)
        {
            try
            {
                _ctx.TOURIS_TM_SOSMED.Add(sosmed);
                _ctx.SaveChanges();
                rs.SetSuccessStatus();
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 16
0
        public IHttpActionResult Delete(int id)
        {
            ApiResData res = new ApiResData();

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

                rs = repo.Delete(id, "System", CurrentUser.GetCurrentDateTime());
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus();
                }
                else
                {
                    rs.SetErrorStatus(eFunc.fg.SFailed);
                }

                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.ResCUD(new object[] { rs }, eFunc.fg.Delete, new Exception(eFunc.fg.DFailed)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Exemplo n.º 17
0
        public ActionResult ActionDelete(int id)
        {
            try
            {
                rs = repo.Delete(id, Session["UserId"].ToString(), DateTime.Now);
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been deleted successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to deleted");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to deleted");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 18
0
        public ApiGridResponse EditDataUser(TOURIS_TV_USER userView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    TOURIS_TM_USER user = tourisdb.TOURIS_TM_USER.Find(userView.ID);
                    user.USER_NAME          = userView.USER_NAME;
                    user.USER_MAIL          = userView.USER_MAIL;
                    user.LAST_MODIFIED_BY   = userView.LAST_MODIFIED_BY;
                    user.LAST_MODIFIED_TIME = userView.LAST_MODIFIED_TIME;

                    tourisdb.Entry(user).State = EntityState.Modified;
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                res = ResGetDataTable(null, ex);
            }

            return(res);
        }
Exemplo n.º 19
0
        public ActionResult ActionDelete(int id)
        {
            try
            {
                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.RequestData(id, "City", "Delete", EnumList.IHttpMethod.Put.ToString()));
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been deleted successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to deleted");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to deleted");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 20
0
        public ActionResult ActionEdit(SBH_TM_GALERY_FOTO galeryView, HttpPostedFileBase postedFile)
        {
            try
            {
                string encodedString = Server.HtmlEncode(galeryView.DESCRIPTION);
                galeryView.DESCRIPTION = encodedString;

                galeryView.LAST_MODIFIED_BY   = Session["UserId"].ToString();
                galeryView.LAST_MODIFIED_TIME = DateTime.Now;

                rs = repo.Edit(galeryView);
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been edited successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to edited");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to edited");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 21
0
        public ActionResult CreateChatMessage(int senderId, int receiverId, string message)
        {
            SqlConnection conn  = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
            DateTime      date  = DateTime.Now;
            string        date3 = date.ToString("yyyy-MM-dd");
            string        time  = date.ToString("HH:mm:ss");

            try
            {
                conn.Open();
                string     query = "insert into SBH_TM_CHATBOX values('" + senderId + "','" + receiverId + "','" + message + "','" + date3 + "','" + time + "')";
                SqlCommand cmd   = new SqlCommand(query, conn);
                int        i     = cmd.ExecuteNonQuery();
                conn.Close();
                if (i >= 1)
                {
                    rs.SetSuccessStatus();
                }
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                conn.Close();
            }


            return(Json(rs, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 22
0
        public ActionResult ActionEdit(TOURIS_TV_COUNTRY countryView)
        {
            ResultStatus rs = new ResultStatus();

            try
            {
                countryView.LAST_MODIFIED_BY   = CurrentUser.GetCurrentUserId();
                countryView.LAST_MODIFIED_TIME = CurrentUser.GetCurrentDateTime();

                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.JsonData(countryView, "Country", "EditObjCountry"));
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been edited successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to edited");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to edited");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 23
0
        public ActionResult ActionDelete(TOURIS_TV_COUNTRY countryView)
        {
            ResultStatus rs = new ResultStatus();

            try
            {
                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.JsonData(countryView, "Country", "DeleteObjCountry"));
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been deleted successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to deleted");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to deleted");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 24
0
        public ApiGridResponse DeleteDataCountry(TOURIS_TV_COUNTRY countryView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    TOURIS_TM_COUNTRY country = tourisdb.TOURIS_TM_COUNTRY.Find(countryView.ID);

                    tourisdb.TOURIS_TM_COUNTRY.Remove(country);
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                res = ResGetDataTable(new object[] { rs }, ex);
            }

            return(res);
        }
Exemplo n.º 25
0
        public ApiGridResponse InsertDataUser(TOURIS_TV_USER userView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                TOURIS_TM_USER user = new TOURIS_TM_USER();
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    user.USER_NAME    = userView.USER_NAME;
                    user.USER_MAIL    = userView.USER_MAIL;
                    user.CREATED_BY   = userView.CREATED_BY;
                    user.CREATED_TIME = userView.CREATED_TIME;

                    tourisdb.TOURIS_TM_USER.Add(user);
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                res = ResGetDataTable(null, ex);
            }

            return(res);
        }
Exemplo n.º 26
0
        public ApiGridResponse InsertDataCountry(TOURIS_TV_COUNTRY countryView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                TOURIS_TM_COUNTRY country = new TOURIS_TM_COUNTRY();
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    country.COUNTRY_CODE        = countryView.COUNTRY_CODE;
                    country.COUNTRY_NAME        = countryView.COUNTRY_NAME;
                    country.COUNTRY_DESCRIPTION = countryView.COUNTRY_DESCRIPTION;
                    country.CREATED_BY          = countryView.CREATED_BY;
                    country.CREATED_TIME        = countryView.CREATED_TIME;

                    tourisdb.TOURIS_TM_COUNTRY.Add(country);
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                res = ResGetDataTable(new object[] { rs }, ex);
            }

            return(res);
        }
Exemplo n.º 27
0
        public ActionResult ActionCreate(SBH_TM_GALERY_FOTO galeryView)
        {
            string a = Request.Form["storeImage"];

            try
            {
                string encodedString = Server.HtmlEncode(galeryView.DESCRIPTION);
                galeryView.DESCRIPTION  = encodedString;
                galeryView.USER_ID      = (int)Session["Id"];
                galeryView.CREATED_BY   = Session["UserId"].ToString();
                galeryView.CREATED_TIME = DateTime.Now;
                List <string> lString = CData.GetListString;

                rs = repo.AddAll(galeryView, lString);
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been created successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                    CData.CleanDataString();
                }
                else
                {
                    rs.SetErrorStatus("Data failed to created");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to created");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 28
0
        public ApiGridResponse EditDataCountry(TOURIS_TV_COUNTRY countryView)
        {
            ApiGridResponse res = new ApiGridResponse();
            ResultStatus    rs  = new ResultStatus();

            try
            {
                using (TourismpediaEntities tourisdb = new TourismpediaEntities())
                {
                    TOURIS_TM_COUNTRY country = tourisdb.TOURIS_TM_COUNTRY.Find(countryView.ID);
                    country.COUNTRY_CODE        = countryView.COUNTRY_CODE;
                    country.COUNTRY_NAME        = countryView.COUNTRY_NAME;
                    country.COUNTRY_DESCRIPTION = countryView.COUNTRY_DESCRIPTION;
                    country.LAST_MODIFIED_BY    = countryView.LAST_MODIFIED_BY;
                    country.LAST_MODIFIED_TIME  = countryView.LAST_MODIFIED_TIME;

                    tourisdb.Entry(country).State = EntityState.Modified;
                    tourisdb.SaveChanges();
                    rs.SetSuccessStatus();
                }
                res = ResGetDataTable(new object[] { rs }, null);
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                res = ResGetDataTable(new object[] { rs }, ex);
            }

            return(res);
        }
Exemplo n.º 29
0
        public ActionResult ActionEdit(TOURIS_TV_CITY cityView)
        {
            try
            {
                cityView.LAST_MODIFIED_BY   = CurrentUser.GetCurrentUserId();
                cityView.LAST_MODIFIED_TIME = CurrentUser.GetCurrentDateTime();

                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.RequestData(cityView, "City", "Edit", EnumList.IHttpMethod.Post.ToString()));
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been edited successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to edited");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to edited");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 30
0
        public ActionResult ActionCreate(TOURIS_TV_MENU menuView)
        {
            try
            {
                menuView.CREATED_BY   = CurrentUser.GetCurrentUserId();
                menuView.CREATED_TIME = CurrentUser.GetCurrentDateTime();

                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.RequestData(menuView, "Menu", "Add", EnumList.IHttpMethod.Post.ToString()));
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus("Data has been created successfully");
                    TempData["msgSuccess"] = rs.MessageText;
                }
                else
                {
                    rs.SetErrorStatus("Data failed to created");
                    TempData["msgError"] = rs.MessageText;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                rs.SetErrorStatus("Data failed to created");
                TempData["msgError"] = rs.MessageText;
            }

            return(RedirectToAction("Index"));
        }