Exemplo n.º 1
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.º 2
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.º 3
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.º 4
0
        public ResultStatus ChangePassword(int id, string oldPassword, string newPassword)
        {
            ResultStatus rs = new ResultStatus();

            try
            {
                SBH_TM_USER_ADMIN user = _ctx.SBH_TM_USER_ADMIN.Find(id);

                if (user.PASSWORD == oldPassword)
                {
                    user.LAST_MODIFIED_TIME = DateTime.Now;
                    user.LAST_MODIFIED_BY   = user.USER_NAME;
                    user.PASSWORD           = newPassword;

                    _ctx.Entry(user).State = EntityState.Modified;
                    _ctx.SaveChanges();
                    rs.SetSuccessStatus("Change password has been success");
                }
                else if (user.PASSWORD == newPassword)
                {
                    rs.SetErrorStatus("New password can not be same old password");
                }
                else
                {
                    rs.SetErrorStatus("Old password is not match");
                }
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
            }

            return(rs);
        }
Exemplo n.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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"));
        }
Exemplo n.º 11
0
        public ActionResult ActionEdit(TOURIS_TV_USER userView, HttpPostedFileBase postedFile)
        {
            try
            {
                string physicalPath = "";
                TOURIS_TV_USER_PROFILE userProfileView = new TOURIS_TV_USER_PROFILE();

                if (postedFile != null)
                {
                    string ImageName = System.IO.Path.GetFileName(postedFile.FileName); //file2 to store path and url
                    physicalPath = Server.MapPath("~" + Common.GetPathFolderImg() + ImageName);

                    userView.PHOTO_PATH        = Common.GetPathFolderImg() + ImageName;
                    userProfileView.PHOTO_PATH = userView.PHOTO_PATH;
                }

                userView.LAST_MODIFIED_BY   = CurrentUser.GetCurrentUserId();
                userView.LAST_MODIFIED_TIME = CurrentUser.GetCurrentDateTime();

                userProfileView.GENDER      = userView.GENDER;
                userProfileView.BORN        = userView.BORN;
                userProfileView.ADDRESS     = userView.ADDRESS;
                userProfileView.DESCRIPTION = userView.DESCRIPTION;
                userProfileView.JOB         = userView.JOB;
                userProfileView.COMPANY     = userView.COMPANY;
                userProfileView.HOBBY       = userView.HOBBY;

                userView.TOURIS_TV_USER_PROFILE.Add(userProfileView);

                rs = JsonConvert.DeserializeObject <ResultStatus>(ParsingObject.RequestData(userView, "User", "Edit", EnumList.IHttpMethod.Post.ToString()));
                if (rs.IsSuccess)
                {
                    if (physicalPath != "")
                    {
                        postedFile.SaveAs(physicalPath);
                    }
                    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"));
        }
        public IHttpActionResult Add(TOURIS_TV_SUB_CATEGORY subCategoryView)
        {
            ApiResData res = new ApiResData();

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

                TOURIS_TM_SUB_CATEGORY subCategory = new TOURIS_TM_SUB_CATEGORY();
                subCategory.CATEGORY_ID              = subCategoryView.CATEGORY_ID;
                subCategory.VILLAGE_ID               = subCategoryView.VILLAGE_ID;
                subCategory.SUB_CATEGORY_NAME        = subCategoryView.SUB_CATEGORY_NAME;
                subCategory.SUB_CATEGORY_DESCRIPTION = subCategoryView.SUB_CATEGORY_DESCRIPTION;
                subCategory.START_TIME               = subCategoryView.START_TIME;
                subCategory.END_TIME     = subCategoryView.END_TIME;
                subCategory.PHOTO_PATH   = subCategoryView.PHOTO_PATH;
                subCategory.ADDRESS      = subCategoryView.ADDRESS;
                subCategory.LATITUDE     = subCategoryView.LATITUDE;
                subCategory.LONGITUDE    = subCategoryView.LONGITUDE;
                subCategory.CREATED_BY   = subCategoryView.CREATED_BY;
                subCategory.CREATED_TIME = subCategoryView.CREATED_TIME;
                subCategory.ROW_STATUS   = eStat.fg.IsActive;

                rs = repo.Add(subCategory);
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus();
                }
                else
                {
                    rs.SetErrorStatus(eFunc.fg.SFailed);
                }

                resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Exemplo n.º 13
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.º 14
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.º 15
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.º 16
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.º 17
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.º 18
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.º 19
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.º 20
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.º 21
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.º 22
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.º 23
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.º 24
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.º 25
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.º 26
0
        public IHttpActionResult Add(TOURIS_TV_SOSMED sosmedView)
        {
            ApiResData res = new ApiResData();

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

                TOURIS_TM_SOSMED sosmed = new TOURIS_TM_SOSMED();
                sosmed.TYPE           = sosmedView.TYPE;
                sosmed.NAME           = sosmedView.NAME;
                sosmed.DESCRIPTION    = sosmedView.DESCRIPTION;
                sosmed.ICON           = sosmedView.ICON;
                sosmed.URL            = sosmedView.URL;
                sosmed.DATA_EMBED     = sosmedView.DATA_EMBED;
                sosmed.HEIGHT         = sosmedView.HEIGHT;
                sosmed.WIDTH          = sosmedView.WIDTH;
                sosmed.DATA_WIDGET_ID = sosmedView.DATA_WIDGET_ID;
                sosmed.CREATED_BY     = sosmedView.CREATED_BY;
                sosmed.CREATED_TIME   = sosmedView.CREATED_TIME;
                sosmed.ROW_STATUS     = eStat.fg.IsActive;

                rs = repo.Add(sosmed);
                if (rs.IsSuccess)
                {
                    rs.SetSuccessStatus();
                }
                else
                {
                    rs.SetErrorStatus(eFunc.fg.SFailed);
                }

                resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null));

                return(Content(HttpStatusCode.OK, resObj));
            }
            catch (Exception ex)
            {
                rs.SetErrorStatus(ex.Message);
                resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed)));
                return(Content(HttpStatusCode.BadRequest, resObj));
            }
        }
Exemplo n.º 27
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.º 28
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.º 29
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.º 30
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));
        }