public int Update() { string query = "UPDATE OP_CODE " + "SET GROUP_ID=@group_id:NUMBER, " + "CODE_ID=@code_id:NUMBER, " + "CODE_NM=@code_nm:VARCHAR2"; string query2 = "UPDATE OP_GROUP_CODE " + "SET GROUP_ID=@group_id:NUMBER, " + "GROUP_NM=@group_nm:VARCHAR2"; int resultRowCnt = _commonDao.Update(query); int resultRowCnt2 = _commonDao.Update(query2); return(resultRowCnt); }
//删除 protected void btnDelete_Clik(object sender, CommandEventArgs e) { string fid = e.CommandName; CommonDao<SafeRewards> newmgr = new CommonDao<SafeRewards>(); CommonDao<SafeDeptMoney> moneymgr=new CommonDao<SafeDeptMoney>(); SafeRewards sf = newmgr.FindById(fid); CommonDao<SafeRewards> rewardmgr = new CommonDao<SafeRewards>(); SafeDeptMoney sm = moneymgr.FindByConditions(" deptname='" + sf.dept + "' and deptyear=datepart(yy,'"+sf.createtime.ToString()+"') "); sm.currentmoney = sm.currentmoney - sf.rewards; if (sm != null && sf != null) { if (moneymgr.Update(sm)) { if (newmgr.Del(sf)) { MsgShow("恭喜您,删除记录成功!"); InfoBind(); } } else { MsgShow("Sorry,删除记录失败!"); } } else { MsgShow("Sorry,未找到对应部门金额,删除记录失败!"); } }
private void PageAccess() { CommonDao<SafePageAccess> Pagemgr = new CommonDao<SafePageAccess>(); SafePageAccess pa = new SafePageAccess(); pa.createtime = DateTime.Now.ToString(); pa.pagename = Request.RawUrl; if (Tools.CookieHelper.GetCookie("CN_ID") != null) { EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo(); string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString(); pa.userinfo = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString(); } else { pa.userinfo = "匿名 IP:" + Request.UserHostAddress; } if (int.Parse(Pagemgr.GetTotalCount(" pagename='" + pa.pagename + "' and userinfo ='" + pa.userinfo + "'")) <= 0) { Pagemgr.Add(pa); CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>(); SafeNews safenew = newmgr.FindById(Request["fid"].ToString()); safenew.newskits++; newmgr.Update(safenew); } }
/// <summary> /// 데이터 업데이트 - 단건 /// </summary> /// <param name="conditions"></param> public static void Update(Hashtable conditions) { try { conditions.Add("ID", Logs.strLogin_ID); } catch (Exception) { } dao.Update(conditions); }
public IActionResult UpdateData() { using var transaction = _context.Database.BeginTransaction(); string query = "UPDATE PERSONS SET PERSON_ID = @person_id:NUMBER, " + "LAST_NAME = @last_name:VARCHAR, " + "FIRST_NAME = @first_name:VARCHAR, " + "ADDRESS = @address:VARCHAR, " + "CITY = @city:VARCHAR"; _commonDao.Update(query, Request.Form); transaction.Commit(); return(Redirect("Index")); }
public string UpdateTask([FromBody] Task Task) { UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo"); Dictionary <string, string> param = new Dictionary <string, string>(); // Task 데이터 파싱 param.Add("SelectSubj", Task.SelectSubj); param.Add("Title", Task.Title); param.Add("Content", Task.Content); param.Add("Sdate", Task.Sdate); param.Add("Edate", Task.Edate); param.Add("Adit_sdate", Task.Adit_sdate); param.Add("Adit_edate", Task.Adit_edate); param.Add("AtchFileId", Task.AtchFileId); param.Add("PresentForm", Task.PresentForm); param.Add("FileCpctyLlmt", Task.FileCpctyLlmt); param.Add("TaskId", Task.TaskId); param.Add("user_id", userInfo.user_id); string query = ""; query = "UPDATE OP_TASK SET " + "TITLE = @Title:VARCHAR" + ", BEGIN_TMLMT = TO_DATE(@Sdate:VARCHAR, 'YYYYMMDDHH24MI')" + ", END_TMLMT = TO_DATE(@Edate:VARCHAR, 'YYYYMMDDHH24MI')" + ", BEGIN_ADIT_TMLMT = TO_DATE(@Adit_sdate:VARCHAR, 'YYYYMMDDHH24MI')" + ", END_ADIT_TMLMT = TO_DATE(@Adit_edate:VARCHAR, 'YYYYMMDDHH24MI')" + ", CONTENT = @Content:VARCHAR" + ", DOC_ID = @AtchFileId:VARCHAR" + ", PRESENT_FORM = @PresentForm:VARCHAR" + ", FILE_CPCTY_LMT = @FileCpctyLlmt:VARCHAR" + " WHERE TASK_SEQ = @TaskId:NUMBER"; //cud 처리할 때는 트랜잭션 시작해주어야함 using var transaction = _context.Database.BeginTransaction(); _commonDao.Update(query, param); transaction.Commit(); return("ok"); }
private void PageAccess() { CommonDao<SafePageAccess> Pagemgr = new CommonDao<SafePageAccess>(); SafePageAccess pa = new SafePageAccess(); pa.createtime = DateTime.Now.ToString(); pa.pagename = Request.RawUrl; if (Tools.CookieHelper.GetCookie("username") != null) pa.userinfo = Tools.CookieHelper.GetCookie("username").ToString() + " IP:" + Request.UserHostAddress; else pa.userinfo = "匿名 IP:" + Request.UserHostAddress; if (int.Parse(Pagemgr.GetTotalCount(" pagename='" + pa.pagename + "' and userinfo ='" + pa.userinfo + "'")) <= 0) { Pagemgr.Add(pa); CommonDao<SafeBook> newmgr = new CommonDao<SafeBook>(); SafeBook safebook = newmgr.FindById(Request["fid"].ToString()); safebook.bookkits++; newmgr.Update(safebook); } }
protected void GetValue(object sender, EventArgs e) { CommonDao<Model.SafeDuty> newmgr = new CommonDao<SafeDuty>(); SafeDuty sduty = new SafeDuty(); if (Request.QueryString["fid"] != null) { sduty = newmgr.FindById(Request.QueryString["fid"].ToString()); } sduty.area = this.TextAreaQuyu.InnerText.Replace("\r\n", "").Trim().ToString(); sduty.areatype = this.TextBoxFenlei.Text.Trim().ToString(); sduty.dept = this.TextBoxDept.Text.Trim().ToString(); sduty.deptleader = this.TextBoxDeptLeader.Text.Trim().ToString(); sduty.isimportant = this.DropDownListImportant.SelectedValue.ToString(); sduty.time = this.DropDownListYear.Text.ToString(); sduty.person = this.TextBoxPerson.Text.Trim().ToString(); if (Request.QueryString["fid"] != null) { if (newmgr.Update(sduty)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全责任修改成功!", "SafeDuAdd.aspx"); } MessageBox.Show(this, "Sorry,安全责任修改失败!请您重试!"); } else { if (newmgr.Add(sduty)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全责任添加成功!", "SafeDuAdd.aspx"); } MessageBox.Show(this, "Sorry,安全责任添加失败!请您重试!"); } }
protected void GetValue(object sender, EventArgs e) { CommonDao<Model.SafePitFalls> newmgr = new CommonDao<SafePitFalls>(); SafePitFalls spf = new SafePitFalls(); if (Request.QueryString["fid"] != null) { spf = newmgr.FindById(Request.QueryString["fid"].ToString()); } spf.area = this.TextAreaQuYu.InnerText.Trim().ToString(); spf.time = this.TextBoxDate.Text.ToString(); spf.person = this.DropDownListPerson.Text.Trim().ToString(); spf.pitresult = this.TextAreaJieguo.InnerHtml.Trim().ToString(); if (this.TextBoxfk.Text.ToString()!="") { spf.Fine = Int32.Parse(this.TextBoxfk.Text.ToString()); } spf.pitsuggestion = this.TextAreaYijian.InnerHtml.Trim().ToString(); spf.pitcontents = this.TextAreaYinhuan.InnerText.Trim().ToString().Replace("\"", "'");//.Replace("\"", "\"\'\"") spf.dept = this.DropDownListDept.Text.ToString(); spf.createperson = "测试"; spf.createtime = DateTime.Now.ToString(); GetImg getimg = new GetImg(); spf.picurl = getimg.MyGetImgUrl(this.TextAreaYinhuan.InnerText.ToString()); if (Request.QueryString["fid"] != null) { if (newmgr.Update(spf)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全隐患修改成功!", "SafeResAdd.aspx"); } MessageBox.Show(this, "Sorry,安全隐患修改失败!请您重试!"); } else { if (newmgr.Add(spf)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全隐患添加成功!", "SafeResAdd.aspx"); } MessageBox.Show(this, "Sorry,安全隐患添加失败!请您重试!"); } }
//判断预约是有锁定,如果为锁定者进行锁定 ,待定用户完成预约 public bool OrderLock(string fid) { CommonDao<HealthSchedule> HScheduleMgr = new CommonDao<HealthSchedule>(); HealthSchedule Hschedule = HScheduleMgr.FindById(fid); if (Hschedule.islock == 1) { return false; } else { Hschedule.islock = 1; Hschedule.locktime = DateTime.Now.ToString(); if (HScheduleMgr.Update(Hschedule)) { return true; } return false; } }
protected void Btn_OK(object sender, EventArgs e) { CommonDao<HealthUserOrder> UserOrderMgr = new CommonDao<HealthUserOrder>(); int UserOrderCount = int.Parse(UserOrderMgr.GetTotalCount("USERSTATE='已生效' and USERID='" + userid + "'")); CommonDao<HealthSchedule> OrderSchMgr = new CommonDao<HealthSchedule>(); HealthSchedule hs = OrderSchMgr.FindById(SchedulId); HealthUserOrder uo = new HealthUserOrder(); if (uo.userstate == "已生效") { Response.Write("<script>alert('预约操作时间超过五分钟,该预约已失效,请重新预约!');window.location='UserOrder.aspx'</script>"); return; } if (UserOrderCount == 0) { if (this.TextBoxOther.Text.Trim().Length > 0) { uo.userid = "other"; uo.username = this.TextBoxOther.Text.Trim().ToString(); uo.userdept = this.TextBoxOtherDept.Text.Trim().ToString(); int UserOrderCount2 = int.Parse(UserOrderMgr.GetTotalCount(" USERSTATE='已生效' and USERNAME='******'")); if (UserOrderCount2 >0) { MsgShow("" + uo.username + "已经有生效的预约,请进行评价或取消后再进行预约!"); return; } } else { uo.userid = userid; uo.username = username; uo.userdept = this.LabelDept.Text.ToString(); } uo.userdoctor = hs.orderdoctor; uo.userschid = SchedulId.ToString(); uo.userstate = "已生效"; uo.usertel = this.TextBoxTel.Text.ToString(); uo.usertime = hs.ordertime; uo.userdate = hs.orderdate.Substring(0, 3); uo.starttime = hs.starttime;//判断预约时间 uo.createtime = DateTime.Now.ToString(); uo.description = this.TextAreaXuqiu.InnerHtml.Replace("\r\n", "<br>").ToString(); HealthUserMsg healmsg = new HealthUserMsg(); healmsg.username = uo.username; healmsg.userdoctor = hs.orderdoctor; healmsg.userschid = SchedulId.ToString(); healmsg.starttime = hs.starttime; healmsg.userdate = hs.orderdate.Substring(0, 3); healmsg.usertime = hs.starttime; healmsg.createtime = DateTime.Now.ToString(); healmsg.sendstate = 0; CommonDao<HealthUserMsg> healthmsgMgr = new CommonDao<HealthUserMsg>(); //增加记录 healthmsgMgr.Add(healmsg); hs.isorder = 1; hs.orderperson = uo.username; if (UserOrderMgr.Add(uo) && OrderSchMgr.Update(hs)) { string subject = "保健预约"; string content = "保健预约负责人:<br />您好," + uo.username + " 已成功预约(" + hs.orderdate.Substring(0, 3) + " " + hs.ordertime + ")时间段 " + hs.orderdoctor + " 医师,特告知您知晓并跟踪详情。"; CommonDao<HealthAdmin> healadminmgr = new CommonDao<HealthAdmin>(); IList<HealthAdmin> listhealthadmin = healadminmgr.FindByCondition(" works=0 "); if (listhealthadmin != null) { foreach (HealthAdmin healthadmin in listhealthadmin) { UI.AddAmDetail(healthadmin.username, subject, content); // UI.AddAmDetail("盛绍华", subject, content); } } Response.Write("<script>alert('预约成功!');window.location='Default.aspx'</script>"); } else { MsgShow("预约失败!"); return; } } MsgShow("您已经有生效的预约,请进行评价或取消后再进行预约!"); }
protected void GetValue(object sender, EventArgs e) { CommonDao<Model.SafeRewards> newmgr = new CommonDao<SafeRewards>(); SafeRewards srew = new SafeRewards(); if (Request.QueryString["fid"] != null) { srew = newmgr.FindById(Request.QueryString["fid"].ToString()); } srew.area = this.TextAreaQuyu.InnerText.ToString();// this.DropDownListQuyu.Text.Trim().ToString(); srew.dept = this.DropDownListDept.Text.Trim().ToString(); srew.person = this.DropDownListPerson.Text.Trim().ToString(); srew.rewards = int.Parse(this.TextBoxReward.Text.Trim().ToString()); srew.createtime = DateTime.Now.ToString(); CommonDao<SafeDeptMoney> moneymgr = new CommonDao<SafeDeptMoney>(); SafeDeptMoney sm = moneymgr.FindByConditions(" deptname='" + srew.dept + "' and deptyear=datepart(yy,'" + srew.createtime.ToString() + "') "); if (sm == null) { MessageBox.ShowAndRedirect(this, "未对该部门设置初始金额无法进行奖惩,请设置!", "SafeMoney.aspx"); return; } sm.currentmoney = sm.currentmoney+srew.rewards; srew.totals = sm.currentmoney; if (Request.QueryString["fid"] != null) { if( moneymgr.Update(sm)&&newmgr.Update(srew)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全奖惩修改成功!", "SafeRewAdd.aspx"); } MessageBox.Show(this, "Sorry,安全奖惩修改失败!请您重试!"); } else { if (moneymgr.Update(sm) && newmgr.Add(srew)) { MessageBox.ShowAndRedirect(this, "恭喜您,安全奖惩添加成功!", "SafeRewAdd.aspx"); } MessageBox.Show(this, "Sorry,安全奖惩添加失败!请您重试!"); } }
protected void Btn_OK(object sender, EventArgs e) { CommonDao<HealthScore> HeacthScoreMgr = new CommonDao<HealthScore>(); CommonDao<HealthUserOrder> UserOrderMgr = new CommonDao<HealthUserOrder>(); HealthUserOrder hu = UserOrderMgr.FindById(OrderID); CommonDao<HealthSchedule> OrderSchMgr = new CommonDao<HealthSchedule>(); HealthSchedule hsc = OrderSchMgr.FindById(hu.userschid); if (DateTime.Parse(hu.starttime).AddMinutes(45) > DateTime.Now) //if (DateTime.Parse(hsc.endtime) > DateTime.Now) { Show("您的保健服务未完成,请您在保健结束后进行评价。结束时间:"+hsc.endtime+"", " "); return; } if (int.Parse(HeacthScoreMgr.GetTotalCount(" ORDERID='" + OrderID + "' ")) == 0) { HealthScore hs = new HealthScore(); hs.orderid = OrderID; hs.doctor = hu.userdoctor; hs.liaoxiao = this.Ratingliaoxiao.CurrentRating*4; hs.fuwutaidu = this.Ratingfuwu.CurrentRating * 4; hs.jifa = this.Ratingjifa.CurrentRating * 4; hs.lidao = this.Ratinglidu.CurrentRating * 4; hs.shushidu = this.Ratingshushidu.CurrentRating * 4; hs.totalsum = hs.liaoxiao + hs.fuwutaidu + hs.jifa + hs.lidao + hs.shushidu; hs.description = this.TextAreaScore.InnerHtml.Replace("\r\n", "<br>").ToString(); string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString(); hs.createperson = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString(); hs.createtime = DateTime.Now.ToString(); hu.userstate = "已评价"; if (UserOrderMgr.Update(hu) && HeacthScoreMgr.Add(hs)) { //MsgShow("评价成功!"); string subject = "保健预约"; string content = "保健预约负责人:<br />您好," + hs.createperson + " 预约的(" + hu.userdate + " " + hu.usertime + ")时间段" + hs.doctor + "医生,预约人已于" + DateTime.Now + "对保健服务进行评价,特告知您知晓并跟踪详情。"; CommonDao<HealthAdmin> healadminmgr = new CommonDao<HealthAdmin>(); IList<HealthAdmin> listhealthadmin = healadminmgr.FindByCondition(" works=0 "); if (listhealthadmin != null) { foreach (HealthAdmin healthadmin in listhealthadmin) { UI.AddAmDetail(healthadmin.username, subject, content); } } Response.Write("<script>alert('评价成功!');window.location='Default.aspx'</script>"); return; } else { Show("评价失败", " "); return; } // Response.Write("<script>alert('评论成功!');window.location='Default.aspx'</script>"); //MsgShow("预约成功!"); // Show("恭喜您,您的文章发布成功!", "window.opener=null;window.open('','_self');window.close();"); } else { HealthScore hs = HeacthScoreMgr.FindByConditions(" ORDERID='" + OrderID + "'"); hs.liaoxiao = this.Ratingliaoxiao.CurrentRating * 4; hs.fuwutaidu = this.Ratingfuwu.CurrentRating * 4; hs.jifa = this.Ratingjifa.CurrentRating * 4; hs.lidao = this.Ratinglidu.CurrentRating * 4; hs.shushidu = this.Ratingshushidu.CurrentRating * 4; hs.totalsum = hs.liaoxiao + hs.fuwutaidu + hs.jifa + hs.lidao + hs.shushidu; hs.description = this.TextAreaScore.InnerHtml.Replace("\r\n", "<br>").ToString(); string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString(); hs.createperson = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString(); hs.createtime = DateTime.Now.ToString(); if (HeacthScoreMgr.Update(hs)) { string subject = "保健预约"; string content = "您好,评价成功! " + DateTime.Now; EPReper.BLL.Manager Manager = new EPReper.BLL.Manager(); DataTable dtm = Manager.GetList(0, " isadmin = 9 and states =9 ", "id").Tables[0]; if (dtm != null) { if (dtm.Rows.Count > 0) { for (int i = 0; i < dtm.Rows.Count; i++) { UI.AddAmDetail(dtm.Rows[i]["username"].ToString(), subject, content); } } } //Show("评价成功!", "window.opener=null;window.open('','_self');window.close();"); Response.Write("<script>alert('评价成功!');window.location='Default.aspx'</script>"); return; } else { Show("评价失败", " "); return; } } }
public IActionResult SelectRecsroom() { UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo"); Dictionary <string, string> param = new Dictionary <string, string>(); ViewData["name"] = userInfo.name; ViewData["user_id"] = userInfo.user_id; ViewData["pageNm"] = "강의 자료실"; ViewData["fs_at"] = userInfo.author.Equals(_codeMngTool.getCode("AUTHOR", "PROFESSOR")) ? "Y" : "N"; ViewData["author"] = userInfo.author; ViewBag.ACDMC_NO = Request.Form["selectedSubj"]; ViewBag.YEAR_HAKGI = Request.Form["selectedYearhakgi"]; ViewBag.SEARCH_TYPE = Request.Form["search_type"]; ViewBag.SEARCH_TXT = Request.Form["search_txt"].ToString().Replace("\\", "\\\\"); // 조회수 증가 쿼리 string sql = "UPDATE OP_BBS SET RDCNT = (SELECT RDCNT+1 AS RDCNT FROM OP_BBS WHERE BBS_ID = @BBS_ID:VARCHAR) WHERE BBS_ID = @BBS_ID:VARCHAR"; //cud 처리할 때는 트랜잭션 시작해주어야함 using var transaction = _context.Database.BeginTransaction(); _commonDao.Update(sql, Request.Form); transaction.Commit(); param.Add("page", Request.Form["page"]); sql = "SELECT * FROM (" + "SELECT A.ACDMC_NO AS SelectSubj" + ", A.TITLE" + ", A.OTHBC_AT" + ", A.CONTENTS" + ", A.REGIST_DT " + ", B.NAME " + ", A.BBS_ID " + ", A.RDCNT " + ", DOC_ID " + ", LEAD(BBS_ID) OVER(ORDER BY BBS_ID) AS NEXT_ID " + ", LEAD(TITLE) OVER(ORDER BY BBS_ID) AS NEXT_TITLE " + ", LAG(BBS_ID) OVER(ORDER BY BBS_ID) AS PREV_ID " + ", LAG(TITLE) OVER(ORDER BY BBS_ID) AS PREV_TITLE " + "FROM OP_BBS A " + "JOIN OP_USER B " + "ON A.REGISTER = B.USER_ID " + "WHERE 1=1 " + "AND ACDMC_NO = @selectedSubj:VARCHAR " + "AND BBS_CODE = '" + _codeMngTool.getCode("BBS", "RECSROOM") + "' " + "ORDER BY BBS_ID DESC)" + "WHERE BBS_ID = @BBS_ID:VARCHAR"; var result = _commonDao.SelectOne(sql, Request.Form); // Comment 개수 sql = "SELECT COUNT(*) AS COMMENT_CNT FROM OP_BBS WHERE REF_ID = @BBS_ID:VARCHAR"; var commentCnt = _commonDao.SelectOne(sql, Request.Form)["COMMENT_CNT"]; ViewBag.commentCnt = commentCnt; // Comment 정보 sql = "SELECT A.BBS_ID, B.NAME, A.REGIST_DT, A.CONTENTS " + "FROM OP_BBS A JOIN OP_USER B " + "ON A.REGISTER = B.USER_ID WHERE A.REF_ID = @BBS_ID:VARCHAR " + "ORDER BY BBS_ID"; var commentList = _commonDao.SelectList(sql, Request.Form); ViewBag.commentList = commentList; ViewBag.result = result; ViewBag.param = param; ViewBag.Select = "/Recsroom/SelectRecsroom"; ViewBag.SelectPageList = "/Recsroom/SelectPageListRecsroom"; ViewBag.UpdateForm = "/Recsroom/UpdateFormRecsroom"; ViewBag.Insert = "/Recsroom/InsertRecsroom"; ViewBag.InsertComment = "/Recsroom/InsertCommentRecsroom"; ViewBag.DeleteComment = "/Recsroom/DeleteCommentRecsroom"; ViewBag.Delete = "/Recsroom/DeleteRecsroom"; int fcount = 0; //첨부파일 읽어오기 if (result["DOC_ID"] != "") { sql = "SELECT FILE_NAME,FILE_EXTSN,FILE_ID FROM OP_FILE A JOIN OP_BBS B ON A.DOC_ID=B.DOC_ID" + " WHERE A.DOC_ID='" + result["DOC_ID"] + "'"; var fileList = _commonDao.SelectList(sql); fcount = fileList.Count; ViewBag.fileList = fileList; } ViewBag.fileCount = fcount; return(View("/Views/LctSport/BoardViewStdPage.cshtml")); }
protected void GetValue(object sender, EventArgs e) { CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>(); SafeNews safenew = new SafeNews(); if (Request.QueryString["fid"] != null) { safenew = newmgr.FindById(Request.QueryString["fid"].ToString()); } safenew.newstitle = this.Txtctitle.Text.Trim().ToString(); CommonDao<Safezhuan> sugmgr = new CommonDao<Safezhuan>(); Safezhuan safezhuan = sugmgr.FindByConditions(" ZhuanName='" + this.DropDownListZhuanTi.Text.Trim().ToString() + "' "); if(safezhuan!=null){ safenew.NewsZhuan = safezhuan.fid.ToString(); } safenew.newscontents = this.TxtNewsContent.InnerText.ToString(); if (Request.QueryString["Infotype"] != null && Request.QueryString["type"] != null) { safenew.NewsInfoType = Request.QueryString["Infotype"].ToString(); safenew.newstype = Request.QueryString["type"].ToString(); } if (safenew.NewsInfoType == "安全新闻") { GetImg getimg = new GetImg(); safenew.newspics = getimg.MyGetImgUrl(safenew.newscontents); if (safenew.newspics.Length > 0) { safenew.newstype = "图片新闻"; } } EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo(); string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString(); string username = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString(); safenew.createperson = username; safenew.createtime = DateTime.Now.ToString(); if (Request.QueryString["fid"]!= null) { if (newmgr.Update(safenew)) { MessageBox.ShowAndRedirect(this, "恭喜您," + safenew.newstype + "修改成功!", "SafeAdmin.aspx?Infotype=" + safenew.NewsInfoType + "&type=" + safenew.newstype + ""); } MessageBox.Show(this, "Sorry," + safenew.newstype + "修改失败!,请您重试!"); } else { if (newmgr.Add(safenew)) { MessageBox.ShowAndRedirect(this, "恭喜您," + safenew.newstype + "添加成功!", "SafeAdmin.aspx?Infotype=" + safenew.NewsInfoType + "&type=" + safenew.newstype + ""); } MessageBox.Show(this, "Sorry," + safenew.newstype + "添加失败!,请您重试!"); } }
public bool UpdateSchedule(string fid, string doctor) { CommonDao<HealthSchedule> healthSchmgr = new CommonDao<HealthSchedule>(); HealthSchedule hs = healthSchmgr.FindById(fid); CommonDao<HealthUserOrder> healthOrdmgr = new CommonDao<HealthUserOrder>(); HealthUserOrder horder = healthOrdmgr.FindByConditions(" userschid='" + fid + "' and starttime='" + hs.starttime.ToString() + "' and userstate='已生效' "); hs.orderdoctor = doctor; bool updatehorder=true; if (horder == null)//判断是否已经有预约的 { if (doctor.Trim() == "") { hs.islock = 0; hs.isorder = 2;//不能预约 没有医生 hs.orderperson = ""; } else { hs.isorder = 0; } } else { //有预约但医生为空 if (doctor.Trim() == "") { //取消小翅膀信息发送 CommonDao<HealthUserMsg> healthmsgMgr = new CommonDao<HealthUserMsg>(); HealthUserMsg hwalmsg = healthmsgMgr.FindByConditions(" userschid='" + fid + "' and starttime='" + hs.starttime.ToString() + "'"); if (hwalmsg != null) { hwalmsg.sendstate = 2; healthmsgMgr.Update(hwalmsg); } hs.islock = 0; hs.isorder = 2;//不能预约 没有医生 hs.orderperson = ""; horder.userstate = "已取消"; horder.userdoctor = ""; updatehorder = healthOrdmgr.Update(horder); string subject = "保健预约"; string content = "" + horder.username.ToString() + ",您好!您预约的(" + horder.userdate.Substring(0, 3) + " " + horder.usertime + ") 时间段保健,因没有医师已自动取消,特告知您知晓。"; UI.AddAmDetail(horder.username.ToString(), subject, content); } else { // hs.isorder = 0; horder.userdoctor = doctor; updatehorder=healthOrdmgr.Update(horder); } } if (healthSchmgr.Update(hs) && updatehorder) { return true; } return false; }
protected void GridViewEmployee_RowUpdating(object sender, GridViewUpdateEventArgs e) { string money = ((TextBox)GridViewEmployee.Rows[e.RowIndex].Cells[2].Controls[0]).Text.Trim().ToString(); string year = ((TextBox)GridViewEmployee.Rows[e.RowIndex].Cells[3].Controls[0]).Text.Trim().ToString(); string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString(); CommonDao<SafeDeptMoney> newmgr = new CommonDao<SafeDeptMoney>(); SafeDeptMoney safemoney = newmgr.FindById(fid); try { safemoney.currentmoney = safemoney.currentmoney - safemoney.deptmoney + int.Parse(money); safemoney.deptmoney = int.Parse(money); safemoney.deptyear = year; } catch { Alert("部门金额更新失败,请填写正确的金额!"); return; } if (newmgr.Update(safemoney)) { Alert("部门金额更新成功!"); } else { Alert("热点专题更新失败!"); } GridViewEmployee.EditIndex = -1; //Turn the Grid to read only mode BindGridView(); // Rebind GridView to reflect changes made }
protected void GridViewEmployee_RowUpdating(object sender, GridViewUpdateEventArgs e) { string zhuanname = ((TextBox)GridViewEmployee.Rows[e.RowIndex].Cells[1].Controls[0]).Text.Trim().ToString(); string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString(); CommonDao<Safezhuan> newmgr = new CommonDao<Safezhuan>(); Safezhuan safezhuan = newmgr.FindById(fid); safezhuan.ZhuanName = zhuanname; if (newmgr.Update(safezhuan)) { Alert("热点专题更新成功!"); } else { Alert("热点专题更新失败!"); } GridViewEmployee.EditIndex = -1; //Turn the Grid to read only mode BindGridView(); // Rebind GridView to reflect changes made }
//取消预约 protected void btnCancel_Clik(object sender, CommandEventArgs e) { string fid = e.CommandName; CommonDao<HealthUserOrder> HealthUserOrdermgr = new CommonDao<HealthUserOrder>(); HealthUserOrder healthorder = HealthUserOrdermgr.FindById(fid); if (healthorder.userstate == "已评价") { MsgShow("预约已评价,无法取消!"); UserDateBind(); return; } healthorder.userstate = "已取消"; //更新排班表 // HealthSchedule hs = HealthSchedulmgr.FindById(healthorder.userschid); //判断 情况 第二周去评价第一周预约的 不能影响第二周的排班 CommonDao<HealthSchedule> HealthSchedulmgr = new CommonDao<HealthSchedule>(); HealthSchedule hs = HealthSchedulmgr.FindByConditions(" fid='" + healthorder.userschid + "' and starttime='" + healthorder.starttime.ToString() + "'"); //在排班表里面没有了预约 if (hs == null) { HealthUserOrdermgr.Update(healthorder); MsgShow("成功取消预约"); UserDateBind(); return; } //当前时间大于预约开始时间 if (DateTime.Now > DateTime.Parse(healthorder.starttime)) { MsgShow("您的保健服务已超过时间,不能取消,请评价。"); return; } //更新排班表 和 预约单的状态 hs.orderperson = ""; hs.isorder = 0; hs.islock = 0; //正常取消预约的情况 if (HealthUserOrdermgr.Update(healthorder) && HealthSchedulmgr.Update(hs)) { //取消小翅膀信息发送 CommonDao<HealthUserMsg> healthmsgMgr = new CommonDao<HealthUserMsg>(); HealthUserMsg hwalmsg = healthmsgMgr.FindByConditions(" USERSCHID='" + healthorder.userschid + " ' and starttime='" + healthorder.starttime.ToString() + "'"); if (hwalmsg != null) { hwalmsg.sendstate = 1; healthmsgMgr.Update(hwalmsg); } //判断是否失效并发送给袁瑛 if (DateTime.Parse(hs.starttime) > DateTime.Now) { string subject = "保健预约取消"; string content = "保健预约负责人:<br /> 您好," + healthorder.username + "预约的(" + hs.orderdate.Substring(0, 3) + " " + hs.ordertime + ")时间段 " + hs.orderdoctor + " 医师,预约人已于 " + DateTime.Now + " 取消保健服务预约,特告知您知晓并跟踪详情。 "; // EPReper.BLL.Manager Manager = new EPReper.BLL.Manager(); // DataTable dtm = Manager.GetList(0, " isadmin = 9 and states =9 ", "id").Tables[0]; CommonDao<HealthAdmin> healadminmgr = new CommonDao<HealthAdmin>(); IList<HealthAdmin> listhealthadmin = healadminmgr.FindByCondition(" works=0 "); if (listhealthadmin != null) { foreach (HealthAdmin healthadmin in listhealthadmin) { UI.AddAmDetail(healthadmin.username, subject, content); //UI.AddAmDetail("盛绍华", subject, content); } } } MsgShow("成功取消预约"); UserDateBind(); } else { MsgShow("取消预约失败!"); } }