//删除 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 GetZhuanTiList() { string fid = ""; string condition = ""; if (Request["ZhuanName"] != null) { fid = Request["ZhuanName"].ToString(); CommonDao<Safezhuan> sugmgr = new CommonDao<Safezhuan>(); Safezhuan safezhuan = sugmgr.FindByConditions(" fid='"+fid+"' "); this.lableType.InnerHtml = " <span style='color: #0087ce;'>" +safezhuan.ZhuanName.ToString() + "</span>"; condition = condition + " NewsZhuan ='" + fid + "' "; } CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>(); SafeNews s = new SafeNews(); if (TextBoxSearch.Text.Trim().Length > 0) { condition = condition + " and newstitle like '%" + this.TextBoxSearch.Text.Trim().ToString() + "%'"; } Pager.RecordCount = int.Parse(newmgr.GetTotalCount(condition)); RepeaterPubGG.DataSource = newmgr.FindAllByPageDesc(((Pager.CurrentPageIndex - 1) * Pager.PageSize).ToString(), Pager.PageSize.ToString(), condition); RepeaterPubGG.DataBind(); }
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,安全奖惩添加失败!请您重试!"); } }
public void OrderDataBind() { CommonDao<HealthUserOrder> UserOrderMgr = new CommonDao<HealthUserOrder>(); HealthUserOrder hu = UserOrderMgr.FindById(OrderID); this.Labeldoctor.Text = hu.userdoctor; this.Labeldatetime.Text = hu.userdate.Substring(0, 3) + "  " + hu.usertime; this.Labeldept.Text = hu.userdept; this.Labeluser.Text = hu.username; this.LabelTel.Text = hu.usertel; this.TextAreaDescription.InnerHtml = hu.description == null ? "" : hu.description.Replace("<br>", "\r\n"); CommonDao<HealthScore> HeacthScoreMgr = new CommonDao<HealthScore>(); if (int.Parse(HeacthScoreMgr.GetTotalCount(" ORDERID='" + OrderID + "'")) == 1) { HealthScore hs = HeacthScoreMgr.FindByConditions(" ORDERID='" + OrderID + "'"); this.Ratingliaoxiao.CurrentRating = hs.liaoxiao/4; this.Ratingfuwu.CurrentRating = hs.fuwutaidu/4; this.Ratingjifa.CurrentRating = hs.jifa/4; this.Ratinglidu.CurrentRating = hs.lidao/4; this.Ratingshushidu.CurrentRating = hs.shushidu/4; this.TextAreaScore.InnerHtml = hs.description == null ? "" : hs.description.Replace("<br>", "\r\n"); } }
private void SetDefaultdata() { if (Request.QueryString["fid"] != null) { CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>(); SafeNews safenew = newmgr.FindById(Request.QueryString["fid"]); if (safenew != null) { SpanType.InnerText = safenew.NewsInfoType.ToString() + "--" + safenew.newstype.ToString(); this.Txtctitle.Text = safenew.newstitle.ToString(); this.TxtNewsContent.InnerHtml = safenew.newscontents.ToString(); CommonDao<Safezhuan> sugmgr = new CommonDao<Safezhuan>(); Safezhuan safezhuan = sugmgr.FindByConditions(" fid='" + safenew.NewsZhuan + "' "); if (safezhuan != null) { ListItem itmSelected = this.DropDownListZhuanTi.Items.FindByValue(safezhuan.ZhuanName); if (itmSelected != null) { itmSelected.Selected = true; } } } else { MessageBox.ShowAndRedirect(this, "出错了,文章未找到!", "SafeAdmin.aspx"); } } else { if (Request.QueryString["Infotype"] != null && Request.QueryString["type"] != null) { SpanType.InnerText = Request.QueryString["Infotype"] + "---" + Request.QueryString["type"]; } else { MessageBox.ShowAndRedirect(this, "页面错误", "SafeAdmin.aspx"); } } }
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 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 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 + "添加失败!,请您重试!"); } }
//取消预约 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("取消预约失败!"); } }