Beispiel #1
0
        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;
        }
Beispiel #2
0
        protected void lbIsProcessing_Click(object sender, EventArgs e)
        {
            string mailBody    = string.Empty;
            string mailSubject = string.Empty;
            string id          = _orderId;
            int    toStatus    = (int)OrderStatus.IsProcessing;

            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);
                }
            }
        }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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();
                }
            }
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        /// <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");
            }
        }
Beispiel #8
0
        /// <summary>
        /// 输出值 0 用户名密码为空 1 成功 2 密码错误
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            HttpRequest  Request  = context.Request;
            HttpResponse Response = context.Response;

            Response.CacheControl = "no-cache";
            Response.AddHeader("Pragma", "no-cache");
            Response.Expires = -1441;

            string _userName = Request["userName"];
            string _password = Request["password"];
            string _ret      = "0";

            if (string.IsNullOrEmpty(_userName) || string.IsNullOrEmpty(_password))
            {
                Response.Write(_ret);
                return;
            }

            #region 登陆使用方法
            MemberShipManager msm  = new MemberShipManager();
            object            temp = null;
            bool isValidate        = false;

            //Form 验证
            if (!CommonInfo.AuthByAD)
            {
                isValidate = msm.AuthUserByForm(_userName,
                                                _password,
                                                Request.UserHostAddress,
                                                ref temp);
            }//AD 验证
            else
            {
                isValidate = msm.AuthUserByAD(CommonInfo.DomainName,
                                              CommonInfo.DomainNamePrefix + @"\" + _userName,
                                              _userName, _password,
                                              ref temp);
            }


            if (isValidate)
            {
                //转换为业务对象
                QJVRMS.Business.User user = temp as QJVRMS.Business.User;


                //AD验证 获取用户在系统中的特有信息
                if (CommonInfo.AuthByAD)
                {
                    User userInfo = msm.GetUser(_userName);

                    user.GroupName  = userInfo.GroupName;
                    user.IsDownLoad = userInfo.IsDownLoad;
                    user.UserId     = userInfo.UserId;//用户表中的ID替换AD中的ID。
                    user.GroupId    = userInfo.GroupId;
                }

                //用户Session信息
                string userData = string.Empty;
                userData = user.UserId + "," + user.GroupId + "," + _userName + "," + user.UserName + "," + user.GroupName + "," + user.IsDownLoad;


                FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1,
                                                                                 _userName,
                                                                                 DateTime.Now,
                                                                                 DateTime.Now.AddMinutes(WebUI.UIBiz.CommonInfo.CookieTimeout),
                                                                                 false,
                                                                                 userData,
                                                                                 "/"); //建立身份验证票对象
                string     HashTicket = FormsAuthentication.Encrypt(Ticket);           //加密序列化验证票为字符串
                HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);
                UserCookie.Expires = DateTime.Now.AddMonths(1);
                //生成Cookie
                Response.Cookies.Add(UserCookie); //输出Cookie
                //Response.Redirect(FormsAuthentication.DefaultUrl);


                //这里为该用户创立一个默认的收藏夹,用户必须要有一个收藏夹,即使都删除了,下次登录还是会有一个
                Resource r = new Resource();
                r.CreateDefaultLightbox(user.UserId);

                _ret = "1";

                LogEntity model = new LogEntity();
                model.id           = Guid.NewGuid();
                model.userId       = user.UserId;
                model.userName     = _userName;
                model.EventType    = ((int)LogType.Login).ToString();
                model.EventResult  = "成功";
                model.EventContent = "";
                model.IP           = HttpContext.Current.Request.UserHostAddress;
                model.AddDate      = DateTime.Now;
                new Logs().Add(model);
            }
            else
            {
                _ret = "2"; //用户名密码不正确,或者没有权限

                LogEntity model = new LogEntity();
                model.id           = Guid.NewGuid();
                model.userId       = new Guid();
                model.userName     = _userName;
                model.EventType    = ((int)LogType.Login).ToString();
                model.EventResult  = "失败";
                model.EventContent = "错误的密码:" + _password;
                model.IP           = HttpContext.Current.Request.UserHostAddress;
                model.AddDate      = DateTime.Now;
                new Logs().Add(model);
            }

            #endregion

            //Response.Write(_ret+":"+context.Session.SessionID);
            Response.Write(_ret);
            Response.End();
        }
Beispiel #9
0
        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>");
        }
Beispiel #10
0
        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);
                }
            }
        }