public void GetUserInfo() { QJVRMS.Business.MemberShipManager msm = new QJVRMS.Business.MemberShipManager(); QJVRMS.Business.User user = msm.GetUser(CurrentUser.UserId); loginname.Text = user.UserLoginName; name.Text = user.UserName; tel.Text = user.Telphone; email.Text = user.Email; if (user.IsLocked) { state.Text = "无效"; } else { state.Text = "有效"; } userGroup.Text = user.GroupName; // Response.Write(CurrentUser.UserId.ToString()+" "+CurrentUser.UserGroupId.ToString() + " " + CurrentUser.GroupName); }
protected void BindLog(int pageSize,int pageIndex) { string username = txtLoginName.Text.Trim(); string userId = ""; if (!string.IsNullOrEmpty(username)) { MemberShipManager msm = new MemberShipManager(); if (msm.IsUserExist(username)) { User _user = msm.GetUser(username); if (_user != null) { userId = _user.UserId.ToString(); } } else { GridView1.EmptyDataText = "没有该用户"; this.AspNetPager1.RecordCount = 0; GridView1.DataSource = null;//ds; GridView1.DataBind(); return; } } if (t_Date.Text != string.Empty && e_Date.Text != string.Empty) { DateTime begin = Convert.ToDateTime(t_Date.Text); DateTime end = Convert.ToDateTime(e_Date.Text).AddDays(1); DataSet ds; Resource obj = new Resource(); ds = obj.GetResourcesUploadLog(begin, end, pageSize, pageIndex, userId); if (ds != null && ds.Tables[1].Rows.Count > 0) { this.AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); GridView1.DataSource = ds.Tables[1]; GridView1.DataBind(); } else { this.AspNetPager1.RecordCount = 0; GridView1.DataSource = null;//ds; GridView1.DataBind(); } } }
private void LoadData() { HttpCookie cookie = Request.Cookies.Get("ShoppingCart"); DataTable dt = new DataTable(); if (cookie != null) { if (cookie["GiftId"] != null && cookie["GiftCount"] != null) { string[] giftIds = cookie["GiftId"].Split(new char[] { ',' }); string[] giftCounts = cookie["GiftCount"].Split(new char[] { ',' }); GiftBiz biz = new GiftBiz(); dt.Columns.Add("giftid"); dt.Columns.Add("gifttitle"); dt.Columns.Add("giftcount"); dt.Columns.Add("Quantity"); for (int i = 0; i < giftIds.Length; i++) { if (giftIds[i] != string.Empty) { DataRow newRow = dt.NewRow(); newRow["giftid"] = giftIds[i]; newRow["giftcount"] = giftCounts[i]; GiftInfo model = biz.GetModel(giftIds[i]); if (model == null) { continue; } newRow["gifttitle"] = model.Title; newRow["Quantity"] = model.Quantity; dt.Rows.Add(newRow); } } } } MemberShipManager msm = new MemberShipManager(); User cuser = msm.GetUser(CurrentUser.UserId); Contactor.Text = CurrentUser.UserName; Tel.Text = cuser.Telphone; Email.Text = cuser.Email; order_bar.Visible = (dt.Rows.Count > 0); lnkSubmitOrder.Visible = false; gvShoppingCartList.DataSource = dt; gvShoppingCartList.DataBind(); }
private void LoadData() { OrdersBiz biz = new OrdersBiz(); OrderInfo model = biz.GetOrderInfo(ViewState["OrderId"].ToString()); lOrderId.Text = model.OrderId; lCreateTime.Text = model.CreateDate.ToString() ; lState.Text = OrdersBiz.GetStateString(model.State); Address.Text = model.Address; MemberShipManager manager = new MemberShipManager(); User user = manager.GetUser(new Guid(model.UserId)); lUserName.Text = user.UserName; Contactor.Text = model.Contactor; tel.Text = model.Tel; email.Text = model.Email; GroupName.Text = user.GroupName; DataTable dt = biz.GetOrders_DetailList(-1, ViewState["OrderId"].ToString(), string.Empty, string.Empty); gvOrders_Detail.DataSource = dt; gvOrders_Detail.DataBind(); }
protected void lblUser_DataBinding(object sender, EventArgs e) { Label lbl = sender as Label; MemberShipManager manager = new MemberShipManager(); lbl.Text = manager.GetUser(new Guid(lbl.Text)).UserName; }
/// <summary> /// 取用户姓名 /// </summary> /// <param name="userID"></param> /// <returns></returns> protected string GetUserName(string userID) { MemberShipManager manager = new MemberShipManager(); User user = manager.GetUser(new Guid(userID)); return user.UserName; }
/// <summary> /// 生成订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkCreateOrder_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(address.Text)) { ShowMessage("请填写寄送地址."); address.Focus(); return; } string orderId = CreateOrder(1); if (orderId != string.Empty) { MemberShipManager msm = new MemberShipManager(); string url = "http://" + Request.Url.Host + "/Modules/Orders/Orders_Info.aspx?orderId=" + orderId; List<string> mailAddress = new List<string>(); //取管理邮箱 mailAddress.Add(msm.GetUser(SuperAdminLoginId).Email); //mailAddress.Add(ConfigurationManager.AppSettings["ManagerMail"]); string title = "物料/礼品订单-来自 "+CurrentUser.UserName ; System.Text.StringBuilder content = new System.Text.StringBuilder(); content.Append("用户 "); content.Append(CurrentUser.UserName); content.Append(" 提交新订单"); content.Append("<br/>"); content.Append("<a target='_blank' href='" + url + "'>" + url + "</a>"); content.Append("<br/>"); content.Append("登录系统后点击或复制地址进行浏览"); //MailManager.SendMail(mailAddress, title, content.ToString()); //ShowAndRedirect("订单已提交", "/Modules/UserProfile.aspx?mode=order"); ShowMessage("订单已提交"); Response.Redirect("/Modules/UserProfile.aspx?tabId=2"); } }
protected void btnValidate_Click(object sender, EventArgs e) { string reason = this.txtReason.Text.Trim().Replace("'", "''"); string id = this.hItemId.Value; QJVRMS.Business.Orders obj = new QJVRMS.Business.Orders(); if (obj.UpdateStatus(id,(int)OrderStatus.NotPass)) { obj.AddOrderNotPassReason(id, reason); ShowMessage("操作完成"); //发送邮件 string mailBody = "订单"; try { DataSet ds = obj.GetOrdersById(id); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; string _title = dr["title"].ToString(); string _rd = dr["RequestDate"].ToString(); string _size = dr["RequestSize"].ToString(); string _usage = dr["usage"].ToString(); string _content = dr["contents"].ToString(); string _addDate = dr["AddDate"].ToString(); string _userName = dr["userName"].ToString(); MemberShipManager objUserOP = new MemberShipManager(); User objUser = objUserOP.GetUser(dr["userName"].ToString()); string _userRealName = objUser.UserName; string _userEmail = objUser.Email; string templatePath = Server.MapPath("../orderMailTemplate.htm"); mailBody = new StreamReader(templatePath).ReadToEnd(); mailBody = mailBody.Replace("{txtAddDate}", _addDate); mailBody = mailBody.Replace("{txtUserName}", _userName); mailBody = mailBody.Replace("{txtUserRealName}", _userRealName); mailBody = mailBody.Replace("{txtContents}", _content.Replace("\r\n", "<br>")); mailBody = mailBody.Replace("{txtUsage}", _usage); mailBody = mailBody.Replace("{txtRD}", _rd); mailBody = mailBody.Replace("{txtTitle}", _title); string link = "<a href='http://{0}/{1}/Modules/UserProfile.aspx?tabid=2&orderStatus="+((int)OrderStatus.NotPass).ToString()+"' target='_blank'>去我的订单中查看详细信息</a>"; mailBody = mailBody.Replace("{link}", string.Format(link, Request.Url.Authority, Request.ApplicationPath)); //这里需要改变一下,将收件人的地址加上 string mailSubject = "您的订单没有被受理"; Session["MailBody"] = mailBody; //obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script language='javascript'>doClose('" + _userEmail + "', '" + mailSubject + "')</script>"); } } catch (Exception ex) { LogWriter.WriteExceptionLog(ex); } } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script language='javascript'>doClose();</script>"); }
protected void lbComplete_Click(object sender, EventArgs e) { string mailBody = string.Empty; string mailSubject = string.Empty; string id = _orderId; int toStatus = (int)OrderStatus.Completed; mailSubject = "您的订单已经完成,请上线查看相关图片"; QJVRMS.Business.Orders obj = new QJVRMS.Business.Orders(); if (obj.UpdateStatus(id, toStatus)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>doAccept();</script>"); //发送邮件 mailBody = "订单"; try { DataSet ds = obj.GetOrdersById(id); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; string _title = dr["title"].ToString(); string _rd = dr["RequestDate"].ToString(); string _size = dr["RequestSize"].ToString(); string _usage = dr["usage"].ToString(); string _content = dr["contents"].ToString(); string _addDate = dr["AddDate"].ToString(); string _userName = dr["userName"].ToString(); MemberShipManager objUserOP = new MemberShipManager(); User objUser = objUserOP.GetUser(dr["userName"].ToString()); string _userRealName = objUser.UserName; string _userEmail = objUser.Email; string templatePath = Server.MapPath("orderMailTemplate.htm"); mailBody = new StreamReader(templatePath).ReadToEnd(); mailBody = mailBody.Replace("{txtAddDate}", _addDate); mailBody = mailBody.Replace("{txtUserName}", _userName); mailBody = mailBody.Replace("{txtUserRealName}", _userRealName); mailBody = mailBody.Replace("{txtContents}", _content.Replace("\r\n", "<br>")); mailBody = mailBody.Replace("{txtUsage}", _usage); mailBody = mailBody.Replace("{txtRD}", _rd); mailBody = mailBody.Replace("{txtTitle}", _title); string link = "<a href='http://{0}/{1}/Modules/UserProfile.aspx?tabid=2&orderStatus=" + toStatus.ToString() + "' target='_blank'>去我的订单中查看详细信息</a>"; mailBody = mailBody.Replace("{link}", string.Format(link, Request.Url.Authority, Request.ApplicationPath)); Session["MailBody"] = mailBody; //obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script language='javascript'>sendMail('" + _userEmail + "', '" + mailSubject + "')</script>"); } } catch (Exception ex) { LogWriter.WriteExceptionLog(ex); } } }
protected void grvOrders_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToLower().Equals("page")) { return; } string mailBody = string.Empty; string mailSubject = string.Empty; int toStatus=0; if (e.CommandName.ToLower().Equals("isprocessing")) { toStatus=(int)OrderStatus.IsProcessing; mailSubject = "您的订单被受理"; } else if (e.CommandName.ToLower().Equals("notpass")) { toStatus=(int)OrderStatus.NotPass; mailSubject = "您的订单没有被受理"; } else if (e.CommandName.ToLower().Equals("selectimage")) { //toStatus=(int)OrderStatus.IsProcessing; } else if (e.CommandName.ToLower().Equals("complete")) { toStatus=(int)OrderStatus.Completed; mailSubject = "您的订单已经完成,请上线查看相关图片"; } string id = e.CommandArgument.ToString(); QJVRMS.Business.Orders obj = new QJVRMS.Business.Orders(); if(obj.UpdateStatus(id,toStatus)) { ShowMessage("操作完成"); bindMyOrders(); //发送邮件 mailBody = "订单"; try { DataSet ds = obj.GetOrdersById(id); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; string _title = dr["title"].ToString(); string _rd = dr["RequestDate"].ToString(); string _size = dr["RequestSize"].ToString(); string _usage = dr["usage"].ToString(); string _content = dr["contents"].ToString(); string _addDate = dr["AddDate"].ToString(); string _userName = dr["userName"].ToString(); MemberShipManager objUserOP = new MemberShipManager(); User objUser = objUserOP.GetUser(dr["userName"].ToString()); string _userRealName = objUser.UserName; string _userEmail = objUser.Email; string templatePath = Server.MapPath("../orderMailTemplate.htm"); mailBody = new StreamReader(templatePath).ReadToEnd(); mailBody = mailBody.Replace("{txtAddDate}", _addDate); mailBody = mailBody.Replace("{txtUserName}", _userName); mailBody = mailBody.Replace("{txtUserRealName}", _userRealName); mailBody = mailBody.Replace("{txtContents}", _content.Replace("\r\n", "<br>")); mailBody = mailBody.Replace("{txtUsage}", _usage); mailBody = mailBody.Replace("{txtRD}", _rd); mailBody = mailBody.Replace("{txtTitle}", _title); //mailBody = mailBody.Replace("{host}", Request.Url.Authority); //mailBody = mailBody.Replace("{apppath}", Request.ApplicationPath); string link = "<a href='http://{0}/{1}/Modules/UserProfile.aspx?tabid=2&orderStatus=" + toStatus.ToString() + "' target='_blank'>去我的订单中查看详细信息</a>"; mailBody = mailBody.Replace("{link}", string.Format(link, Request.Url.Authority, Request.ApplicationPath)); Session["MailBody"] = mailBody; //obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script language='javascript'>sendMail('" + _userEmail + "', '" + mailSubject + "')</script>"); } } catch (Exception ex) { LogWriter.WriteExceptionLog(ex); } } }