public static string GetObjectName(string code) { string text2; try { string text = ""; if (code == "") { return(text); } EntityData remindObjectByCode = RemindDAO.GetRemindObjectByCode(code); if (remindObjectByCode.HasRecord()) { text = remindObjectByCode.GetString("ObjectName"); } remindObjectByCode.Dispose(); text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
/// <summary> /// 增加新的提醒到提醒表 /// </summary> public static void SaveNewRemind(string strType, string strMasterCode, string strUser, string strMessage, DateTime StartDate, DateTime EndDate) { // 检查当前MasterCode当前用户是否有重复,如果有则更新 EntityData entity = RemindDAO.GetRemindObjectByMasterUser(strType, strMasterCode, strUser); if (entity.HasRecord()) { DataTable dt = entity.CurrentTable; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["CreateDate"] = StartDate; dt.Rows[i]["EndDate"] = EndDate; } RemindDAO.UpdateRemindObject(entity); } else { EntityData entityRemind = new EntityData("RemindObject"); DataRow drRemind = entityRemind.GetNewRecord(); drRemind["RemindObjectCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("RemindObject"); drRemind["Type"] = strType; drRemind["User"] = strUser; drRemind["MasterCode"] = strMasterCode; drRemind["Message"] = strMessage; drRemind["CreateDate"] = StartDate; drRemind["EndDate"] = EndDate; drRemind["IsDesk"] = "1"; // 默认桌面显示 entityRemind.AddNewRecord(drRemind); RemindDAO.InsertRemindObject(entityRemind); entityRemind.Dispose(); } entity.Dispose(); }
/// <summary> /// 载入数据 /// </summary> private void LoadData() { string strIsAll = "0"; EntityData entityNotice = RemindDAO.GetNoticeByCode(strNoticeCode); if (entityNotice.HasRecord()) { if (entityNotice.GetInt("status").ToString() != "0") { if (entityNotice.GetInt("Type") == 99) { trNotice.Visible = false; } this.lblNoticeClass.Text = Server.HtmlEncode(entityNotice.GetString("NoticeClass"));//新加通知类型(测试正确删除此注释) this.lblTitle.Text = Server.HtmlEncode(entityNotice.GetString("Title")); this.lbSubmitname.Text = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("SubmitPerson").ToString()).ToString(); this.lblSubmitDate.Text = entityNotice.GetDateTimeOnlyDate("SubmitDate"); this.divContent.InnerHtml = entityNotice.GetString("Content").Replace("\n", "<br>").Replace("\r", " "); strIsAll = entityNotice.GetString("IsAll"); //待修改 this.lbLastUpdate.Text = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("UserCode").ToString()).ToString() + " 于 " + entityNotice.GetDateTimeOnlyDate("UpdateDate") + "修改"; } else { Response.Write(JavaScript.ScriptStart); Response.Write("window.alert('通知已删除');"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); } } if (strIsAll == "0") { string strUsers = ""; string strUserNames = ""; string strStations = ""; string strStationNames = ""; BLL.ResourceRule.GetAccessRange(this.strNoticeCode, "0801", "080104", ref strUsers, ref strUserNames, ref strStations, ref strStationNames); this.lblUser.Text = strUserNames + "," + strStationNames; this.lblUser.Text = BLL.StringRule.CutRepeat(this.lblUser.Text); } else { this.lblUser.Text = "全体人员"; } //记录该用户已经读了该信息 User u = (User)Session["User"]; string strSelect = "select * from UserLookedNotice where noticecode='" + strNoticeCode + "' and usercode='" + u.UserCode + "'"; string strInsert = "insert into UserLookedNotice (noticecode,usercode) values ('" + strNoticeCode + "','" + u.UserCode + "')"; string strDelete = "Delete from UserLookedNotice where noticecode='" + strNoticeCode + "' and usercode='" + u.UserCode + "'"; QueryAgent qa = new QueryAgent(); DataSet ds = qa.ExecSqlForDataSet(strSelect); if (ds.Tables[0].Rows.Count <= 0) { qa.ExecuteSql(strInsert); } qa.Dispose(); entityNotice.Dispose(); }
public void LoadDate() { string strIsAll = "0"; int strType = 0; EntityData entityNotice = RemindDAO.GetNoticeByCode(strNoticeCode); if (entityNotice.HasRecord()) { if (entityNotice.GetInt("status").ToString() != "0") { strType = entityNotice.GetInt("Type"); if (strType == 99) { this.trNotice.Visible = false; } this.DDLNoticeClass.Value = Server.HtmlEncode(entityNotice.GetString("NoticeClass")); this.txtTitle.Value = Server.HtmlEncode(entityNotice.GetString("Title")); this.lbSubmitname.Text = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("SubmitPerson").ToString()).ToString(); this.lblSubmitDate.Text = entityNotice.GetDateTimeOnlyDate("SubmitDate"); this.taContent.Value = StringRule.FormartOutput(entityNotice.GetString("Content")); strIsAll = entityNotice.GetString("IsAll"); this.lbLastUpdate.Text = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("UserCode").ToString()).ToString() + " 于 " + entityNotice.GetDateTimeOnlyDate("UpdateDate") + "修改"; } else { Response.Write(JavaScript.ScriptStart); Response.Write("window.alert('通知已删除');"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); } } if (strIsAll == "0") //部分人员 { string strUsers = ""; string strUserNames = ""; string strStations = ""; string strStationNames = ""; RmsPM.BLL.ResourceRule.GetAccessRange(this.strNoticeCode, "0801", "080104", ref strUsers, ref strUserNames, ref strStations, ref strStationNames); this.txtUsers.Value = RmsPM.BLL.StringRule.CutRepeat(strUsers); this.SelectName.InnerText = RmsPM.BLL.StringRule.CutRepeat(strUserNames); this.txtStations.Value = RmsPM.BLL.StringRule.CutRepeat(strStations); this.SelectName.InnerText += "," + RmsPM.BLL.StringRule.CutRepeat(strStationNames); } else { this.txtUsers.Value = this.GetAllUser(); this.SelectName.InnerText = "全体人员"; } entityNotice.Dispose(); // this.lblTitle.Text = "修改通知"; //EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); //this.txtTitle.Value = System.Web.HttpUtility.HtmlEncode(entityNotice.GetString("Title")); //this.taContent.Value = StringRule.FormartOutput(entityNotice.GetString("Content")); //this.LoadUser(entityNotice.GetString("IsAll")); }
private void InitPage() { EntityData entityRemind = RemindDAO.GetRemindStrategyByProjectCode(Session["ProjectCode"].ToString()); DisposeRemind(entityRemind); this.dgRemindList.DataSource = entityRemind.CurrentTable; this.dgRemindList.DataBind(); this.trNoRemind.Visible = entityRemind.CurrentTable.Rows.Count > 0?false:true; entityRemind.Dispose(); }
public static string GetNoticeName(string Code) { EntityData noticeByCode = RemindDAO.GetNoticeByCode(Code); if (!noticeByCode.HasRecord()) { return(""); } return(noticeByCode.GetString("Title")); }
private void InitPage() { User objUser = (User)Session["User"]; //通知 EntityData entityNotice = RemindDAO.GetNoticeUserByUserCode(objUser.UserCode); if (entityNotice.HasRecord()) { HtmlTable m_Table = this.tbNotice; HtmlTableRow m_Row; HtmlTableCell m_Cell; foreach (DataRow dr in entityNotice.CurrentTable.Rows) { m_Row = new HtmlTableRow(); m_Cell = new HtmlTableCell(); if (BLL.NoticeRule.GetFieldName(dr["NoticeCode"].ToString(), "Type") != "1") { m_Cell.InnerHtml = "<a href='#' onclick ='OpenNotice(" + dr["NoticeCode"].ToString() + ");return false;'>" + BLL.NoticeRule.GetNoticeName(dr["NoticeCode"].ToString()) + "</a>"; } else { m_Cell.InnerHtml = "<a href='#' onclick =OpenTask('" + BLL.NoticeRule.GetFieldName(dr["NoticeCode"].ToString(), "RelatedHref") + "');return false;>" + BLL.NoticeRule.GetNoticeName(dr["NoticeCode"].ToString()) + "</a>"; } m_Row.Cells.Add(m_Cell); m_Table.Rows.Add(m_Row); } } entityNotice.Dispose(); // EntityData entity = RemindDAO.GetAllRemindStrategy(); // // if (entity.HasRecord()) // { // foreach(DataRow dr in entity.CurrentTable.Rows) // { // //获取所有超期工作 // if (ds.Tables[0].Rows.Count > 0) // { // DataTable dt = DisposeTask(ds.Tables[0]); // string m_Condition = ""; // m_Condition = " ((Status = 0 and PlannedStartDate <'" + DateTime.Now.ToShortDateString() + "')"; // m_Condition += " or (Status <> 4 and PlannedFinishDate >'" + DateTime.Now.ToShortDateString() + "'))"; // DateView dv = new DataView(dt,m_Condition,"",DataViewRowState.CurrentRows); // } // // // } // break; // } //EntityData entityNotice = RemindDAO.GetAllNotice(); }
public static void ViewRemindUpDate(string type, string masterCode, string userCode) { EntityData entity = RemindDAO.GetRemindObjectByMasterUser(type, masterCode, userCode); if (entity.HasRecord()) { entity.CurrentRow["IsDesk"] = "0"; RemindDAO.UpdateRemindObject(entity); } entity.Dispose(); }
private void dgRemindList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { string strKey = this.dgRemindList.DataKeys[(int)e.Item.ItemIndex].ToString(); EntityData entity = RemindDAO.GetRemindObjectByCode(strKey); RemindDAO.DeleteRemindObject(entity); entity.Dispose(); this.LoadData(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "获取提醒列表失败"); } }
private void dgRemindList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { string strCode = this.dgRemindList.DataKeys[(int)e.Item.ItemIndex].ToString(); EntityData entity = RemindDAO.GetRemindStrategyByCode(strCode); RemindDAO.DeleteRemindStrategy(entity); this.InitPage(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "删除提醒信息失败!"); } }
protected void btDelete_ServerClick(object sender, System.EventArgs e) { //删除通知 EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); DataRow dr; if (entityNotice.HasRecord()) { dr = entityNotice.CurrentRow; // dr["NoticeCode"] = this.strNoticeCode; //dr["Title"] = this.lblTitle.Text.Trim(); //dr["EnableDate"] = this.dtbShowDate.Value; //dr["SubmitPerson"] = base.user.UserCode; // dr["SubmitDate"] = DateTime.Now.ToShortDateString(); //dr["Content"] = this.lblContent.Text; // 保存资源,保存权限 //string strUser = this.lblUser.Text.Trim(); //string strStation = this.lb.Value.Trim(); // 没有选择人员则向全体发布 //if (strUser.Trim() == "全体人员") //{ // //strUser = this.GetAllUser(); // dr["IsAll"] = "1"; //} //else //{ // dr["IsAll"] = "0"; //} dr["status"] = "0"; //ArrayList arOperator = new ArrayList(); //this.SaveRS(arOperator, RmsPM.BLL.StringRule.CutRepeat(strUser), RmsPM.BLL.StringRule.CutRepeat(strStation), "080104"); // 一般通知查看权限 //this.SaveRS(arOperator, base.user.UserCode, "", "080102,080103,080104"); // 修改和删除 //if (arOperator.Count > 0) // RmsPM.BLL.ResourceRule.SetResourceAccessRange(this.strNoticeCode, "0801", "", arOperator, false); } RemindDAO.UpdateNotice(entityNotice); entityNotice.Dispose(); Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.refresh();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); }
public static string GetFieldName(string Code, string FieldName) { string text2; try { string text = ""; if (Code == "") { return(text); } EntityData remindObjectByCode = RemindDAO.GetRemindObjectByCode(Code); if (remindObjectByCode.HasRecord() && remindObjectByCode.CurrentTable.Columns.Contains(FieldName)) { if (remindObjectByCode.CurrentTable.Columns[FieldName].DataType == Type.GetType("System.Int32")) { return(remindObjectByCode.GetIntString(FieldName)); } if (remindObjectByCode.CurrentTable.Columns[FieldName].DataType == Type.GetType("System.Decimal")) { return(remindObjectByCode.GetDecimalString(FieldName)); } if (remindObjectByCode.CurrentTable.Columns[FieldName].DataType == Type.GetType("System.DateTime")) { return(remindObjectByCode.GetDateTimeOnlyDate(FieldName)); } if (remindObjectByCode.CurrentTable.Columns[FieldName].DataType == Type.GetType("System.String")) { return(remindObjectByCode.GetString(FieldName)); } } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
private void LoadData() { //对通知标题的个性化判断 if (this.up_sPMNameLower != "tianyangoa") { this.trNotice.Visible = false; } else { if (Request["DocType"].ToString() == "99") { this.trNotice.Visible = false; } else { this.trNotice.Visible = true; } PageFacade.LoadDictionarySelect(this.DDLNoticeClass, "通知类型", "");//通知类别改成通知类型 } switch (strAction.ToUpper()) { case "INSERT": this.lblTitle.Text = "新增公告"; this.htType.Value = Request["DocType"].ToString(); break; case "MODIFY": //标题 this.lblTitle.Text = "修改公告"; EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); this.DDLNoticeClass.Value = System.Web.HttpUtility.HtmlEncode(entityNotice.GetString("NoticeClass")); //测试新增代码 this.txtTitle.Value = System.Web.HttpUtility.HtmlEncode(entityNotice.GetString("Title")); this.taContent.Value = StringRule.FormartOutput(entityNotice.GetString("Content")); //this.htType.Value = entityNotice.GetString("Type"); this.LoadUser(entityNotice.GetString("IsAll")); break; } }
public void SendMsgToUser(int meetCode) { ConferenceManageBFL ebfl = new ConferenceManageBFL(); ConferenceManageModel conferenceManage = new ConferenceManageModel(); conferenceManage = ebfl.GetConferenceManage(meetCode); string strUser = conferenceManage.ChaterMember; string text2 = string.Format("{0} 会议", conferenceManage.Topic); string text3 = string.Format("主办单位: <b>{0}</b>\r\n会议地点: <b>{1}</b>\r\n会议时间:<b>{2}</b>\r\n<a href='../RmsOA/XZ_Conference.aspx?Type=Read&Code={3}'>详细内容</a>\r\n<a href='../RmsOA/XZ_ConferenceWeek.aspx'>本周会议</a>", new object[] { conferenceManage.Dept, conferenceManage.Place, conferenceManage.StartTime, meetCode.ToString() }); DateTime now = DateTime.Now; string code = SystemManageDAO.GetNewSysCode("Notice"); EntityData entity = new EntityData("Standard_Notice"); DataRow newRecord = entity.GetNewRecord(); newRecord["NoticeCode"] = code; newRecord["Title"] = text2; newRecord["SubmitPerson"] = strUser; newRecord["SubmitDate"] = DateTime.Now; newRecord["UpdateDate"] = DateTime.Now; newRecord["UserCode"] = strUser; newRecord["Content"] = text3; newRecord["Type"] = "1"; newRecord["IsAll"] = "0"; newRecord["status"] = "1"; entity.AddNewRecord(newRecord); string strTmp = this.UserListString(meetCode); ArrayList arOperator = new ArrayList(); this.SaveRS(arOperator, StringRule.CutRepeat(strTmp), "", "080104"); this.SaveRS(arOperator, strUser, "", "080102,080103,080104"); if (arOperator.Count > 0) { ResourceRule.SetResourceAccessRange(code, "0801", "", arOperator, false); } RemindDAO.InsertNotice(entity); entity.Dispose(); }
//保存数据 private bool SaveData() { this.htType.Value = Request["DocType"].ToString(); //保存通知 EntityData entityNotice = new EntityData("Standard_Notice"); DataRow drNotice = entityNotice.GetNewRecord(); this.strNoticeCode = SystemManageDAO.GetNewSysCode("Notice"); if (this.txtTitle.Value.Trim() == "") { return(false); } if (this.taContent.Value.Trim() == "") { return(false); } //新加通知类型(测试正确后删除此注释) if (this.up_sPMNameLower == "tianyangoa") { if (this.htType.Value == "1") { if (this.DDLNoticeClass.Value.Trim() == string.Empty) { return(false); } drNotice["NoticeClass"] = this.DDLNoticeClass.Value.Trim(); } } drNotice["NoticeCode"] = this.strNoticeCode; drNotice["Title"] = this.txtTitle.Value.Trim(); //drNotice["EnableDate"] = this.dtbShowDate.Value; drNotice["SubmitPerson"] = base.user.UserCode; drNotice["SubmitDate"] = DateTime.Now; drNotice["UpdateDate"] = DateTime.Now; drNotice["UserCode"] = base.user.UserCode; drNotice["Content"] = this.taContent.Value; if (this.htType.Value != "") { drNotice["Type"] = this.htType.Value; } entityNotice.AddNewRecord(drNotice); // //保存操作用户 //如果未选择通知用户,面向全体用户发布 // string strUser = this.txtUsers.Value.Trim(); // if(strUser.Length>0) // this.SaveUser(strUser); // // 保存分发岗位 // string strDept = this.txtDepts.Value.Trim(); // if(strDept.Length>0) // this.SaveDept(strDept); // 保存资源,保存权限 string strUser = this.txtUsers.Value.Trim(); string strStation = this.txtStations.Value.Trim(); // 没有选择人员则向全体发布 if (strUser.Length < 1 && strStation.Length < 1) { strUser = this.GetAllUser(); drNotice["IsAll"] = "1"; } else { drNotice["IsAll"] = "0"; } drNotice["status"] = "1"; ArrayList arOperator = new ArrayList(); this.SaveRS(arOperator, BLL.StringRule.CutRepeat(strUser), BLL.StringRule.CutRepeat(strStation), "080104"); // 一般通知查看权限 this.SaveRS(arOperator, base.user.UserCode, "", "080102,080103,080104"); // 修改和删除 if (arOperator.Count > 0) { BLL.ResourceRule.SetResourceAccessRange(this.strNoticeCode, "0801", "", arOperator, false); } RemindDAO.InsertNotice(entityNotice); entityNotice.Dispose(); // 保存附件 this.myAttachMentAdd.SaveAttachMent(this.strNoticeCode); this.btDelete.Visible = false; return(true); }
//更新数据 private bool UpdataData() { //保存通知 EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); DataRow dr; if (entityNotice.HasRecord()) { dr = entityNotice.CurrentRow; dr["NoticeCode"] = this.strNoticeCode; dr["NoticeClass"] = this.DDLNoticeClass.Value.Trim();//新加通知类型(测试正确后删除此注释) dr["Title"] = this.txtTitle.Value.Trim(); //dr["EnableDate"] = this.dtbShowDate.Value; dr["SubmitPerson"] = base.user.UserCode; dr["SubmitDate"] = DateTime.Now.ToShortDateString(); dr["Content"] = this.taContent.Value; // 保存资源,保存权限 string strUser = this.txtUsers.Value.Trim(); string strStation = this.txtStations.Value.Trim(); // 没有选择人员则向全体发布 if (strUser.Length < 1 && strStation.Length < 1) { strUser = this.GetAllUser(); dr["IsAll"] = "1"; } else { dr["IsAll"] = "0"; } ArrayList arOperator = new ArrayList(); this.SaveRS(arOperator, BLL.StringRule.CutRepeat(strUser), BLL.StringRule.CutRepeat(strStation), "080104"); // 一般通知查看权限 this.SaveRS(arOperator, base.user.UserCode, "", "080102,080103,080104"); // 修改和删除 if (arOperator.Count > 0) { BLL.ResourceRule.SetResourceAccessRange(this.strNoticeCode, "0801", "", arOperator, false); } } // // 待保存新选择的用户范围//如果未选择通知用户,面向全体用户发布 // string strUser = this.txtUsers.Value; // if(strUser.Length>0) // this.SaveUser(strUser); // // 保存分发岗位 // string strDept = this.txtDepts.Value; // if(strDept.Length>0) // this.SaveDept(strDept); // // 保存资源,保存权限 // string strUser = this.txtUsers.Value.Trim(); // string strStation = this.txtStations.Value.Trim(); // this.SaveRS(strUser,strStation,"080104"); RemindDAO.UpdateNotice(entityNotice); entityNotice.Dispose(); // 保存附件 this.myAttachMentAdd.SaveAttachMent(this.strNoticeCode); return(true); }
private void InitPage() { strNoticeCode = Request.QueryString["Code"] + ""; string strAction = Request.QueryString["Action"] + ""; User myUser = new User(user.UserCode); //if(!myUser.HasResourceRight(this.strNoticeCode,"080102")) //Server.Transfer("../Remind/NoticeInfo.aspx?&Code="+this.strNoticeCode); //this.btDelete.Visible = myUser.HasOperationRight("080103");// 080103为通知删除权限 try { //QueryAgent qa = new QueryAgent(); //DAL.QueryStrategy.RoleOperation sb = new RmsPM.DAL.QueryStrategy.RoleOperation(); //sb.AddStrategy(new Strategy(RoleOperationName.UserCode, user.UserCode)); ////sb.AddStrategy(new Strategy( RoleOperationName.UserCode,"080102")); //string sql = sb.BuildMainQueryString(); //DataSet Ds = qa.ExecSqlForDataSet(sql); //string str_Edit = ""; //string str_Delete = ""; //for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) //{ // if (Ds.Tables[0].Rows[i][1].ToString() == "080102") // { // str_Edit = Ds.Tables[0].Rows[i][1].ToString(); // } // if (Ds.Tables[0].Rows[i][1].ToString() == "080103") // { // str_Delete = Ds.Tables[0].Rows[i][1].ToString(); // } //} ////判断是否拥有修改权限 //if (str_Edit == "" && !myUser.HasResourceRight(this.strNoticeCode, "080102")) //{ // this.SaveToolsButton.Visible = false; //} //else //{ // this.SaveToolsButton.Visible = true; //} //if (str_Delete == "" && !myUser.HasResourceRight(this.strNoticeCode, "080103")) //{ // this.btDelete.Visible = false; //} //else //{ // this.btDelete.Visible = true; //} //发件人、修改、删除、监控 bool isSender = false; bool canModify = false; bool canDelete = false; bool isMonitor = false; EntityData entityNotice = RemindDAO.GetNoticeByCode(strNoticeCode); string l_submitPerson = entityNotice.GetString("SubmitPerson").ToString(); if (l_submitPerson == user.UserCode) { isSender = true; } if (user.HasRight("080102")) { canModify = true; } if (user.HasRight("080103")) { canDelete = true; } if (user.HasRight("080105")) { isMonitor = true; } if (isSender && canModify) { this.SaveToolsButton.Visible = true; } else { this.SaveToolsButton.Visible = false; } if (isMonitor || (isSender && canDelete)) { this.btDelete.Visible = true; } else { this.btDelete.Visible = false; } } catch (Exception dd) { string h = dd.Message.ToString(); string f = h; } // 载入附件 this.myAttachMentList.AttachMentType = "NoticeAttachMent"; this.myAttachMentList.MasterCode = strNoticeCode; FeedBack1.FeedBackType = "Notice"; FeedBack1.MasterCode = this.strNoticeCode; }
protected void SaveToolsButton_ServerClick(object sender, System.EventArgs e) { try { string Action = Request.QueryString["Action"] + ""; string strRemindType = ""; switch (Action.ToUpper()) { //新增提醒 case "INSERT": EntityData entityInsert = DAL.EntityDAO.RemindDAO.GetAllRemindStrategy(); DataRow drInsert = entityInsert.GetNewRecord(); drInsert["RemindStrategyCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("RemindStrategyCode"); if (this.rblRemindType.SelectedValue == "1") { drInsert["RemindDay"] = int.Parse(this.txtRemindDay.Text.Trim()); } else { drInsert["RemindDay"] = int.Parse("-" + this.txtRemindDay.Text.Trim()); } if (this.rblActive.SelectedValue == "1") { drInsert["IsActive"] = 1; } else { drInsert["IsActive"] = 0; } strRemindType = this.lstRemindType.Value; if (strRemindType == "0" || strRemindType == "3") { string strObject = ""; if (this.chkMaster.Checked) { strObject += "2"; } if (this.chkMonitor.Checked) { strObject += "1"; } if (this.chkExecuter.Checked) { strObject += "0"; } drInsert["ObjectCode"] = strObject; } else { drInsert["ObjectCode"] = this.lstRemindObject.Value; } drInsert["Type"] = strRemindType; drInsert["ProjectCode"] = (string)Session["ProjectCode"]; drInsert["Remark"] = this.taRemark.Value.Trim(); entityInsert.AddNewRecord(drInsert); RemindDAO.InsertRemindStrategy(entityInsert); entityInsert.Dispose(); break; //修改 case "MODIFY": string RemindCode = Request.QueryString["Code"] + ""; EntityData entityModify = DAL.EntityDAO.RemindDAO.GetRemindStrategyByCode(RemindCode); DataRow drModify = entityModify.CurrentRow; if (this.rblRemindType.SelectedValue == "1") { drModify["RemindDay"] = int.Parse(this.txtRemindDay.Text.Trim()); } else { drModify["RemindDay"] = int.Parse("-" + this.txtRemindDay.Text.Trim()); } if (this.rblActive.SelectedValue == "1") { drModify["IsActive"] = 1; } else { drModify["IsActive"] = 0; } strRemindType = this.lstRemindType.Value; if (strRemindType == "0" || strRemindType == "3") { string strObject = ""; if (this.chkMaster.Checked) { strObject += "2"; } if (this.chkMonitor.Checked) { strObject += "1"; } if (this.chkExecuter.Checked) { strObject += "0"; } drModify["ObjectCode"] = strObject; } else { drModify["ObjectCode"] = this.lstRemindObject.Value; } drModify["Type"] = strRemindType; drModify["Remark"] = StringRule.FormartInput(this.taRemark.Value.Trim()); RemindDAO.UpdateRemindStrategy(entityModify); entityModify.Dispose(); break; } Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.location.reload();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存提醒信息失败!"); } }
protected void btDelete_ServerClick(object sender, EventArgs e) { //删除通知 改变通知状态 EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); DataRow dr; if (entityNotice.HasRecord()) { dr = entityNotice.CurrentRow; //dr["NoticeCode"] = this.strNoticeCode; //dr["Title"] = this.txtTitle.Value.Trim(); ////dr["EnableDate"] = this.dtbShowDate.Value; //dr["SubmitPerson"] = base.user.UserCode; //dr["SubmitDate"] = DateTime.Now.ToShortDateString(); //dr["Content"] = this.taContent.Value; //// 保存资源,保存权限 //string strUser = this.txtUsers.Value.Trim(); //string strStation = this.txtStations.Value.Trim(); //// 没有选择人员则向全体发布 //if (strUser.Length < 1 && strStation.Length < 1) //{ // //strUser = this.GetAllUser(); // dr["IsAll"] = "1"; //} //else //{ // dr["IsAll"] = "0"; //} dr["status"] = "0"; ArrayList arOperator = new ArrayList(); //this.SaveRS(arOperator, RmsPM.BLL.StringRule.CutRepeat(strUser), RmsPM.BLL.StringRule.CutRepeat(strStation), "080104"); // 一般通知查看权限 //this.SaveRS(arOperator, base.user.UserCode, "", "080102,080103,080104"); // 修改和删除 //if (arOperator.Count > 0) // RmsPM.BLL.ResourceRule.SetResourceAccessRange(this.strNoticeCode, "0801", "", arOperator, false); } RemindDAO.UpdateNotice(entityNotice); entityNotice.Dispose(); Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.refresh();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); //try //{ // // 删除附件 // this.myAttachMentAdd.DelAttachMentByMasterCode(this.strNoticeCode); // // 删除分发范围 // EntityData entityUser = RemindDAO.GetNoticeUserByNoticeCode(this.strNoticeCode); // if (entityUser.HasRecord()) // { // RemindDAO.DeleteNoticeUser(entityUser); // } // entityUser.Dispose(); // // 是否添加入删除资源和权限的操作 // EntityData entityNotice = RemindDAO.GetNoticeByCode(strNoticeCode); // RemindDAO.DeleteNotice(entityNotice); // Response.Write(JavaScript.ScriptStart); // Response.Write("window.opener.refresh();"); // Response.Write("window.close();"); // Response.Write(JavaScript.ScriptEnd); //} //catch (Exception ex) //{ // ApplicationLog.WriteLog(this.ToString(), ex, "删除失败"); //} }
//更新数据 private bool UpdataData() { //保存通知 EntityData entityNotice = RemindDAO.GetNoticeByCode(this.strNoticeCode); DataRow dr; if (entityNotice.HasRecord()) { dr = entityNotice.CurrentRow; if (this.txtTitle.Value.Trim() == "") { return(false); } if (this.taContent.Value.Trim() == string.Empty) { return(false); } dr["NoticeCode"] = this.strNoticeCode; //新加通知类型(测试正确后删除此注释) if (this.up_sPMNameLower == "tianyangoa") { dr["NoticeClass"] = this.DDLNoticeClass.Value.Trim(); dr["Title"] = this.txtTitle.Value.Trim(); if (entityNotice.GetInt("Type") != 99) { if (this.DDLNoticeClass.Value.Trim() == "") { return(false); } } } dr["Title"] = this.txtTitle.Value.Trim(); dr["UpdateDate"] = DateTime.Now; dr["UserCode"] = this.user.UserCode; //dr["EnableDate"] = this.dtbShowDate.Value; // dr["SubmitPerson"] = base.user.UserCode; // dr["SubmitDate"] = DateTime.Now.ToShortDateString(); dr["Content"] = this.taContent.Value.ToString(); // 保存资源,保存权限 string strUser = this.txtUsers.Value.Trim(); string strStation = this.txtStations.Value.Trim(); // 没有选择人员则向全体发布 if (strUser.Length < 1 && strStation.Length < 1) { strUser = this.GetAllUser(); dr["IsAll"] = "1"; } else { dr["IsAll"] = "0"; } dr["status"] = "1"; ArrayList arOperator = new ArrayList(); this.SaveRS(arOperator, RmsPM.BLL.StringRule.CutRepeat(strUser), RmsPM.BLL.StringRule.CutRepeat(strStation), "080104"); // 一般通知查看权限 this.SaveRS(arOperator, base.user.UserCode, "", "080102,080103,080104"); // 修改和删除 if (arOperator.Count > 0) { RmsPM.BLL.ResourceRule.SetResourceAccessRange(this.strNoticeCode, "0801", "", arOperator, false); } } RemindDAO.UpdateNotice(entityNotice); entityNotice.Dispose(); // 保存附件 this.myAttachMentAdd.SaveAttachMent(this.strNoticeCode); //修改保存后这条信息又成为新信息,就是没有读过的信息 User u = (User)Session["User"]; string strDelete = "Delete from UserLookedNotice where noticecode='" + this.strNoticeCode + "' and usercode='" + u.UserCode + "'"; QueryAgent qa = new QueryAgent(); qa.ExecuteSql(strDelete); qa.Dispose(); return(true); }