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); } }
private void SetDefaultdata() { if (Request.QueryString["fid"] != null) { CommonDao<Model.SafeRewards> newmgr = new CommonDao<SafeRewards>(); SafeRewards sres = newmgr.FindById(Request.QueryString["fid"]); if (sres != null) { SetDropValueDefault(sres.dept, sres.person); //ListItem itmSelected = DropDownListQuyu.Items.FindByValue(sres.area); //if (itmSelected != null) { itmSelected.Selected = true; } this.TextAreaQuyu.InnerText = sres.area; ListItem itmSelected1 = DropDownListDept.Items.FindByValue(sres.dept); if (itmSelected1 != null) { itmSelected1.Selected = true; } ListItem itmSelected2 = DropDownListPerson.Items.FindByValue(sres.person); if (itmSelected2 != null) { itmSelected2.Selected = true; } this.TextBoxReward.Text = sres.rewards.ToString(); } else { MessageBox.ShowAndRedirect(this, "出错了,资源未找到!", "SafeAdmin.aspx"); } } else { } }
private void SetDefaultdata() { if (Request.QueryString["fid"] != null) { CommonDao<SafeDuty> newmgr = new CommonDao<SafeDuty>(); SafeDuty sduty = newmgr.FindById(Request.QueryString["fid"]); if (sduty != null) { this.TextAreaQuyu.InnerText = sduty.area; this.TextBoxFenlei.Text = sduty.areatype; this.TextBoxDept.Text = sduty.dept; this.TextBoxDeptLeader.Text = sduty.deptleader; this.DropDownListImportant.SelectedValue = sduty.isimportant; this.DropDownListYear.Text = sduty.time.ToString(); this.TextBoxPerson.Text = sduty.person; } else { MessageBox.ShowAndRedirect(this, "出错了,资源未找到!", "SafeAdmin.aspx"); } } }
//删除 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,未找到对应部门金额,删除记录失败!"); } }
public void OrderDataBind() { CommonDao<HealthSchedule> OrderSchMgr = new CommonDao<HealthSchedule>(); HealthSchedule healthuserorder = OrderSchMgr.FindById(SchedulId); this.LabelDoctor.Text = healthuserorder.orderdoctor.ToString(); this.LabelDateTime.Text = healthuserorder.orderdate.Substring(0, 3).ToString() + "  " + healthuserorder.ordertime.ToString(); DataTable dtu = UI.GetInfo("CN_ID = " + userid); string[] depts = dtu.Rows[0]["CN_DEPTINFO"].ToString().Split('/'); string dept = ""; for (int i = 0; i < depts.Count(); i++) { if (i != 0) { dept += depts[i] + "/"; } } //if(dept.Length>0) // dept = dept.Remove(dept.Length - 1); if (dept.Length > 0) dept = dept.Trim('/'); this.LabelUser.Text = username; this.LabelDept.Text = dept; this.TextBoxTel.Text = dtu.Rows[0]["CN_O_PHONE"].ToString(); }
private void GetInfo() { CommonDao<SafeBook> newmgr = new CommonDao<SafeBook>(); SafeBook safebook = newmgr.FindById(Request["fid"].ToString()); if (safebook == null) { this.lbtitle.Text = "无法找到该记录,可能已经被删除!"; return; } this.lbtitle.Text = safebook.booktitle; this.Title = safebook.booktitle + "--安全新闻管理"; this.lbcontent.Text = safebook.bookcontents; this.lbAinfo.Text = " 作者:" + safebook.createperson + " 最后修改:" + safebook.createtime + " 有效访问量:" + safebook.bookkits.ToString(); }
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 btnDelete_Clik(object sender, CommandEventArgs e) { string fid = e.CommandName; CommonDao<SafeBook> newmgr = new CommonDao<SafeBook>(); SafeBook sf = newmgr.FindById(fid); if (newmgr.Del(sf)) { MsgShow("恭喜您,删除记录成功!"); InfoBind(); } else { MsgShow("Sorry,删除记录失败!"); } }
private void GetInfo() { CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>(); CommonDao<SafePinJia> Pinjiamgr = new CommonDao<SafePinJia>(); SafeNews safenew = newmgr.FindById(Request["fid"].ToString()); if (safenew == null) { this.lbtitle.Text = "无法找到该记录,可能已经被删除!"; return; } this.lbtitle.Text = safenew.newstitle; this.Title = safenew.newstitle + "--安全新闻管理"; this.lbcontent.Text = safenew.newscontents; this.lbAinfo.Text = " 作者:" + safenew.createperson + " 最后修改:" + safenew.createtime + " 有效访问量:" + safenew.newskits.ToString(); this.RPMsgs.DataSource = Pinjiamgr.FindByCondition(" masterfid='" + safenew.fid + "'"); this.RPMsgs.DataBind(); }
private void SetDefaultdata() { if (Request.QueryString["fid"] != null) { CommonDao<SafePitFalls> newmgr = new CommonDao<SafePitFalls>(); SafePitFalls spf = newmgr.FindById(Request.QueryString["fid"]); if (spf != null) { this.TextBoxDate.Text = DateTime.Parse(spf.time).ToShortDateString(); SetDropValueDefault(spf.dept, spf.person); //ListItem itmSelected = DropDownListQuyu.Items.FindByValue(spf.area); //if (itmSelected != null) { itmSelected.Selected = true; } ListItem itmSelected1 = DropDownListDept.Items.FindByValue(spf.dept); if (itmSelected1 != null) { itmSelected1.Selected = true; } ListItem itmSelected2 = DropDownListPerson.Items.FindByValue(spf.person); if (itmSelected2 != null) { itmSelected2.Selected = true; } this.TextBoxfk.Text = spf.Fine == null ? "" : spf.Fine.ToString(); this.TextAreaQuYu.InnerText = spf.area == null ? "" : spf.area.ToString(); this.TextAreaJieguo.InnerHtml = spf.pitresult == null ? "" : spf.pitresult.ToString(); this.TextAreaYijian.InnerHtml = spf.pitsuggestion == null ? "" : spf.pitsuggestion.ToString(); this.TextAreaYinhuan.InnerHtml = spf.pitcontents.ToString(); } else { MessageBox.ShowAndRedirect(this, "出错了,资源未找到!", "SafeAdmin.aspx"); } } }
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 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); } }
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 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,安全隐患添加失败!请您重试!"); } }
//判断三级部门长以及预约时间段 // 0 可以执行,为1没有权限,为2 已过期 public int checkdept(string fid) { CommonDao<HealthSchedule> HScheduleMgr = new CommonDao<HealthSchedule>(); HealthSchedule Hschedule = HScheduleMgr.FindById(fid); CommonDao<HealthThree> healthreemgr = new CommonDao<HealthThree>(); TimeSpan timespan = DateTime.Parse(Hschedule.endtime).Date - DateTime.Now.Date; string username = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString(); if (DateTime.Parse(Hschedule.endtime) <= DateTime.Now) { return 2; } else { if (int.Parse(healthreemgr.GetTotalCount(" username ='******'")) > 0) { return 0; } else { if (timespan.Days > 1) { return 1; } else { return 0; } } } }
protected void GridViewEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e) { string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString(); CommonDao<Safezhuan> newmgr = new CommonDao<Safezhuan>(); Safezhuan safezhuan = newmgr.FindById(fid); CommonDao<SafeNews> safenewmgr = new CommonDao<SafeNews>(); int count = int.Parse(safenewmgr.GetTotalCount("NewsZhuan='" + fid + "'")); if (count == 0) { if (safezhuan != null) { if (newmgr.Del(safezhuan)) { Alert("热点专题删除成功!"); BindGridView(); } } } else { Alert("有属于该专题的文章,专题不能删除!"); } }
//取消预约 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("取消预约失败!"); } }
protected void btnSetScore_Clik(object sender, CommandEventArgs e) { string fid = e.CommandName; CommonDao<HealthUserOrder> HealthUserOrdermgr = new CommonDao<HealthUserOrder>(); HealthUserOrder healthorder = HealthUserOrdermgr.FindById(fid); CommonDao<HealthSchedule> OrderSchMgr = new CommonDao<HealthSchedule>(); HealthSchedule hsc = OrderSchMgr.FindById(healthorder.userschid); if (DateTime.Parse(healthorder.starttime).AddMinutes(45) > DateTime.Now) //if (DateTime.Parse(hsc.endtime) > DateTime.Now) { MsgShow("您的保健服务未完成,请您在保健结束后进行评价。结束时间:" + hsc.endtime + ""); return; } if (healthorder.userstate == "已评价") { MsgShow("预约已评价!"); return; } Response.Redirect("/View/SetOrderScore.aspx?OrderID=" + fid + ""); }
protected void GridViewEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e) { string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString(); CommonDao<SafeDeptMoney> newmgr = new CommonDao<SafeDeptMoney>(); SafeDeptMoney safemoney = newmgr.FindById(fid); CommonDao<SafeRewards> rewardmgr = new CommonDao<SafeRewards>(); int countreward = int.Parse(rewardmgr.GetTotalCount("dept='" + safemoney.deptname + "' and datepart(yy,createtime)='" + safemoney.deptyear + "'")); if (countreward == 0) { if (safemoney != null) { if (newmgr.Del(safemoney)) { Alert("部门金额删除成功!"); BindGridView(); } } } else { Alert("已有部门奖惩记录,无法删除!"); } }
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 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 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 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 void ScoreDateBind() { int countall = 0; CommonDao<V_HealthScore> V_healthscoremgr = new CommonDao<V_HealthScore>(); V_HealthScore V_heathTotal = V_healthscoremgr.FindById("999"); if (V_heathTotal != null) { this.LabelTotal1.Text = V_heathTotal.totalsum.ToString()+"分"; this.Ratinglidaoall.CurrentRating = V_heathTotal.lidao; this.Ratingliaoxiaoall.CurrentRating = V_heathTotal.liaoxiao; this.Ratingjifaall.CurrentRating = V_heathTotal.jifa; this.Ratingshushiall.CurrentRating = V_heathTotal.shushidu; this.Ratingtaiduall.CurrentRating = V_heathTotal.fuwutaidu; } //医生A V_HealthScore V_heathdoctorA = V_healthscoremgr.FindById("1"); if (V_heathdoctorA != null) { this.LabelA.Text = V_heathdoctorA.totalsum.ToString() + "分"; this.RatinglidaoA.CurrentRating = V_heathdoctorA.lidao; this.RatingliaoxiaoA.CurrentRating = V_heathdoctorA.liaoxiao; this.RatingjifaA.CurrentRating = V_heathdoctorA.jifa; this.RatingshushiA.CurrentRating = V_heathdoctorA.shushidu; this.RatingtaiduA.CurrentRating = V_heathdoctorA.fuwutaidu; this.LabelcountA.Text = V_heathdoctorA.countdoctor.ToString(); this.LabelD1.Text = V_heathdoctorA.doctor.ToString(); countall = countall + V_heathdoctorA.countdoctor; } //医生B V_HealthScore V_heathdoctorB = V_healthscoremgr.FindById("2"); if (V_heathdoctorB != null) { this.LabelB.Text = V_heathdoctorB.totalsum.ToString() + "分"; this.RatinglidaoB.CurrentRating = V_heathdoctorB.lidao; this.RatingliaoxiaoB.CurrentRating = V_heathdoctorB.liaoxiao; this.RatingjifaB.CurrentRating = V_heathdoctorB.jifa; this.RatingshushiB.CurrentRating = V_heathdoctorB.shushidu; this.RatingtaiduB.CurrentRating = V_heathdoctorB.fuwutaidu; this.LabelcountB.Text = V_heathdoctorB.countdoctor.ToString(); this.LabelD2.Text = V_heathdoctorB.doctor.ToString(); countall = countall + V_heathdoctorB.countdoctor; } this.Labelcountall.Text = countall.ToString(); image1.Visible = true; image2.Visible = true; if (V_heathdoctorA!=null) { image1.ImageUrl = "\\Images\\" + V_heathdoctorA.doctor.ToString().Trim() + ".png"; } else { image1.ImageUrl = "\\Images\\计文军.png"; this.LabelD1.Text = "计文军"; } if (V_heathdoctorB!=null ) { image2.ImageUrl = "\\Images\\" + V_heathdoctorB.doctor.ToString().Trim() + ".png"; } else { image2.ImageUrl = "\\Images\\董振香.png"; this.LabelD2.Text = "董振香"; } }
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 }
//判断预约是有锁定,如果为锁定者进行锁定 ,待定用户完成预约 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; } }