protected void PrepareForm() { drpMedal.DataSource = USR_MedalBll.GetInstance().GetList(); drpMedal.DataTextField = "MedalName"; drpMedal.DataValueField = "SysNo"; drpMedal.DataBind(); drpMedal.Items.Insert(0, new ListItem("选择要颁发的勋章", "0")); if (Request.QueryString["user"] != null && Request.QueryString["user"] != "") { try { rptFamous.DataSource = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(Request.QueryString["user"]), 0); rptFamous.DataBind(); } catch { Response.Redirect("../Error.aspx?msg="); return; } } else { Response.Redirect("../Error.aspx?msg="); return; } }
public void Delete() { try { REL_Customer_MedalBll.GetInstance().Delete(int.Parse(Request.QueryString["delete"])); this.ltrNotice.Text = "该记录已删除!"; base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true); PrepareForm(); } catch { this.ltrError.Text = "系统错误,删除失败!"; base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true); } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { e.Item.FindControl("LinkButton1").Visible = true; if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()) { e.Item.FindControl("LinkButton1").Visible = false; } e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } else { e.Item.FindControl("LinkButton1").Visible = false; if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) || GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } } Repeater m_rpt = (Repeater)e.Item.FindControl("Repeater3"); DataTable m_dt = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString())); if (m_dt != null) { m_dt.Columns.Add("color"); for (int i = 0; i < m_dt.Rows.Count; i++) { if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString()) { m_dt.Rows[i]["color"] = "color: #A5534C"; } } m_rpt.DataSource = m_dt; m_rpt.DataBind(); } Repeater m_rpt1 = (Repeater)e.Item.FindControl("Repeater4"); DataTable m_dt1 = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0); if (m_dt1 != null) { m_rpt1.DataSource = m_dt1; m_rpt1.DataBind(); } }
public ReturnValue <List <USR_MedalMod> > GetCustomerMedal(int customersysno) { DataTable m_dt = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(customersysno, 0); List <USR_MedalMod> ret = new List <USR_MedalMod>(); if (m_dt == null || m_dt.Rows.Count == 0) { return(ReturnValue <List <USR_MedalMod> > .Get200OK(ret)); } for (int i = 0; i < m_dt.Rows.Count; i++) { USR_MedalMod tmp_medal = MapUSR_Medal(m_dt.Rows[i]); ret.Add(tmp_medal); } return(ReturnValue <List <USR_MedalMod> > .Get200OK(ret)); }
public ReturnValue <USR_CustomerShow> GetUserInfo(int uid) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(uid); if (m_user.SysNo != -999999) { USR_CustomerShow ret = new USR_CustomerShow(); m_user.MemberwiseCopy(ret); DataTable m_dt = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(uid, 0); ret.TotalMedal = m_dt.Rows.Count; int total = 0; DataTable m_dt1 = USR_MessageBll.GetInstance().GetMessageByCustomer(uid, 1, 1, 0, 1, ref total); ret.NewMessage = total; return(ReturnValue <USR_CustomerShow> .Get200OK(ret)); } else { throw new BusinessException("用户ID错误,请重新输入!"); } }
protected void Unnamed1_Click(object sender, EventArgs e) { if (drpMedal.SelectedIndex == 0) { ltrError.Text = "请选择勋章!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } if (REL_Customer_MedalBll.GetInstance().HasMedal(int.Parse(Request.QueryString["user"]), int.Parse(drpMedal.SelectedValue))) { ltrError.Text = "该用户已经拥有该勋章!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } REL_Customer_MedalMod m_medal = new REL_Customer_MedalMod(); m_medal.CustomerSysNo = int.Parse(Request.QueryString["user"]); m_medal.MedalSysNo = int.Parse(drpMedal.SelectedValue); m_medal.TS = DateTime.Now; m_medal.DR = 0; try { REL_Customer_MedalBll.GetInstance().Add(m_medal); LogManagement.getInstance().WriteTrace(m_medal.SysNo, "CustomerMedal.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); PrepareForm(); } catch { ltrError.Text = "系统错误,添加失败!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { //e.Item.FindControl("LinkButton1").Visible = true; //if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()) //{ // e.Item.FindControl("LinkButton1").Visible = false; //} e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } else { //e.Item.FindControl("LinkButton1").Visible = false; if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) || GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } } #region 绑定评论列表 Repeater m_rpt = (Repeater)e.Item.FindControl("Repeater3"); DataTable m_dt = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString())); if (m_dt != null) { m_dt.Columns.Add("color"); for (int i = 0; i < m_dt.Rows.Count; i++) { if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString()) { m_dt.Rows[i]["color"] = "color: #A5534C"; } } m_rpt.DataSource = m_dt; m_rpt.DataBind(); } #endregion #region 绑定用户奖章 Repeater m_rpt1 = (Repeater)e.Item.FindControl("Repeater4"); DataTable m_dt1 = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0); if (m_dt1 != null) { m_rpt1.DataSource = m_dt1; m_rpt1.DataBind(); } #endregion #region 设置报价单权限 DataRowView rowv = (DataRowView)e.Item.DataItem; if (rowv["Price"] != null && rowv["Price"].ToString() != "") { if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) //求测者 { e.Item.FindControl("LinkButton5").Visible = false; //报价单无法删除 if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforepay).ToString()) { e.Item.FindControl("buyicon").Visible = true; } else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforeconfirm).ToString()) { e.Item.FindControl("confirmicon").Visible = true; DateTime replytime = DateTime.Parse(rowv["replytime"].ToString()); if (replytime != AppConst.DateTimeNull) { TimeSpan m_span = replytime.AddHours(AppConst.ConsultConfirmTime) - DateTime.Now; string tmpstr = ""; if (m_span.Days > 0) { tmpstr += m_span.Days + "天"; } if (m_span.Days > 0) { tmpstr += m_span.Hours + "小时"; } ((Literal)e.Item.FindControl("Literal4")).Text = tmpstr; } } else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString()) { e.Item.FindControl("buyedtip").Visible = true; DateTime paytime = ORD_CashBll.GetInstance().GetPayTimeByQAOrder(int.Parse(rowv["ordersysno"].ToString())); if (paytime != AppConst.DateTimeNull) { TimeSpan m_span = paytime.AddHours(AppConst.ConsultReplyTime) - DateTime.Now; string tmpstr = ""; if (m_span.Days > 0) { tmpstr += m_span.Days + "天"; } if (m_span.Days > 0) { tmpstr += m_span.Hours + "小时"; } ((Literal)e.Item.FindControl("Literal3")).Text = tmpstr; } else { ShowError(""); } } } if (GetSession().CustomerEntity.SysNo == Convert.ToInt32(rowv["CustomerSysNo"]))//占卜师 { if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString()) { e.Item.FindControl("replyicon").Visible = true; } } } #endregion }