public async Task <IActionResult> PutNotice(int id, NoticeModel notice) { if (id != notice.Id) { return(BadRequest()); } _context.Entry(notice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoticeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(int id) { ViewBag.ActiveMenu = "admin"; var model = new NoticeModel().GetNoticeDeatails(id); return(View("..\\Notice\\Edit", model)); }
public bool Save(NoticeModel model) { using (DataProvider dp = new DataProvider()) { var entity = data.GetNotById(dp, model.Id); if (entity == null) { model.IsDel = false; model.CreateTime = DateTime.Now; dp.PM_Notice.Add(Mapper.Map <PM_Notice>(model)); } else { entity.IsEnabled = model.IsEnabled; entity.NoticeContent = model.NoticeContent; entity.NoticeType = model.NoticeType; entity.Priority = model.Priority; entity.Remarks = model.Remarks; entity.NoticeTitle = model.NoticeTitle; entity.UpdateUser = model.UpdateUser; entity.UpdateTime = DateTime.Now; } try { dp.SaveChanges(); return(true); } catch { throw; } } }
// // GET: /Home/ public ActionResult Details(int id) { NoticeContext ncc = new NoticeContext(); NoticeModel b = ncc.allNotice.Single(n => n.ID == id); return(View(b)); }
private Dictionary <int, NoticeModel> GetSqlcNotice(DataTable table) { Dictionary <int, NoticeModel> dic = new Dictionary <int, NoticeModel>(); foreach (DataRow dr in table.Rows) { NoticeModel noticemodel = new NoticeModel(); noticemodel.NoticeTitle = dr["Title"].ToString(); noticemodel.NoticeAuthor = dr["Author"].ToString(); noticemodel.NoticeID = Int32.Parse(dr["ID"].ToString()); noticemodel.NoticeContent = dr["Content"].ToString(); noticemodel.NoticeUpdateTime = ((DateTime)dr["Update_Time"]).ToString("yyyy/MM/dd HH:mm:ss.fff "); noticemodel.NoticeTime = dr["NoticeTime"].ToString(); noticemodel.NoticeType = dr["FileType"].ToString(); bool judge = bool.Parse(dr["IsFull"].ToString()); if (judge) { noticemodel.NoticeFullScreen = "1"; } else { noticemodel.NoticeFullScreen = "0"; } noticemodel.NoticeStarTime = dr["StartTime"].ToString(); noticemodel.NoticeEndTime = dr["Endtime"].ToString(); noticemodel.NoticePath = dr["FilePath"].ToString(); noticemodel.NoticeUri = dr["FileName"].ToString(); dic.Add(Int32.Parse(dr["ID"].ToString()), noticemodel); } return(dic); }
public async Task <ApiError> InsertAsync(NoticeModel model) { var checkresult = await ValidateModelAsync(model); if (!checkresult.Successful) { return(checkresult); } NoticeEntity entity = model !; try { var result = await _noticeRepository.InsertAsync(entity); if (result.Successful) { model.Id = entity.Id; } return(ApiError.FromDalResult(result)); } catch (Exception ex) { return(ApiError.FromException(ex)); } }
public IActionResult Edit(NoticeModel updatedNotice) { var noticeId = updatedNotice.Id; _commsService.Edit(noticeId, updatedNotice); return(RedirectToAction("Index")); }
/// <summary> /// 根据id获取公告信息 /// </summary> /// <param name="strNoticeId"></param> /// <returns></returns> public NoticeModel GetNoticeInfo(string strNoticeId) { NoticeModel info = null; string strSql = string.Format(@"select t.notice_id, t.image_url, t.notice_title, t.short_content, t.content, t.publish_time from BL_NOTICE t where t.notice_id=:v_notice_id and t.is_deleted = 0 and t.is_publish = 1 order by t.order_index desc, t.publish_time desc "); DataTable dt = OracleHelper.Query(strSql, (new OracleParameter(":v_notice_id", strNoticeId))); if (dt != null) { if (dt.Rows.Count > 0) { info = new NoticeModel(); info.ImageUrl = DBNull.Value == dt.Rows[0]["image_url"] ? string.Empty : dt.Rows[0]["image_url"].ToString(); info.NoticeContent = DBNull.Value == dt.Rows[0]["content"] ? string.Empty : dt.Rows[0]["content"].ToString(); info.NoticeId = DBNull.Value == dt.Rows[0]["notice_id"] ? string.Empty : dt.Rows[0]["notice_id"].ToString(); info.NoticeShortContent = DBNull.Value == dt.Rows[0]["short_content"] ? string.Empty : dt.Rows[0]["short_content"].ToString(); info.NoticeTitle = DBNull.Value == dt.Rows[0]["notice_title"] ? string.Empty : dt.Rows[0]["notice_title"].ToString(); info.PublishDate = DBNull.Value == dt.Rows[0]["publish_time"] ? string.Empty : dt.Rows[0]["publish_time"].ToString(); } } return(info); }
public ActionResult Notice(DateTime?BeginInDate, DateTime?EndInDate) { MessageCenter.Entity.QF_Message filter = new MessageCenter.Entity.QF_Message() { MasterName = "SmokeDetector", EndInDate = EndInDate, BeginInDate = BeginInDate, MsgReceiver = curentUser.AppCustomerID, MsgType = MessageCenter.Entity.MsgType.WeiXin }; if (BeginInDate == null && EndInDate == null) { filter.BeginInDate = DateTime.Now.AddDays(-30); filter.EndInDate = DateTime.Now; } if (EndInDate != null) { filter.EndInDate = EndInDate.GetValueOrDefault().AddDays(1); } List <MessageCenter.Entity.QR_Message> list = SMSProcessor.LoadMessageByMasterIDAndMasterName(filter); NoticeModel model = new NoticeModel(); model.MassageList = list; model.BeginInDate = BeginInDate; model.EndInDate = EndInDate; return(View(model)); }
public HttpResponseMessage DeleteNotice(NoticeModel aNoticeModel) { try { if (this.ModelState.IsValid) { var result = service.DeleteNotice(aNoticeModel); if (result != null) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } else { string message = "Not deleted successfully"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public async Task <IActionResult> Notices(NoticeModel noticeModel) { var result = new Result <object>(); try { foreach (var toStaffId in noticeModel.ToStaffId) { var notice = new Notices(); //notice.NoticeId = null; notice.IsRead = 0; notice.IsCompleted = 0; notice.CreatedAt = toNZTimezone(DateTime.UtcNow); notice.Notice = noticeModel.Notice; notice.FromStaffId = noticeModel.FromStaffId; notice.ToStaffId = toStaffId; await _ablemusicContext.Notices.AddAsync(notice); } await _ablemusicContext.SaveChangesAsync(); } catch (Exception ex) { result.IsSuccess = false; result.ErrorMessage = ex.Message; return(BadRequest(result)); } return(Ok(result)); }
private void setDBNotice(int userSN, string upLoadType, string sumCount) { List <Vw_UserTrack> userTrackList = UserTrackModel.getTrackerListBySN(userSN); string type = string.Empty; switch (upLoadType) { case "img": type = " 張圖片"; break; case "Doc": type = " 件文件"; break; case "Compression": type = "個壓縮檔"; break; } foreach (var item in userTrackList) { Rio_Notice notice = new Rio_Notice(); notice.AccountSN = userSN; notice.TrackSN = item.AccountSN; notice.NoticeContent = "已上傳 " + sumCount + type; notice.CreateDate = DateTime.Now; NoticeModel.Insert(notice); } }
public string GetNoticeDetailsById(int Id) { NoticeModel noticeModel = new NoticeModel(); noticeModel = _service.NoticeRepository.GetNoticeDetailsById(Id); return(JsonConvert.SerializeObject(noticeModel)); }
protected void ImageBtnSave_Click(object sender, EventArgs e) { try { IList<QueryModel> qmList = new List<QueryModel>(); qmList.Add(MakeUtil.getQueryModel("Evenid", "'", SqlWhere.WhereOperator.Equal, this.PrimaryKey)); this.lModel = _ebi.getModel(qmList); if (this.lModel.Evenid <= 0) { Script.alertMsg("没找此资料", this.Page); Script.closeDivWin(this.Page, "NoticeModify" + PrimaryKey); return; } DateTime tempHappenDate = lModel.HappenDate; this.LModel = MakeUtil.getRequestDataToModel<NoticeModel>(Request, typeof(NoticeModel), -1); if (lModel.Remarks.Trim() == "") { Script.alertMsg("查看全文内容不能为空,保存失败", Page); this.DataBind(); return; } LModel.HappenDate = tempHappenDate; _ebi.update(this.LModel); MakeUtil.addOperationNote(Request.UserHostAddress, UserId.Value.Trim(), "通知公告修改", lModel.Evenid.ToString()); Script.alertMsg("修改成功", Page); Script.scriptRedirect(Request.RawUrl, this.Page); } catch (Make.Exp.MakeException mEx) { Script.alertMsg(mEx.Message, this.Page); this.DataBind(); } }
public string NoticeDetail(dynamic _) { //接收request数据 var recdata = this.GetResquetData <NoticeInModel>(); try { #region "接口调用验证" //bool flag = DataValidation(recdata.DateTime, recdata.Random, recdata.Sign); //if (!flag) //{ // return this.WriteValidationLog("LoginModule", recdata.DeviceId); //} #endregion MessageBusiness messageBll = new MessageBusiness(); NoticeModel info = messageBll.GetNoticeInfo(recdata.data.NoticeId); if (info != null) { return(this.SendData <NoticeModel>(info, "获取公告成功", ResponseType.Success)); } else { return(this.SendData("公告为空!", ResponseType.Success)); } } catch (Exception ex) { return(this.WriteExceptionLog("LoginModule", recdata.DeviceId, recdata.DeviceId, "公告异常:" + Json.ToJson(recdata) + "[异常信息:" + ex.Message + "]", "公告异常:" + ex.Message)); } }
private DbParameter[] ExecutionSelectNotice(NoticeModel DataPar) { string WebSit = WebPath + DataPar.NoticePath; DataPar.NoticePath = DataPar.NoticePath.Substring(DataPar.NoticePath.LastIndexOf('/') + 1); DbParameter[] sqliteparList = new DbParameter[13]; sqliteparList[0] = Db_Sqlite.CreateDbParameter("@UpdateTime", DataPar.NoticeUpdateTime); sqliteparList[1] = Db_Sqlite.CreateDbParameter("@Id", DataPar.NoticeID); sqliteparList[2] = Db_Sqlite.CreateDbParameter("@Author", DataPar.NoticeAuthor); sqliteparList[3] = Db_Sqlite.CreateDbParameter("@Content", DataPar.NoticeContent); sqliteparList[4] = Db_Sqlite.CreateDbParameter("@EndTime", DataPar.NoticeEndTime); sqliteparList[5] = Db_Sqlite.CreateDbParameter("@FullScreen", DataPar.NoticeFullScreen); sqliteparList[6] = Db_Sqlite.CreateDbParameter("@Path", DataPar.NoticePath); sqliteparList[7] = Db_Sqlite.CreateDbParameter("@StartTime", DataPar.NoticeStarTime); sqliteparList[8] = Db_Sqlite.CreateDbParameter("@NoticeTime", DataPar.NoticeTime); sqliteparList[9] = Db_Sqlite.CreateDbParameter("@Title", DataPar.NoticeTitle); sqliteparList[10] = Db_Sqlite.CreateDbParameter("@Type", DataPar.NoticeType); sqliteparList[11] = Db_Sqlite.CreateDbParameter("@Used", 1); sqliteparList[12] = Db_Sqlite.CreateDbParameter("@Uri", DataPar.NoticeUri); if (DataPar.NoticePath != null && DataPar.NoticePath != string.Empty) { LoadSavePath(DataPar, WebSit); } return(sqliteparList); }
private void LoadSavePath(NoticeModel model, string WebSit) { string SavePath = string.Empty; SavePath = model.NoticePath; switch (model.NoticeType) { case "2": SavePath = LoadPath + @"\Image\" + SavePath; DownLoad(WebSit, SavePath); break; case "3": SavePath = LoadPath + @"\Video\" + SavePath; DownLoad(WebSit, SavePath); break; case "4": SavePath = LoadPath + @"\Flash\" + SavePath; DownLoad(WebSit, SavePath); break; default: break; } }
//Check Stocks Count Allowed For Notice Credit public bool CheckStockCountForNCredit(NoticeModel noticeModel) { var PortofolioStocks = unitOfWork.PortfolioTransactionsRepository.Get(filter: m => m.PortfolioID == noticeModel.PortfolioID); var Details = noticeModel.NoticeModelDetails; foreach (var detail in Details) { if (!PortofolioStocks.Any(m => m.PartnerID == detail.PartnerID)) { return(false); } else { foreach (var item in PortofolioStocks) { if (detail.PartnerID == item.PartnerID) { if (detail.StocksCredit != null) { if (detail.StocksCredit > item.CurrentStocksCount) { return(false); } } } } } } return(true); }
public HttpResponseMessage SaveNotice(NoticeModel aNoticeModel) { try { if (this.ModelState.IsValid) { var notice = service.SaveNotice(aNoticeModel); if (notice != null) { return(Request.CreateResponse(HttpStatusCode.OK, notice)); } else { string message = "Error Saving Data"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public NoticeModel GetNotByIdForShow(int id) { using (DataProvider dp = new DataProvider()) { NoticeModel model = data.GetNotByIdForShow(dp, id); return(model); } }
public NoticeModel GetModel(int id) { using (DataProvider dp = new DataProvider()) { NoticeModel model = Mapper.Map <NoticeModel>(data.GetNotById(dp, id)); return(model); } }
public ActionResult DeleteNotice(string param = "") { NoticeModel noticeModel = JsonConvert.DeserializeObject <NoticeModel>(param); long result = 0; result = _service.NoticeRepository.DeleteNoticeDetails(noticeModel); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Add() { var model = new NoticeModel { NoticeDateTime = System.DateTime.Now }; return(View(model)); }
public void Init(Canvas parent, NoticeModel model) { MessageText.text = model.Message; OkButton.onClick.AddListener(() => Hide(() => model.Callback(true))); CloseButton.onClick.AddListener(() => Hide(() => model.Callback(false))); ShowAt(parent); }
public ActionResult DeleteConfirmed(int id) { NoticeModel noticemodel = db.Notices.Find(id); db.Notices.Remove(noticemodel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult UpdateViewNoticeCustomer(string param = "") { NoticeModel noticeModel = JsonConvert.DeserializeObject <NoticeModel>(param); long result = 0; result = _service.NoticeRepository.ViewNoticeUpdateCustomer(noticeModel); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Details(int id) { if (Session["matric"] != null && Session["pass"] != null) { NoticeContext ncc = new NoticeContext(); NoticeModel b = ncc.allNotice.Single(n => n.ID == id); return(View(b)); } return(RedirectToAction("index", "Admin")); }
public ActionResult DeleteGet(NoticeModel buk) { if (Session["matric"] != null && Session["pass"] != null) { NoticeContext bcn = new NoticeContext(); bcn.Delete_Notice(buk); return(RedirectToAction("DELETEList")); } return(RedirectToAction("index", "Admin")); }
public ActionResult Article(int categoryId = -1) { Category category = CategoryManager.Get(categoryId); if (category == null || category.Article == null) { NoticeModel notice = new NoticeModel { Title = "没有找到内容", Details = "没有找到相关的内容,请浏览其它部分", DwellTime = 5, NavigationName = "网站主页", NavigationUrl = Url.Action("Index", "Home") }; return RedirectToAction("Notice", "Prompt", notice); } return View(category.Article); }
// // GET: /Notice/Edit/5 public ActionResult Edit(int id = 0) { NoticeModel noticemodel = db.Notices.Find(id); if (noticemodel == null) { return(HttpNotFound()); } return(View(noticemodel)); }
public ActionResult Edit(NoticeModel noticemodel) { if (ModelState.IsValid) { db.Entry(noticemodel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(noticemodel)); }
public object GetNoticeSimplifyList(NoticeModel notice) { if (!ModelState.IsValid) { return(operateContext.RedirectWebApi(WebResultCode.Exception, GlobalConstant.参数异常.ToString(), null)); } var data = operateContext.bllSession.T_MessageNotice.GetNoticeByType(notice, request.ApplicationPath.ToString()); return(operateContext.RedirectWebApi(WebResultCode.Ok, GlobalConstant.操作成功.ToString(), data)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IList<QueryModel> qmList = new List<QueryModel>(); qmList.Add(MakeUtil.getQueryModel("Evenid", "'", SqlWhere.WhereOperator.Equal, this.PrimaryKey)); this.lModel = _noticeEbi.getModel(qmList); if (this.lModel.Evenid <= 0) { Response.Redirect("WX_SchoolNotice.aspx"); } this.DataBind(); } }
protected void ImageBtnSave_Click(object sender, EventArgs e) { this.lModel = MakeUtil.getRequestDataToModel<NoticeModel>(Request, typeof(NoticeModel), -1); if (lModel.Remarks.Trim() == "") { Script.alertMsg("查看全文内容不能为空,保存失败", Page); this.DataBind(); return; } try { var result = ""; //判断发送 var sendNoticeToWx = MakeUtil.getStringFromRequestByName(Request, "SendNoticeToWX", -1); var classes = MakeUtil.getStringFromRequestByName(Request, "Classes", -1); var guids = MakeUtil.getStringFromRequestByName(Request, "Guids", -1); var message = MakeUtil.getStringFromRequestByName(Request, "Message", -1); var messageHead = MakeUtil.getStringFromRequestByName(Request, "MessageHead", -1); var messageFoot = MakeUtil.getStringFromRequestByName(Request, "MessageFoot", -1); var messageMan = MakeUtil.getStringFromRequestByName(Request, "MessageMan", -1); var sendMessageType = MakeUtil.getStringFromRequestByName(Request, "SendMessageType", -1); if (sendNoticeToWx == "true") { if (sendMessageType == "ToClass") { if (classes.Trim().Length == 0) { throw new Exception("请选择发送的班级"); } if (LModel.SchoolNo.Trim().Length == 0) { throw new Exception("请选择发送的学校"); } if (message.Trim().Length == 0) { throw new Exception("请选择发送的内容"); } if (messageHead.Trim().Length == 0) { throw new Exception("请选择发送的标题"); } if (messageFoot.Trim().Length == 0) { throw new Exception("请选择发送的通知人"); } } else if (sendMessageType == "ToPeople") { if (guids.Trim().Length == 0) { throw new Exception("请选择发送的对象"); } if (LModel.SchoolNo.Trim().Length == 0) { throw new Exception("请选择发送的学校"); } if (message.Trim().Length == 0) { throw new Exception("请选择发送的内容"); } if (messageHead.Trim().Length == 0) { throw new Exception("请选择发送的标题"); } if (messageFoot.Trim().Length == 0) { throw new Exception("请选择发送的通知人"); } } else { throw new Exception("未知类型"); } } lModel.HappenDate = DateTime.Now; var evenid = _noticeEbi.add(lModel); if (sendNoticeToWx == "true") { var serpath = _wxPublicPlatformEbi.getModel(null).UrlString; var url = string.Format("{0}WeiXin/NoticeShow.aspx?Evenid={1}", serpath, evenid); if (sendMessageType == "ToClass") { result = SendToClass(classes, message, messageHead, messageFoot, messageMan, LModel.SchoolNo, url); } else if (sendMessageType == "ToPeople") { result = SendToGuid(guids, message, messageHead, messageFoot, messageMan, LModel.SchoolNo, url); } } MakeUtil.addOperationNote(Request.UserHostAddress, userid.Trim(), "通知公告新增", lModel.Headlines); if (result.Length > 0) { Script.alertMsg("新增成功," + result, Page); } else { Script.alertMsg("新增成功", Page); } Script.scriptRedirect(Request.RawUrl, this.Page); } catch (Make.Exp.MakeException mEx) { Script.alertMsg(mEx.Message, this.Page); this.DataBind(); } catch (Exception mEx) { Script.alertMsg(mEx.Message, this.Page); this.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IList<QueryModel> qmList = new List<QueryModel>(); qmList.Add(MakeUtil.getQueryModel("Evenid", "'", SqlWhere.WhereOperator.Equal, this.PrimaryKey)); this.lModel = _ebi.getModel(qmList); if (this.lModel.Evenid <= 0) { Script.alertMsg("没找此资料", this.Page); Script.closeDivWin(this.Page, "NoticeModify" + PrimaryKey); return; } Remarks.Text = lModel.Remarks; this.DataBind(); } }