Exemplo n.º 1
0
    protected void InitInfo()
    {
        categoryId = CECRequest.GetQueryInt("categoryid", 0);
        Action     = CECRequest.GetQueryString("action");

        if (Action == "del")
        {
            bool isDelete = ArticleCategoryManage.DeleteCategory(categoryId);
            if (!isDelete)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "DelError", "alert('该分类可能有字分类,请先删掉子分类!');window.location.href='categorylist.aspx';", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "DeleSuccess", "alert('删除成功!');window.location.href='categorylist.aspx';", true);
            }
            return;
        }

        this.ddlcategoryList.BuildTree(ArticleCategoryManage.GetArticleCategoryTable(), "CategoryName", "CategoryId");
        this.ddlcategoryList.SelectedValue = categoryId.ToString();
        if (Action.ToLower() == "edit")
        {
            categoryInfo = ArticleCategoryManage.GetArticleCategoryInfo(categoryId);
            this.ddlcategoryList.SelectedValue = categoryInfo.ParentId.ToString();
        }
    }
Exemplo n.º 2
0
        public ActionResult Rest()
        {
            string method = CECRequest.GetQueryString("method").ToLower();

            #region == 获得Cookie名称 ==
            if (method == "getkeynameincookies")
            {
                ILoginAdapter la = new LoginAdapter();
                return(Content(la.CookieName));
            }
            #endregion

            #region == 获得Cookie值 明文 ==
            if (method == "getvalueincookies")
            {
                string        encryptCookieValue = CECRequest.GetQueryString("Password");
                ILoginAdapter la    = new LoginAdapter();
                string[]      value = la.GetCookieValue(encryptCookieValue).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                if (value.Length > 5)
                {
                    return(Content(value[1])); //用户名
                }
            }
            #endregion

            return(Content(string.Empty));
        }
Exemplo n.º 3
0
        public ActionResult ProductCategoryList()
        {
            var companyInfo = MemberService.GetCompanyInfoByUserId(PlantEngContext.Current.UserId);

            if (CECRequest.GetQueryString("action") == "delete")
            {
                //删除
                int  _id  = CECRequest.GetQueryInt("Id", 0);
                bool flag = CompanyProductCategoryService.Delete(_id, companyInfo.CompanyId);
                if (!flag)
                {
                    //暂时没有实现
                    //return JavaScript("<script type=\"text/javascript\">alert('删除失败');</script>");
                }
                Response.Redirect("/accounts/company/productcategorylist");
                Response.End();
            }


            int id    = CECRequest.GetQueryInt("Id", 0);
            var model = CompanyProductCategoryService.Get(id, companyInfo.CompanyId);


            //产品分类
            ViewBag.CategoryList = CompanyProductCategoryService.GetCategoryList(companyInfo.CompanyId);
            return(View(model));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="fc"></param>
        /// <returns></returns>
        private string _UploadImage(FormCollection fc)
        {
            HttpFileCollectionBase files      = Request.Files;
            HttpPostedFileBase     postedFile = files[0];
            int errorCode = 0;
            int width     = 0;
            int height    = 0;

            if (CECRequest.GetQueryString("isresize").ToLower() == "true")
            {
                //是否裁剪图片
                width  = CECRequest.GetQueryInt("width", 0);
                height = CECRequest.GetQueryInt("height", 0);
            }
            string fileName = FileUpload.UploadImage(postedFile, width, height, out errorCode);

            switch (errorCode)
            {
            case 1:
                fileName = "0";
                break;

            case 2:
                fileName = "1";
                break;

            case 3:
                fileName = "2";
                break;
            }
            return(fileName);
        }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.btnSearch.Click += new EventHandler(btnSearch_Click);
        strKeywords           = CECRequest.GetQueryString("keywords");
        strType = CECRequest.GetQueryString("type");
        if (!Page.IsPostBack)
        {
            this.txtKey.Text = strKeywords;
            if (!string.IsNullOrEmpty(strType))
            {
                switch (strType)
                {
                case "n":
                    this.rblType.SelectedValue = "n";
                    break;

                case "p":
                    this.rblType.SelectedValue = "p";
                    break;
                }
            }
            Search(this.txtKey.Text, this.rblType.SelectedValue);
        }
        this.Page.Title = string.Format("{1} - 搜索 - {0}", System.Configuration.ConfigurationManager.AppSettings["WebSiteTitlePostfix"], strKeywords);
    }
Exemplo n.º 6
0
        /// <summary>
        /// 追踪
        /// </summary>
        /// <returns></returns>
        public ActionResult Track()
        {
            if (!ElcoHttpContext.Current.IsLogin)
            {
                return(Content("<script>alert('请先登录!');window.location.href = '/passport/login';</script>"));
                //return Content("请先登录!");
            }
            var userInfo = ElcoHttpContext.Current.LoginUserInfo;

            var guid = CECRequest.GetQueryString("guid");
            var info = AttachmentService.GetByGUID(guid);

            if (info.Id > 0)
            {
                //更新Attachment下载次数
                AttachmentService.UpdateDownloadCount(info.Id);

                //记录AttachmentDownloadLog信息
                AttachmentService.InsertLog(new AttachmentDownloadLogInfo()
                {
                    AttachId = info.Id,
                    UserId   = userInfo.Id,
                    UserName = userInfo.UserName
                });

                //调转到下载地址
                return(Redirect(info.DownloadUrl.TrimEnd()));
            }
            return(Content(string.Empty));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 新闻中心首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            /*
             * 设置_CommmonLayout.cshtml中的变量
             */

            ViewBag.RootCategoryInfo = ViewBag.CurrentCategoryInfo = CategoryService.Get(GeneralConfig.NewsRootId);

            //焦点图片
            var focus = ArticleService.ListWithoutPage(GeneralConfig.NewsRootId, 4);

            ViewBag.Focus = focus;


            int pageIndex   = CECRequest.GetQueryInt("page", 1);
            var allNewsList = ArticleService.List(new ArticleSearchSetting()
            {
                PageIndex           = pageIndex,
                CategoryId          = GeneralConfig.NewsRootId,
                IsOnlyShowPublished = true,
                Title = CECRequest.GetQueryString("key")
            });

            ViewBag.ArticleList = allNewsList;

            return(View());
        }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (CECRequest.GetQueryString("action").ToLower() == "del")
     {
         FeedbackMange.Delete(CECRequest.GetQueryInt("id", 0));
         Response.Redirect("list.aspx");
     }
 }
Exemplo n.º 9
0
        //
        // GET: /Member/Home/

        /// <summary>
        /// 基本用户列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            var list = MemberService.BaseInfoList(new MemberSearchSetting()
            {
                PageIndex = CECRequest.GetQueryInt("page", 1),
                UserName  = CECRequest.GetQueryString("username")
            });

            ViewBag.MemberList = list;
            return(View());
        }
Exemplo n.º 10
0
        public ActionResult Export()
        {
            string    month = CECRequest.GetQueryString("month");
            DataTable dt    = PlantEng.Services.EletterSubscribeService.Export(month);

            if (dt != null && dt.Rows.Count > 0)
            {
                Output(dt);
            }
            return(Content(string.Empty));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 厂商选择界面
        /// </summary>
        /// <returns></returns>
        public ActionResult MiniCompanyList()
        {
            int    pageIndex   = CECRequest.GetQueryInt("page", 1);
            string companyName = CECRequest.GetQueryString("companyname");
            var    list        = MemberService.CompanyList(new MemberSearchSetting()
            {
                CompanyStatus = CompanyStatus.Pass, PageIndex = pageIndex, CompanyName = companyName
            });

            ViewBag.CompanyList = list;
            return(View());
        }
Exemplo n.º 12
0
        private void Login(string userName)
        {
            //更新最后登录时间
            var userInfo = UserService.Get(userName);

            UserService.UpdateLastLoginDateTime(userInfo.Id);

            int expiresTime = 1;//半小时
            FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddHours(expiresTime), true, string.Empty /*UserRoles*/, FormsAuthentication.FormsCookiePath);
            string     HashTicket            = FormsAuthentication.Encrypt(Ticket);
            HttpCookie lcookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);

            lcookie.Expires = DateTime.Now.AddHours(expiresTime);
            lcookie.Domain  = FormsAuthentication.CookieDomain;

            Response.Cookies.Add(lcookie);
            Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddHours(expiresTime);

            //以下信息为单点登录所使用

            //加密过的随机数
            string randomNumber = Utils.MD5((new Random()).Next().ToString());

            //格式 xbf321:XXX:DesKey
            //其中xxx是加密过的随机数
            //DesKey为salt
            //写入Hite Token 过期时间 4个月
            Response.Cookies.Add(new HttpCookie("ht", Utils.MD5(string.Format("{0}:{1}:{2}", userName, randomNumber, System.Configuration.ConfigurationManager.AppSettings["DESKey"])))
            {
                Domain = FormsAuthentication.CookieDomain, Expires = DateTime.Now.AddMonths(4)
            });
            //把随机数写入Cookie
            Response.Cookies.Add(new HttpCookie("hr", randomNumber)
            {
                Domain = FormsAuthentication.CookieDomain, Expires = DateTime.Now.AddMonths(4)
            });

            //把用户名写入Cookie 过期时间 1年
            Response.Cookies.Add(new HttpCookie("username", userName)
            {
                Domain = FormsAuthentication.CookieDomain, Expires = DateTime.Now.AddYears(1)
            });


            //判断返回地址是否是本域下的
            //如果不是,则返回根站点,反之跳转
            string returnUrl = CECRequest.GetQueryString("ReturnUrl");

            ToRedirectHome(returnUrl);
        }
Exemplo n.º 13
0
        public ActionResult Js()
        {
            string[] jsArray = CECRequest.GetQueryString("src").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string   KEY     = string.Format("JS_{0}", Utils.MD5(CECRequest.GetQueryString("src")));
            var      content = (string)webCache[KEY];

            if (string.IsNullOrEmpty(content))
            {
                content = LoadFile(jsArray);
                webCache.Insert(KEY, content, null, DateTime.Now.AddMinutes(CACHETIMEOUT), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
            }
            Response.AddHeader("Expires", DateTime.Now.Add(TimeSpan.FromHours(1)).ToUniversalTime().ToString("r"));
            return(Content(content, "text/javascript"));
        }
Exemplo n.º 14
0
        public ActionResult List()
        {
            var articleList = ArticleService.List(new ArticleSearchSetting()
            {
                CategoryId  = CECRequest.GetQueryInt("cid", 0),
                PageIndex   = CECRequest.GetQueryInt("page", 1),
                Title       = CECRequest.GetQueryString("title"),
                PublishDate = CECRequest.GetQueryString("m"),
                PageSize    = 15,
                ShowDeleted = false
            });

            ViewBag.ArticleList = articleList;
            return(View());
        }
Exemplo n.º 15
0
    void InitInfo()
    {
        productId  = CECRequest.GetQueryInt("productId", 0);
        action     = CECRequest.GetQueryString("action");
        categoryId = CECRequest.GetQueryInt("categoryid", 0);

        if (action.ToLower() == "del")
        {
            ProductManage.Delete(productId);
            Response.Redirect("productlist.aspx");
            return;
        }
        this.ddlcategoryList.BuildTree(ProductCategoryManage.GetCategoryForTable(), "CategoryName", "CategoryId");
        this.ddlcategoryList.SelectedValue = categoryId.ToString();
    }
Exemplo n.º 16
0
    void InitInfo()
    {
        articleId  = CECRequest.GetQueryInt("articleid", 0);
        action     = CECRequest.GetQueryString("action");
        categoryId = CECRequest.GetQueryInt("categoryid", 0);

        if (action.ToLower() == "del")
        {
            ArticleManage.Delete(articleId);
            Response.Redirect("articlelist.aspx");
            return;
        }

        this.PublishDate.SelectedDate = DateTime.Now;
        this.ddlcategoryList.BuildTree(ArticleCategoryManage.GetArticleCategoryTable(), "CategoryName", "CategoryId");
        this.ddlcategoryList.SelectedValue = categoryId.ToString();
    }
Exemplo n.º 17
0
        public void Logout()
        {
            FormsAuthentication.SignOut();

            //删除单点登录Cookie
            Response.Cookies.Add(new HttpCookie("ht", string.Empty)
            {
                Domain = FormsAuthentication.CookieDomain, Expires = DateTime.Now.AddMonths(-1)
            });
            Response.Cookies.Add(new HttpCookie("hr", string.Empty)
            {
                Domain = FormsAuthentication.CookieDomain, Expires = DateTime.Now.AddMonths(-1)
            });

            //判断是否是合法的返回地址
            string returnUrl = CECRequest.GetQueryString("returnUrl");

            ToRedirectHome(returnUrl);
        }
Exemplo n.º 18
0
        public ActionResult List(FormCollection fc)
        {
            var list = MemberService.BaseInfoList(new MemberSearchSetting()
            {
                PageIndex = CECRequest.GetQueryInt("page", 1),
                UserName  = CECRequest.GetQueryString("username")
            });

            ViewBag.MemberList = list;

            var ids = fc["ids"];

            if (!string.IsNullOrEmpty(ids))
            {
                var dt = MemberService.DownloadBaseInfo(ids.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries).Select(v => System.Convert.ToInt32(v)).ToArray(), DateTime.MinValue, DateTime.MinValue);
                Output(dt);
            }

            return(View());
        }
Exemplo n.º 19
0
        public ActionResult NewsList()
        {
            var companyInfo = MemberService.GetCompanyInfoByUserId(PlantEngContext.Current.UserId);

            if (CECRequest.GetQueryString("action").ToLower().Equals("delete"))
            {
                int id = CECRequest.GetQueryInt("id", 0);
                //如果是删除
                CompanyNewsService.Delete(id, companyInfo.CompanyId);
            }
            var pageIndex = CECRequest.GetQueryInt("page", 1);

            var list = CompanyNewsService.List(new CompanyNewsSearchSetting
            {
                PageIndex = pageIndex,
                CompanyId = companyInfo.CompanyId
            });

            ViewBag.NewsList = list;
            return(View());
        }
Exemplo n.º 20
0
        public ActionResult List()
        {
            int    pageIndex   = CECRequest.GetQueryInt("page", 1);
            int    pageSize    = 20;
            int    catId       = CECRequest.GetQueryInt("cid", 0);
            string txtTitle    = CECRequest.GetQueryString("title");
            var    publishDate = CECRequest.GetQueryString("m");

            var articleList = ArticleService.List(new SearchSetting()
            {
                CategoryId  = catId,
                PageIndex   = pageIndex,
                Title       = txtTitle,
                PublishDate = publishDate,
                PageSize    = pageSize,
                ShowDeleted = true
            });

            ViewBag.ArticleList = articleList;
            return(View());
        }
Exemplo n.º 21
0
        /// <summary>
        /// 公司列表
        /// </summary>
        /// <returns></returns>
        public ActionResult CompanyList()
        {
            string action = CECRequest.GetQueryString("action");

            if (!string.IsNullOrEmpty(action))
            {
                switch (action)
                {
                case "dopass":
                {
                    int companyId = CECRequest.GetQueryInt("companyid", 0);
                    int userId    = CECRequest.GetQueryInt("userid", 0);

                    MemberService.SetCompanyStatus(companyId, userId, CompanyStatus.Pass);
                }
                break;

                case "nopass":
                {
                    int companyId = CECRequest.GetQueryInt("companyid", 0);
                    int userId    = CECRequest.GetQueryInt("userid", 0);
                    MemberService.SetCompanyStatus(companyId, userId, CompanyStatus.NoPass);
                }
                break;
                }
                Response.Redirect("/member/companylist");
                Response.End();
            }
            var list = MemberService.CompanyList(new MemberSearchSetting()
            {
                PageIndex = CECRequest.GetQueryInt("page", 1)
            });

            ViewBag.CompanyList = list;
            return(View());
        }
Exemplo n.º 22
0
        public ActionResult Operate()
        {
            int    id     = CECRequest.GetQueryInt("id", 0);
            string action = CECRequest.GetQueryString("action");

            if (action.Equals("delete", System.StringComparison.OrdinalIgnoreCase))
            {
                //删除
                CategoryService.Delete(id);
            }
            if (action.Equals("restore", System.StringComparison.OrdinalIgnoreCase))
            {
                CategoryService.Restore(id);
            }
            if (action.Equals("enable", System.StringComparison.OrdinalIgnoreCase) || action.Equals("disable", System.StringComparison.OrdinalIgnoreCase))
            {
                CategoryService.Enable(id);
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.ToString()));
            }
            return(Redirect("List"));
        }
Exemplo n.º 23
0
        /// <summary>
        /// 异步回调地址
        /// </summary>
        /// <returns></returns>
        public ActionResult Ajax()
        {
            string action = CECRequest.GetQueryString("action");

            if (action.Equals("childcid", StringComparison.OrdinalIgnoreCase))
            {
                //获得子分类
                IList <ShortCategoryInfo> list = new List <ShortCategoryInfo>();
                int cid      = CECRequest.GetQueryInt("cid", 0);
                var tempList = CategoryService.ListByParentId(cid);
                foreach (var item in tempList)
                {
                    list.Add(new ShortCategoryInfo()
                    {
                        ParentId = item.ParentId,
                        Id       = item.Id,
                        Name     = item.Name.Replace('"', '”')
                    });
                }
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            if (action.Equals("props", StringComparison.OrdinalIgnoreCase))
            {
                //获得属性列表
                int cid = CECRequest.GetQueryInt("cid", 0);
                List <ProductPropInfo> list = new List <ProductPropInfo>();
                list = ProductPropService.List(cid);
                foreach (var item in list)
                {
                    item.Name  = item.Name.Replace('"', '”');
                    item.Value = item.Value.Replace('"', '”');
                }
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { }));
        }
Exemplo n.º 24
0
        /// <summary>
        /// 获得用户信息
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowUserInfo()
        {
            var userInfo = MemberService.Get(CECRequest.GetQueryString("username"));

            return(View(userInfo));
        }
Exemplo n.º 25
0
        public ActionResult Download(FormCollection fc)
        {
            int status = CECRequest.StrToInt(fc["status"], 0);
            //会议ID
            int meetingId = CECRequest.StrToInt(CECRequest.GetQueryString("meetingid"), 0);



            switch (status)
            {
            case 1:
                //会前调查下载信息下载
            {
                #region ==
                var dtBeforeMeetingSurvey           = GetSurveyInfo(meetingId, "BeforeMeeting");
                var BeforeMeetingSurveyUserNameList = new List <string>();
                if (dtBeforeMeetingSurvey.Columns.Contains("UserName"))
                {
                    foreach (DataRow dr in dtBeforeMeetingSurvey.Rows)
                    {
                        BeforeMeetingSurveyUserNameList.Add(dr["UserName"].ToString());
                    }
                }
                if (dtBeforeMeetingSurvey != null && dtBeforeMeetingSurvey.Rows.Count > 0)
                {
                    StringBuilder strUserName = new StringBuilder();
                    foreach (string item in BeforeMeetingSurveyUserNameList)
                    {
                        if (!item.Equals("匿名"))
                        {
                            strUserName.Append("'" + item + "'");
                            strUserName.Append(",");
                        }
                    }
                    if (strUserName.Length > 0)
                    {
                        strUserName.Length -= 1;
                    }

                    DataTable dt;
                    if (dtBeforeMeetingSurvey.Columns.Contains("UserName"))
                    {
                        if (dtBeforeMeetingSurvey.Columns.Contains("Email"))
                        {
                            dtBeforeMeetingSurvey.Columns.Remove("Email");
                        }
                        if (dtBeforeMeetingSurvey.Columns.Contains("MobilePhone"))
                        {
                            dtBeforeMeetingSurvey.Columns.Remove("MobilePhone");
                        }
                        if (dtBeforeMeetingSurvey.Columns.Contains("RealName"))
                        {
                            dtBeforeMeetingSurvey.Columns.Remove("RealName");
                        }
                        dt = MergeDataTable(dtBeforeMeetingSurvey, DownLoadUserList(strUserName.ToString()), "UserName");
                    }
                    else
                    {
                        dt = dtBeforeMeetingSurvey;
                    }

                    if (dt != null)
                    {
                        if (dt.Columns.Contains("RealName"))
                        {
                            dt.Columns.Remove("RealName");
                        }
                        if (dt.Columns.Contains("地区"))
                        {
                            dt.Columns.Remove("地区");
                        }
                        if (dt.Columns.Contains("用户名"))
                        {
                            dt.Columns.Remove("用户名");
                        }
                        if (dt.Columns.Contains("邮编"))
                        {
                            dt.Columns.Remove("邮编");
                        }

                        if (dt.Columns.Contains("CreateTime"))
                        {
                            dt.Columns["CreateTime"].ColumnName = "timestamp";
                        }
                        if (dt.Columns.Contains("UserName"))
                        {
                            dt.Columns["UserName"].ColumnName = "User_id";
                        }

                        int indexColumn = dt.Columns.Count - 1;

                        if (dt.Columns.Contains("Name"))
                        {
                            dt.Columns["Name"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("User_id"))
                        {
                            dt.Columns["User_id"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Email"))
                        {
                            dt.Columns["Email"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Position"))
                        {
                            dt.Columns["Position"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Department"))
                        {
                            dt.Columns["Department"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Company"))
                        {
                            dt.Columns["Company"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Province"))
                        {
                            dt.Columns["Province"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("City"))
                        {
                            dt.Columns["City"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("District"))
                        {
                            dt.Columns["District"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Address"))
                        {
                            dt.Columns["Address"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Tele"))
                        {
                            dt.Columns["Tele"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("MobilePhone"))
                        {
                            dt.Columns["MobilePhone"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Postal_Code"))
                        {
                            dt.Columns["Postal_Code"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("timestamp"))
                        {
                            dt.Columns["timestamp"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("UserID"))
                        {
                            dt.Columns["UserID"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("FamilyName"))
                        {
                            dt.Columns["FamilyName"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("GivenName"))
                        {
                            dt.Columns["GivenName"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Guid"))
                        {
                            dt.Columns["Guid"].SetOrdinal(indexColumn);
                        }

                        DataTableToCSV(dt);
                    }
                }
                else
                {
                    ViewBag.Msg = "暂无任何信息可下载!";
                }
                #endregion
            }
            break;

            case 2:
                //会后调查下载信息下载
            {
                #region ==
                var dtAfterMeetingSurvey           = GetSurveyInfo(meetingId, "AfterMeeting");
                var AfterMeetingSurveyUserNameList = new List <string>();
                if (dtAfterMeetingSurvey.Columns.Contains("UserName"))
                {
                    foreach (DataRow dr in dtAfterMeetingSurvey.Rows)
                    {
                        AfterMeetingSurveyUserNameList.Add(dr["UserName"].ToString());
                    }
                }


                if (dtAfterMeetingSurvey != null && dtAfterMeetingSurvey.Rows.Count > 0)
                {
                    StringBuilder strUserName = new StringBuilder();
                    foreach (string item in AfterMeetingSurveyUserNameList)
                    {
                        if (!item.Equals("匿名"))
                        {
                            strUserName.Append("'" + item + "'");
                            strUserName.Append(",");
                        }
                    }
                    if (strUserName.Length > 0)
                    {
                        strUserName.Length -= 1;
                    }

                    DataTable dt;
                    if (dtAfterMeetingSurvey.Columns.Contains("UserName"))
                    {
                        if (dtAfterMeetingSurvey.Columns.Contains("Email"))
                        {
                            dtAfterMeetingSurvey.Columns.Remove("Email");
                        }
                        if (dtAfterMeetingSurvey.Columns.Contains("MobilePhone"))
                        {
                            dtAfterMeetingSurvey.Columns.Remove("MobilePhone");
                        }
                        if (dtAfterMeetingSurvey.Columns.Contains("RealName"))
                        {
                            dtAfterMeetingSurvey.Columns.Remove("RealName");
                        }
                        dt = MergeDataTable(dtAfterMeetingSurvey, DownLoadUserList(strUserName.ToString()), "UserName");
                    }
                    else
                    {
                        dt = dtAfterMeetingSurvey;
                    }

                    if (dt != null)
                    {
                        if (dt.Columns.Contains("RealName"))
                        {
                            dt.Columns.Remove("RealName");
                        }
                        if (dt.Columns.Contains("地区"))
                        {
                            dt.Columns.Remove("地区");
                        }
                        if (dt.Columns.Contains("用户名"))
                        {
                            dt.Columns.Remove("用户名");
                        }
                        if (dt.Columns.Contains("邮编"))
                        {
                            dt.Columns.Remove("邮编");
                        }

                        if (dt.Columns.Contains("CreateTime"))
                        {
                            dt.Columns["CreateTime"].ColumnName = "timestamp";
                        }
                        if (dt.Columns.Contains("UserName"))
                        {
                            dt.Columns["UserName"].ColumnName = "User_id";
                        }

                        int indexColumn = dt.Columns.Count - 1;

                        if (dt.Columns.Contains("Name"))
                        {
                            dt.Columns["Name"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("User_id"))
                        {
                            dt.Columns["User_id"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Email"))
                        {
                            dt.Columns["Email"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Position"))
                        {
                            dt.Columns["Position"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Department"))
                        {
                            dt.Columns["Department"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Company"))
                        {
                            dt.Columns["Company"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Province"))
                        {
                            dt.Columns["Province"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("City"))
                        {
                            dt.Columns["City"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("District"))
                        {
                            dt.Columns["District"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Address"))
                        {
                            dt.Columns["Address"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Tele"))
                        {
                            dt.Columns["Tele"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("MobilePhone"))
                        {
                            dt.Columns["MobilePhone"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Postal_Code"))
                        {
                            dt.Columns["Postal_Code"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("timestamp"))
                        {
                            dt.Columns["timestamp"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("UserID"))
                        {
                            dt.Columns["UserID"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("FamilyName"))
                        {
                            dt.Columns["FamilyName"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("GivenName"))
                        {
                            dt.Columns["GivenName"].SetOrdinal(indexColumn);
                        }
                        if (dt.Columns.Contains("Guid"))
                        {
                            dt.Columns["Guid"].SetOrdinal(indexColumn);
                        }

                        DataTableToCSV(dt);
                    }
                }
                else
                {
                    ViewBag.Msg = "暂无任何信息可下载!";
                }
                #endregion
            }
            break;

            case 3:
                //QA相关信息下载
            {
                #region ==
                var          dtQuestion = new DataTable();
                Action <int> fbQuestion = (mid) => {
                    DataSet      ds = new DataSet();
                    StringReader sr = new StringReader(
                        Goodspeed.Common.CharHelper.GetWebPage(
                            string.Format("http://webcast.planteng.cn/QuestionXmlList.aspx?MeetingID={0}", mid), false, Encoding.UTF8)
                        );
                    ds.ReadXml(sr);
                    if (ds.Tables.Count > 0)
                    {
                        dtQuestion = ds.Tables[0];
                    }
                };
                fbQuestion(meetingId);

                var QuestionUserNameList = new List <string>();
                if (dtQuestion.Columns.Contains("UserName"))
                {
                    foreach (DataRow dr in dtQuestion.Rows)
                    {
                        QuestionUserNameList.Add(dr["UserName"].ToString());
                    }
                }

                if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                {
                    StringBuilder strUserName = new StringBuilder();
                    foreach (string item in QuestionUserNameList)
                    {
                        if (!item.Equals("匿名"))
                        {
                            strUserName.Append("'" + item + "'");
                            strUserName.Append(",");
                        }
                    }
                    if (strUserName.Length > 0)
                    {
                        strUserName.Length -= 1;
                    }

                    DataTable dt = new DataTable();
                    if (dtQuestion.Columns.Contains("UserName"))
                    {
                        if (dtQuestion.Columns.Contains("Email"))
                        {
                            dtQuestion.Columns.Remove("Email");
                        }
                        if (dtQuestion.Columns.Contains("MobilePhone"))
                        {
                            dtQuestion.Columns.Remove("MobilePhone");
                        }
                        if (dtQuestion.Columns.Contains("RealName"))
                        {
                            dtQuestion.Columns.Remove("RealName");
                        }
                        dt = MergeDataTable(dtQuestion, DownLoadUserList(strUserName.ToString()), "UserName");
                    }
                    else
                    {
                        dt = dtQuestion;
                    }

                    if (dt != null)
                    {
                        if (dt.Columns.Contains("RealName"))
                        {
                            dt.Columns.Remove("RealName");
                        }
                        if (dt.Columns.Contains("isDistillate"))
                        {
                            dt.Columns.Remove("isDistillate");
                        }
                        if (dt.Columns.Contains("OperationTime"))
                        {
                            dt.Columns.Remove("OperationTime");
                        }
                        if (dt.Columns.Contains("AnswerUserID"))
                        {
                            dt.Columns.Remove("AnswerUserID");
                        }
                        if (dt.Columns.Contains("StartTime"))
                        {
                            dt.Columns.Remove("StartTime");
                        }
                        if (dt.Columns.Contains("UserID"))
                        {
                            dt.Columns.Remove("UserID");
                        }
                        if (dt.Columns.Contains("IsInReply"))
                        {
                            dt.Columns.Remove("IsInReply");
                        }
                        if (dt.Columns.Contains("ReplyUserName"))
                        {
                            dt.Columns.Remove("ReplyUserName");
                        }

                        if (dt.Columns.Contains("UserName"))
                        {
                            dt.Columns["UserName"].ColumnName = "Webuser_ID";
                        }
                        if (dt.Columns.Contains("QuestionContent"))
                        {
                            dt.Columns["QuestionContent"].ColumnName = "Question_Details";
                        }
                        if (dt.Columns.Contains("QuestionTime"))
                        {
                            dt.Columns["QuestionTime"].ColumnName = "Question_Time";
                        }

                        if (dt.Columns.Contains("isReply"))
                        {
                            dt.Columns["isReply"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("isDirect"))
                        {
                            dt.Columns["isDirect"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("isEmcee"))
                        {
                            dt.Columns["isEmcee"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("isPublic"))
                        {
                            dt.Columns["isPublic"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Question_Time"))
                        {
                            dt.Columns["Question_Time"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Postal_Code"))
                        {
                            dt.Columns["Postal_Code"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Address"))
                        {
                            dt.Columns["Address"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Tele"))
                        {
                            dt.Columns["Tele"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("District"))
                        {
                            dt.Columns["District"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("City"))
                        {
                            dt.Columns["City"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Province"))
                        {
                            dt.Columns["Province"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Company"))
                        {
                            dt.Columns["Company"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Department"))
                        {
                            dt.Columns["Department"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Position"))
                        {
                            dt.Columns["Position"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Question_Details"))
                        {
                            dt.Columns["Question_Details"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Email"))
                        {
                            dt.Columns["Email"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Name"))
                        {
                            dt.Columns["Name"].SetOrdinal(2);
                        }
                        if (dt.Columns.Contains("Webuser_ID"))
                        {
                            dt.Columns["Webuser_ID"].SetOrdinal(2);
                        }

                        DataTableToCSV(dt);
                    }
                }
                else
                {
                    ViewBag.Msg = "暂无任何信息可下载!";
                }
                #endregion
            }
            break;

            default:
            case 0:
                //会议相关人员信息下载
            {
                #region ==

                ///会议中的用户
                var          dtUserInMeeting = new DataTable();
                Action <int> fbUserInMeeting = (mid) =>
                {
                    DataSet      ds = new DataSet();
                    StringReader sr = new StringReader(
                        Goodspeed.Common.CharHelper.GetWebPage(
                            string.Format("http://webcast.planteng.cn/UserInMeetingXmlList.aspx?MeetingID={0}", mid),
                            false, Encoding.UTF8)
                        );
                    ds.ReadXml(sr);
                    if (ds.Tables.Count > 0)
                    {
                        dtUserInMeeting = ds.Tables[0];
                    }
                };
                fbUserInMeeting(meetingId);

                var UserInMeetingUserNameList = new List <string>();

                if (dtUserInMeeting.Columns.Contains("UserName"))
                {
                    foreach (DataRow dr in dtUserInMeeting.Rows)
                    {
                        UserInMeetingUserNameList.Add(dr["UserName"].ToString());
                    }
                }

                if (UserInMeetingUserNameList.Count > 0)
                {
                    StringBuilder strUserName = new StringBuilder();
                    foreach (string item in UserInMeetingUserNameList)
                    {
                        if (!item.Equals("匿名"))
                        {
                            strUserName.Append("'" + item + "'");
                            strUserName.Append(",");
                        }
                    }
                    if (strUserName.Length > 0)
                    {
                        strUserName.Length -= 1;
                    }

                    DataTable dt;
                    if (dtUserInMeeting.Columns.Contains("UserName"))
                    {
                        if (dtUserInMeeting.Columns.Contains("Email"))
                        {
                            dtUserInMeeting.Columns.Remove("Email");
                        }
                        if (dtUserInMeeting.Columns.Contains("MobilePhone"))
                        {
                            dtUserInMeeting.Columns.Remove("MobilePhone");
                        }
                        if (dtUserInMeeting.Columns.Contains("RealName"))
                        {
                            dtUserInMeeting.Columns.Remove("RealName");
                        }
                        dt = MergeDataTable(dtUserInMeeting, DownLoadUserList(strUserName.ToString()), "UserName");
                    }
                    else
                    {
                        dt = dtUserInMeeting;
                    }

                    if (dt != null)
                    {
                        //if (dt.Columns.Contains("RealName")) dt.Columns.Remove("RealName");
                        //if (dt.Columns.Contains("CompanyName")) dt.Columns.Remove("CompanyName");
                        if (dt.Columns.Contains("DepartmentName"))
                        {
                            dt.Columns.Remove("DepartmentName");
                        }
                        if (dt.Columns.Contains("LoginName"))
                        {
                            dt.Columns.Remove("LoginName");
                        }
                        //if (dt.Columns.Contains("Phone")) dt.Columns.Remove("Phone");
                        if (dt.Columns.Contains("PostNumber"))
                        {
                            dt.Columns.Remove("PostNumber");
                        }
                        if (dt.Columns.Contains("ProfessionalGrade"))
                        {
                            dt.Columns.Remove("ProfessionalGrade");
                        }
                        if (dt.Columns.Contains("Sex"))
                        {
                            dt.Columns.Remove("Sex");
                        }

                        if (dt.Columns.Contains("Name"))
                        {
                            dt.Columns["Name"].ColumnName = "Webuser_ID";
                        }
                        if (dt.Columns.Contains("UserName"))
                        {
                            dt.Columns["UserName"].ColumnName = "Name";
                        }
                        if (dt.Columns.Contains("SignUpTime"))
                        {
                            dt.Columns["SignUpTime"].ColumnName = "Register_Time";
                        }
                        if (dt.Columns.Contains("IsDirectOnline"))
                        {
                            dt.Columns["IsDirectOnline"].ColumnName = "直播时参会";
                        }
                        if (dt.Columns.Contains("IsSee"))
                        {
                            dt.Columns["IsSee"].ColumnName = "累计观看";
                        }
                        if (dt.Columns.Contains("hasQuestion"))
                        {
                            dt.Columns["hasQuestion"].ColumnName = "是否提问";
                        }

                        /*
                         * if (dt.Columns.Contains("GivenName")) dt.Columns["GivenName"].SetOrdinal(0);
                         * if (dt.Columns.Contains("FamilyName")) dt.Columns["FamilyName"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Register_Time")) dt.Columns["Register_Time"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Postal_Code")) dt.Columns["Postal_Code"].SetOrdinal(0);
                         * //if (dt.Columns.Contains("Address")) dt.Columns["Address"].SetOrdinal(0);
                         * if (dt.Columns.Contains("MobilePhone")) dt.Columns["MobilePhone"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Tele")) dt.Columns["Tele"].SetOrdinal(0);
                         * if (dt.Columns.Contains("District")) dt.Columns["District"].SetOrdinal(0);
                         * //if (dt.Columns.Contains("City")) dt.Columns["City"].SetOrdinal(0);
                         * //if (dt.Columns.Contains("Province")) dt.Columns["Province"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Company")) dt.Columns["Company"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Department")) dt.Columns["Department"].SetOrdinal(0);
                         * //if (dt.Columns.Contains("Position")) dt.Columns["Position"].SetOrdinal(0);
                         * if (dt.Columns.Contains("是否提问")) dt.Columns["是否提问"].SetOrdinal(0);
                         * if (dt.Columns.Contains("累计观看")) dt.Columns["累计观看"].SetOrdinal(0);
                         * if (dt.Columns.Contains("直播时参会")) dt.Columns["直播时参会"].SetOrdinal(0);
                         * //if (dt.Columns.Contains("Email")) dt.Columns["Email"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Name")) dt.Columns["Name"].SetOrdinal(0);
                         * if (dt.Columns.Contains("Webuser_ID")) dt.Columns["Webuser_ID"].SetOrdinal(0);
                         * if (dt.Columns.Contains("QuestionNum")) dt.Columns["QuestionNum"].SetOrdinal(0);
                         * if (dt.Columns.Contains("DirectOnlineTime")) dt.Columns["DirectOnlineTime"].SetOrdinal(0);
                         * if (dt.Columns.Contains("OnlineTime")) dt.Columns["OnlineTime"].SetOrdinal(0);
                         */
                        DataTableToCSV(dt);
                    }
                }
                else
                {
                    ViewBag.Msg = "暂无任何信息可下载!";
                }
                #endregion
            }
            break;
            }
            return(View());
        }
Exemplo n.º 26
0
        public ActionResult Rest(FormCollection fc)
        {
            string method = CECRequest.GetQueryString("method").ToLower();

            #region == 登录 ==
            if (method == "login")
            {
                string userName  = CECRequest.GetFormString("username");
                string password  = CECRequest.GetFormString("password");
                string returnUrl = CECRequest.GetQueryString("url");

                var userInfo = MemberService.Get(userName);
                if (userInfo.Id > 0 && userInfo.Password == password)
                {
                    //写登录Cookie
                    ILoginAdapter la = new LoginAdapter();
                    la.WriteLoginCookie(new LoginUserInfo()
                    {
                        Email    = userInfo.Email,
                        UserId   = userInfo.Id,
                        RoleId   = (int)userInfo.Type,
                        UserName = userInfo.UserName,
                        Password = userInfo.Password
                    });
                }
                else
                {
                    return(Content("<script type=\"text/javascript\">alert(\"用户名或密码错误,请重新输入!\");location.href = location.href;</script>"));
                }
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
            }
            #endregion

            #region == 登出 ==
            if (method == "logout")
            {
                string        returnUrl = CECRequest.GetQueryString("url");
                ILoginAdapter la        = new LoginAdapter();
                if (la.IsClientLogin())
                {
                    la.LoginOut();
                }
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
            }
            #endregion

            #region == 是否在线 ==
            if (method == "isolineuser")
            {
                var userName   = CECRequest.GetFormString("UserName");
                var userPwd    = CECRequest.GetFormString("PassWord");
                var memberInfo = MemberService.Get(userName);

                if (memberInfo.Id > 0 && memberInfo.Password == userPwd)
                {
                    return(Content("true"));
                }
                return(Content("false"));
            }
            #endregion

            #region == 获取用户信息 ==
            if (method == "getuserinfo")
            {
                StringBuilder sb         = new StringBuilder();
                var           userName   = CECRequest.GetFormString("UserName");
                var           memberInfo = MemberService.Get(userName);
                if (memberInfo.Id > 0)
                {
                    sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    sb.Append("<root>");
                    sb.AppendFormat("<Email>{0}</Email>", memberInfo.Email);
                    sb.AppendFormat("<MobilePhone>{0}</MobilePhone>", memberInfo.Mobile);
                    sb.AppendFormat("<Realname>{0}</Realname>", memberInfo.RealName);
                    sb.Append("</root>");
                }
                return(Content(sb.ToString()));
            }
            #endregion

            return(Content(string.Empty));
        }