Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
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();
                }
            }
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到某个用户的roleId,groupid
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public string[] GetVrmsId(string userName, string password)
        {
            string roleName  = "";
            string groupName = "";
            string email     = "";

            string[] arr = MemberShipManager.GetBossGroup(userName, password);

            roleName  = GetVrmsRoleByBossRole(arr[1]);
            groupName = GetVrmsGroupByBossGroup(arr[0]);
            email     = arr[2];


            string[] arrRet = new string[] { Role.GetRoleIdByName(roleName), Group.GetGroupIdByGroupName(groupName), email };

            return(arrRet);
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
        protected void ChangePasswordImageButton_Click(object sender, EventArgs e)
        {
            string oldpwd = this.txtOldPwd.Text.Trim();
            string newpwd = this.NewPassword.Text.Trim();
            string repwd = this.ConfirmNewPassword.Text.Trim();

            if (newpwd != repwd)
            {
                ShowMessage("������������벻һ��!");
                return;
            }

            if (newpwd.Length > 10)
            {
                ShowMessage("���볤�Ȳ��ܴ���10!");
                return;
            }

            MemberShipManager msm = new MemberShipManager();
            System.Guid UserIdGuid = CurrentUser.UserId;
            try
            {
                if (msm.ChangePassword(UserIdGuid, oldpwd, newpwd))
                {
                    this.Label1.Text = "�޸�����ɹ�!";
                }
                else
                {
                    this.Label1.Text = "�޸�����ʧ��!";
                }
            }
            catch
            {
                this.Label1.Text = "�޸�����ʧ��!";
            }
        }
Ejemplo n.º 7
0
        protected void EditUserInfo(bool isCreated)
        {
            string loginName = UserInfo.LoginName;
            string userName = UserInfo.UserName;
            string pwd = UserInfo.Password;

            if (pwd == string.Empty) pwd = "abcd1234";

            string email = UserInfo.Email;
            string tel = UserInfo.Tel;
            bool islocked = UserInfo.IsLocked;
            bool isIPValidate = UserInfo.IsIPValidate;
            string isdownload = UserInfo.IsDownLoad;




            //新建用户
            if (isCreated)
            {
                //
                try
                {
                    MemberShipManager msm = new MemberShipManager();
                    if (msm.IsUserExist(loginName))
                    {
                        ShowMessage("此用户名已存在");
                    }
                    else
                    {

                        IUser user = msm.CreateUser(pwd, loginName, userName, SelDeptId, email, tel, islocked, isdownload, isIPValidate);

                        if (user == null) throw new Exception("Error");

                        ShowMessage("新建用户成功");

                        this.ShowUserManager();

                    }
                }
                catch (Exception ex)
                {
                    QJVRMS.Common.LogWriter.WriteExceptionLog(ex, true);
                    ShowMessage("新建用户失败");
                }
            }
            else
            {
                MemberShipManager msm = new MemberShipManager();

                if (msm.ModifyUserInfo(new Guid(this.hiUserId.Value), SelDeptId, userName, email, tel, islocked, isdownload, isIPValidate))
                {
                    ShowMessage("修改用户信息成功");
                    this.ShowUserManager();
                }
                else
                {
                    ShowMessage("修改用户信息失败");
                }


            }
        }
Ejemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            Response.ContentType = "text/plain";

            string action = Request.QueryString["action"];

            if (string.IsNullOrEmpty(action))
            { 
                
            
            }
            else if (action.Trim().ToLower().Equals("validatealert"))
            {
                //是否提醒
                Resource obj = new Resource();
                string userId = Request.QueryString["userId"];
                string isSuperAdmin=Request.QueryString["isSuperAdmin"];

                if (!string.IsNullOrEmpty(userId))
                {
                    if(string.IsNullOrEmpty(isSuperAdmin))
                    {
                        isSuperAdmin="0";
                    }

                    if (obj.IsAlertAdmin(new Guid(userId),isSuperAdmin))
                    {
                        Response.Write("1"); //有新的图片等待审核
                        Response.End();
                    }
                    else
                    {
                        Response.Write("0"); //没有需要审核的图片
                        Response.End();
                    }



                }
                Response.Write("0"); //不用提醒
                Response.End();
            }
            else if (action.Trim().ToLower().Equals("delbatch"))
            { 
                //批量删除

                string itemIds = Request.Form["itemIds"];
                if (string.IsNullOrEmpty(itemIds))
                {
                    Response.Write("0"); //参数错误
                    Response.End();
                    
                }
                itemIds = itemIds.TrimEnd(";".ToCharArray());

                string userId = Request.QueryString["userId"];

                string[] arrId = itemIds.Split(";".ToCharArray());
                foreach (string id in arrId)
                {
                    //删除的图片要记录一下

                    byte[] buffer;

                    ResourceEntity re = null;
                    Resource r = new Resource();
                    re = r.GetResourceInfoByItemId(id);
                    
                    string ItemSerialNum = "";
                    string ImageType = "";
                    string str = "";//判断170图片或者400图片有没有被删除

                    ItemSerialNum = re.ItemSerialNum;
                    //ItemSerialNum = lb_ItemSerialNum.Text;
                    //ImageType = lb_ImageType.Text;
                    //bool isValidate = QJVRMS.Business.ImageStorageClass.DeleteImageStorage(new Guid(this.Hidden_ItemId.Value));

                    bool isValidate = Resource.DeleteResource(re.ItemId);
                    string attachmentFolder = string.Empty;

                    string sourceFolder = string.Empty;
                    string attachmentsFolder = string.Empty;
                    if (re.ResourceType.ToLower().Equals("image"))
                    {
                        string _170Folder;
                        string _400Folder;

                        ImageType obj = new ImageType();
                        
                        try
                        {
                            
                            //记录图片
                            
                            string img = obj.GetPreviewPath(re.FolderName, re.ServerFileName, "170");
                            ImageHelper objImgHelper = new ImageHelper(img);
                            objImgHelper.Resize(80);
                            using (MemoryStream ms = new MemoryStream())
                            {
                                objImgHelper.GetImage().Save(ms, ImageFormat.Jpeg);
                                buffer = ms.ToArray();
                            }
                            objImgHelper.Dispose();



                            //记录日志
                            if (!string.IsNullOrEmpty(userId))
                            {
                                User objUser = new MemberShipManager().GetUser(new Guid(userId));
                                if (objUser != null)
                                {

                                    //日志,所有的删除,只记录一次
                                    LogEntity model = new LogEntity();
                                    model.id = Guid.NewGuid();
                                    model.userId = objUser.UserId;
                                    model.userName = objUser.UserLoginName;
                                    model.EventType = ((int)LogType.DeleteResource).ToString();
                                    model.EventResult = "成功";
                                    model.EventContent = "图片序号:"+re.ItemSerialNum;
                                    model.IP = HttpContext.Current.Request.UserHostAddress;
                                    model.AddDate = DateTime.Now;
                                    new Logs().Add(model);

                                    r.SaveDeletedImage(model.id, buffer);
                                }

                            }


                            File.Delete(obj.GetSourcePath(re.FolderName, re.ServerFileName));
                            attachmentsFolder = obj.SourcePaths[obj.PathNumber].Trim();
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "170"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "400"));



                        }
                        catch { }
                    }
                    else if (re.ResourceType.ToLower().Equals("video"))
                    {
                        string _previewPolder = CommonInfo.VideoPreviewPath;

                        VideoType obj = new VideoType();
                        
                        try
                        {
                            File.Delete(obj.GetSourcePath(string.Empty, re.ServerFileName));
                            attachmentsFolder = obj.SourcePaths[obj.PathNumber].Trim();
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "flv"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "image"));
                            File.Delete(obj.GetPreviewPath(re.FolderName, re.ServerFileName, "smallflv"));
                        }
                        catch
                        {

                        }
                    }

                    //sourceFolder = Path.Combine(sourceFolder, CurrentUser.UserLoginName);
                    //sourceFolder = Path.Combine(sourceFolder, WebUI.UIBiz.CommonInfo.AttachFolder);

                    #region 删除物理文件 by ciqq 2010-4-2
                   
                    //删除所有的附件
                    //string sourceFolder = Path.Combine(WebUI.UIBiz.CommonInfo.ImageRootPath, this.hiFolder.Value);

                    //根据资源ID获得所有的附件

                    DataTable dt = Resource.GetAttachList(new Guid(id));

                    //dt.Columns.Add("fileNamefileLength");

                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    dr["fileNamefileLength"] = dr["filename"].ToString() + " ( " + Tool.toFileSize(Convert.ToInt64(dr["fileLength"].ToString())) + " ) ";

                    //}

                    //this.attList.DataSource = dt;
                    //this.attList.DataBind();


                    string fileName = "";
                    attachmentsFolder = Path.Combine(attachmentsFolder, re.FolderName);
                    attachmentsFolder = Path.Combine(attachmentsFolder, UIBiz.CommonInfo.AttachFolder);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //fileName = this.attList.DataKeys[i].Values[1].ToString();
                        fileName = dt.Rows[i]["filename"].ToString();
                        fileName = Path.Combine(attachmentsFolder, fileName);
                        try
                        {
                            File.Delete(fileName);
                        }
                        catch (Exception ex)
                        {
                            LogWriter.WriteExceptionLog(ex);
                        }
                    }                   
                    #endregion
                }


                

                Response.Write("0"); //不用提醒
                Response.End();


                
              
                
            }


        }
Ejemplo n.º 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>");

        }
Ejemplo n.º 10
0
        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);

        }
Ejemplo n.º 11
0
        public static bool AuthUserByRequest(string loginName, string password, string ipAddress, ref object returnObj, bool isCreated)
        {
            string addressParam = ConfigurationManager.AppSettings["RequestUrl"];
            string lnParam      = ConfigurationManager.AppSettings["LoginNameParamName"];
            string pParam       = ConfigurationManager.AppSettings["PasswordParamName"];
            string ipParam      = ConfigurationManager.AppSettings["IPParamName"];

            string url;

            if (addressParam.Contains("?"))
            {
                url = addressParam + "&" + lnParam + "=" + loginName + "&" + pParam + "=" + password + "&" + ipParam + "=" + ipAddress;
            }
            else
            {
                url = addressParam + "?" + lnParam + "=" + loginName + "&" + pParam + "=" + password + "&" + ipParam + "=" + ipAddress;
            }


            string result = DoGetRequest(url);

            if (result == "0")
            {
                //这里远程验证如果错误的话,就进行一次数据库验证
                QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService();
                SerializeObjectFactory sof = new SerializeObjectFactory();
                string objStr = mss.AuthUserByForm(loginName, password, ipAddress);

                if (!string.IsNullOrEmpty(objStr))
                {
                    object o = sof.DesializeFromBase64(objStr);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)o;
                    returnObj = user;
                    return(true);
                }

                return(false);
            }
            else
            {
                //这里先要获得该用户的机构(groupId)和角色(roleId)
                string[] arrIds  = new Boss().GetVrmsId(loginName, password);
                string   roleId  = arrIds[0];
                string   groupId = arrIds[1];
                string   email   = arrIds[2];

                if (string.IsNullOrEmpty(roleId))
                {
                    roleId = ConfigurationManager.AppSettings["RoleID"];
                }
                if (string.IsNullOrEmpty(groupId))
                {
                    groupId = "356b8e9c-005d-47ae-8aad-e7d1d60a1496";
                }

                if (string.IsNullOrEmpty(email))
                {
                    email = loginName + "@quanjing.com";
                }



                if (isCreated)
                {
                    MemberShipManager msm = new MemberShipManager();
                    //string email = loginName + "@sany.com.cn";
                    IUser u = msm.CreateUser(password, loginName, loginName,
                                             new Guid(groupId), email, string.Empty, false, "false", false);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)u;
                    //string roleID = ConfigurationManager.AppSettings["RoleID"];
                    string roleID = roleId;
                    //分配角色
                    Role.CreateRoleUsers(new Guid[] { new Guid(roleID) }, user.UserId);
                    returnObj = user;
                }
                else
                {
                    QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService();
                    SerializeObjectFactory sof = new SerializeObjectFactory();

                    //string objStr = mss.AuthUserByForm(loginName, password, ipAddress);
                    string objStr = mss.GetUserByLoginName(loginName);

                    object o = sof.DesializeFromBase64(objStr);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)o;
                    returnObj = user;

                    //如果数据库里有这个用户的话,就更新一次密码(这里应该判断一下用户是否相等),更新一下角色、机构和email
                    mss.ResetPassword(user.UserId, password);

                    bool isDownloaded = false;
                    if (user.IsDownLoad.ToLower().Equals("true"))
                    {
                        isDownloaded = true;
                    }
                    mss.ModifyUserInfo1(user.UserId, new Guid(groupId), user.UserName, email, user.Telphone, user.IsLocked, isDownloaded, user.IsIPValidate);

                    Role.CreateRoleUsers(new Guid[] { new Guid(roleId) }, user.UserId);
                }
            }

            return(true);
        }
Ejemplo n.º 12
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");
                
            }
        }
Ejemplo n.º 13
0
        //重置密码
        protected void btnResetPwd_Click(object sender, EventArgs e)
        {
            string pwd = this.txtNewPwd.Text.Trim();
            string repwd = this.txtReNewPwd.Text.Trim();

            if (pwd != repwd)
            {
                ShowMessage("密码不一致");
                return;
            }
            Regex reg = new Regex(@"(^(\w){3,10}$)");
            if (!reg.IsMatch(pwd))
            {
                ShowMessage("密码只能输入3-10个字母、数字、下划线");
                return;

            }
            MemberShipManager msm = new MemberShipManager();

            try
            {
                if (msm.ResetPassword(new Guid(this.hiUserId.Value), pwd))
                {
                    ShowMessage("重置密码成功");
                }
                else
                {
                    ShowMessage("重置密码失败");
                }

            }
            catch
            {
                ShowMessage("重置密码失败");
            }

        }
Ejemplo n.º 14
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;
 }
Ejemplo n.º 15
0
        public static bool AuthUserByRequest(string loginName, string password, string ipAddress, ref object returnObj, bool isCreated) {
            string addressParam = ConfigurationManager.AppSettings["RequestUrl"];
            string lnParam = ConfigurationManager.AppSettings["LoginNameParamName"];
            string pParam = ConfigurationManager.AppSettings["PasswordParamName"];
            string ipParam = ConfigurationManager.AppSettings["IPParamName"];

            string url;
            if (addressParam.Contains("?"))
            {
                url = addressParam + "&" + lnParam + "=" + loginName + "&" + pParam + "=" + password + "&" + ipParam + "=" + ipAddress;
            }
            else
            {
                url = addressParam + "?" + lnParam + "=" + loginName + "&" + pParam + "=" + password + "&" + ipParam + "=" + ipAddress;                
            }
            
                
            string result = DoGetRequest(url);

            if (result == "0") {

                //这里远程验证如果错误的话,就进行一次数据库验证
                QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService();
                SerializeObjectFactory sof = new SerializeObjectFactory();
                string objStr = mss.AuthUserByForm(loginName, password, ipAddress);                

                if (!string.IsNullOrEmpty(objStr))
                {
                    object o = sof.DesializeFromBase64(objStr);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)o;
                    returnObj = user;
                    return true;
                }

                return false;
            }
            else {



                //这里先要获得该用户的机构(groupId)和角色(roleId)
                    string[] arrIds = new Boss().GetVrmsId(loginName, password);
                    string roleId = arrIds[0];
                    string groupId = arrIds[1];
                    string email=arrIds[2];

                    if (string.IsNullOrEmpty(roleId))
                    {
                        roleId = ConfigurationManager.AppSettings["RoleID"];
                    }
                    if (string.IsNullOrEmpty(groupId))
                    {
                        groupId = "356b8e9c-005d-47ae-8aad-e7d1d60a1496";
                    }

                    if(string.IsNullOrEmpty(email))
                    {
                        email= loginName + "@quanjing.com";
                    }





                if (isCreated)
                {
                    
                    MemberShipManager msm = new MemberShipManager();
                    //string email = loginName + "@sany.com.cn";
                    IUser u = msm.CreateUser(password, loginName, loginName,
                        new Guid(groupId), email, string.Empty, false, "false", false);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)u;
                    //string roleID = ConfigurationManager.AppSettings["RoleID"];
                    string roleID = roleId;
                    //分配角色
                    Role.CreateRoleUsers(new Guid[] { new Guid(roleID) }, user.UserId);
                    returnObj = user;
                }
                else
                {
                    QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService();
                    SerializeObjectFactory sof = new SerializeObjectFactory();

                    //string objStr = mss.AuthUserByForm(loginName, password, ipAddress);
                    string objStr = mss.GetUserByLoginName(loginName);

                    object o = sof.DesializeFromBase64(objStr);
                    QJVRMS.Business.User user = (QJVRMS.Business.User)o;
                    returnObj = user;

                    //如果数据库里有这个用户的话,就更新一次密码(这里应该判断一下用户是否相等),更新一下角色、机构和email
                    mss.ResetPassword(user.UserId,password);

                    bool isDownloaded = false;
                    if (user.IsDownLoad.ToLower().Equals("true"))
                    {
                        isDownloaded = true;
                    }
                    mss.ModifyUserInfo1(user.UserId, new Guid(groupId), user.UserName, email, user.Telphone, user.IsLocked, isDownloaded, user.IsIPValidate);

                    Role.CreateRoleUsers(new Guid[] { new Guid(roleId) }, user.UserId);
                    
                    
                    
                }
                
            }

            return true;
        }
Ejemplo n.º 16
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;
 }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e) {
            string result = string.Empty;
            string type = get_LinkParam("type");
            string id = string.Empty;
            string body = string.Empty;
            Resource rs = new Resource();
            switch (type) {
                case "orderNew"://OrderNew.aspx
                    string mailFrom = ConfigurationManager.AppSettings["mailFrom"];
                    string mailSubject1 = ConfigurationManager.AppSettings["mailSubject"];
                    if (string.IsNullOrEmpty(mailSubject1)) {
                        mailSubject1 = "有新的订单";
                    }

                    Tool t1 = new Tool();
                    mailFrom = t1.GetValue(Tool.GetDocument("/xml/System.xml"), "from");
                    if (Session["OrderNew"] != null && Session["OrderNew"].ToString() != string.Empty)
                        body = Session["OrderNew"].ToString();
                    Orders obj1 = new Orders();
                    obj1.sendNewOrder(mailFrom, mailSubject1, body);
                    break;
                case "validate"://Validating.aspx
                    string mail = get_LinkParam("mail");
                    string subject = get_LinkParam("subject");
                    
                    if (Session["Validate"] != null && Session["Validate"].ToString() != string.Empty)
                        body = Session["Validate"].ToString();
                    Tool t = new Tool();
                    XmlDocument doc = Tool.GetDocument("/xml/System.xml");
                    string smtpHost = t.GetValue(doc, "host");
                    string smtpUserName = t.GetValue(doc, "userName");
                    string smtpPassword = t.GetValue(doc, "password");

                    string fromEmail = t.GetValue(doc, "from");

                    Tool.sendMail(smtpHost, smtpUserName, smtpPassword, fromEmail, mail, subject, body);
                    break;
                case "send"://OrdersManage.aspx OrderNotPass.aspx OrderDetail.aspx
                    string _userEmail = get_LinkParam("mail");
                    string mailSubject = get_LinkParam("subject");
                    string mailBody = string.Empty;
                    if (Session["MailBody"] != null && Session["MailBody"].ToString() != string.Empty)
                        mailBody = Session["MailBody"].ToString();
                    if (!string.IsNullOrEmpty(_userEmail) && !string.IsNullOrEmpty(mailBody)) {
                        Orders obj = new Orders();
                        obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody);
                    }
                    break;
                case "error": //error.aspx
                    string html = string.Empty;
                    if(Session["ErrorHtml"] != null && Session["ErrorHtml"].ToString() != string.Empty)
                        html = Session["ErrorHtml"].ToString();
                    if (!string.IsNullOrEmpty(html)) {
                        XmlDocument doc1 = Tool.GetDocument("/xml/System.xml");
                        Tool tool = new Tool();
                        string host = tool.GetValue(doc1, "host");
                        string username = tool.GetValue(doc1, "userName");
                        string pass = tool.GetValue(doc1, "password");
                        string from = tool.GetValue(doc1, "from");
                        string adminUid = ConfigurationManager.AppSettings["superAdminId"];
                        string adminEmail = new MemberShipManager().GetUserEmailByUserID(adminUid);
                        string to = adminEmail;
                        string subject1 = "错误信息";
                        Tool.sendMail(host, username, pass, from, to, subject1, html);
                    }
                    break;
                case "exif":
                    #region EXIF信息
                    string folderName = get_LinkParam("folder");
                    string fileName = get_LinkParam("file");
                    string yRootPath = string.Empty;
                    try {
                        ImageType obj = new ImageType();
                        yRootPath = obj.GetSourcePath(folderName, fileName);

                        EXIFMetaData em = new EXIFMetaData();
                        EXIFMetaData.Metadata m = em.GetEXIFMetaData(yRootPath);

                        StringBuilder sb = new StringBuilder();
                        sb.Append("<table>");
                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>设备制造商:</span>");
                        sb.Append("</td><td style=\"word-wrap:break-word;word-break:break-all;\">");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.EquipmentMake.DisplayValue) ? string.Empty : m.EquipmentMake.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>摄影机型号:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.CameraModel.DisplayValue) ? string.Empty : m.CameraModel.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>颜色表示:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ColorSpace.DisplayValue) ? string.Empty : m.ColorSpace.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>闪关灯模式:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.Flash.DisplayValue) ? string.Empty : m.Flash.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>焦距:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.FocalLength.DisplayValue) ? string.Empty : m.FocalLength.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                        sb.Append("<span>曝光时间:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureTime.DisplayValue) ? string.Empty : m.ExposureTime.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>ISO:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ISOSpeed.DisplayValue) ? string.Empty : m.ISOSpeed.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>光源:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.LightSource.DisplayValue) ? string.Empty : m.LightSource.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光程序:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureProg.DisplayValue) ? string.Empty : m.ExposureProg.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光补偿:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ExposureBias.DisplayValue) ? string.Empty : m.ExposureBias.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>相机拍照时间:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.DatePictureTaken.DisplayValue) ? string.Empty : m.DatePictureTaken.DisplayValue.Replace("\0", string.Empty));
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>宽度:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ImageWidth.DisplayValue) ? string.Empty : m.ImageWidth.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>高度:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.ImageHeight.DisplayValue) ? string.Empty : m.ImageHeight.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>水平分辨率:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.XResolution.DisplayValue) ? string.Empty : m.XResolution.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>垂直分辨率:</span>");
                        sb.Append("</td><td>");
                        sb.Append("<strong>");
                        sb.Append(string.IsNullOrEmpty(m.YResolution.DisplayValue) ? string.Empty : m.YResolution.DisplayValue);
                        sb.Append("</strong>");
                        sb.Append("</td></tr>");

                        sb.Append("</table>");
                        result = sb.ToString();
                    }
                    catch {
                        if (string.IsNullOrEmpty(result)) {
                            result = "<span style=\"color:red; padding:5px 5px 5px 5px;\">获取信息失败!!</span>";
                        }
                    }
                    #endregion
                    break;
            }

            Response.Write(result);
            Response.End();
        }
Ejemplo n.º 18
-1
        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);
                }


            }

        }
Ejemplo n.º 19
-1
        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);
                }


                


            }
           
        }