protected void Page_Load(object sender, EventArgs e)
        {
            //RepeaterTopicImg
            string tid=Request.QueryString["tid"];

            if (tid == null || tid == "")
            {
                Response.Redirect("../404.aspx");
            }
            else
            {
                int _tid = Convert.ToInt32(tid);

                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from ((topicTB left join userTB on topicTB.topicUser = userTB.userID )left join projectTB on projectTB.topic=topicTB.topicID ) where topicTB.topicID=@tid";

                srSql.cmd.Parameters.AddWithValue("@tid",tid);
                srSql.da.Fill(srSql.ds,"tb_topic");
                srSql.conn.Close();

                LabelTopicInfo.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectIntro"].ToString();
                LabelProjectPlan.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectPlan"].ToString();
                LabelProjectResult.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectResult"].ToString();
                ImageAvata.ImageUrl = srSql.ds.Tables["tb_topic"].Rows[0]["avatarMini"].ToString();
                ImageAvata.ToolTip = srSql.ds.Tables["tb_topic"].Rows[0]["userName"].ToString();
                LabelUserCollege.Text = srSql.ds.Tables["tb_topic"].Rows[0]["userCollege"].ToString();
                LabelUserIntro.Text = srSql.ds.Tables["tb_topic"].Rows[0]["userIntro"].ToString();
                LabelUserMajor.Text = srSql.ds.Tables["tb_topic"].Rows[0]["userMajor"].ToString();
                LabelUserName.Text = srSql.ds.Tables["tb_topic"].Rows[0]["userName"].ToString();
                LabelUserPst.Text = srSql.ds.Tables["tb_topic"].Rows[0]["userIdentity"].ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string topicID = Request.QueryString["tid"];
            if (topicID == "" || topicID == null)
            {
                Response.Redirect("/Slip/404.aspx");
            }

            HiddenFieldTopicID.Value = topicID;

            SRSql srSql = new SRSql();
            srSql.conn.Open();
            srSql.cmd.CommandText = "select * from topicImgTB where forTopic = @topicID";
            srSql.cmd.Parameters.AddWithValue("@topicID",topicID);

            srSql.da.Fill(srSql.ds,"tb_topicImg");

            srSql.cmd.CommandText = "select topicLogo, topicLogoOriginal,topicLogoMini from topicTB where topicID = @tid";
            srSql.cmd.Parameters.AddWithValue("@tid", topicID);
            srSql.da.Fill(srSql.ds, "tb_topic_logo");
            if (srSql.ds.Tables["tb_topic_logo"].Rows[0]["topicLogoMini"].ToString() != "")
            {
                ImageLogo.ImageUrl = srSql.ds.Tables["tb_topic_logo"].Rows[0]["topicLogoMini"].ToString();
            }

            RepeaterProjImg.DataSource = srSql.ds.Tables["tb_topicImg"].DefaultView;
            RepeaterProjImg.DataBind();

            srSql.conn.Close();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string _topicID = Request.QueryString["tid"];

            if (_topicID == "" || _topicID == null)
            {
                Response.Redirect("/slip/404.aspx");
            }
            else
            {
                int topicID = Convert.ToInt32(_topicID);
                HyperLinkAddMb.NavigateUrl = "EditTopicMb.aspx?tid="+topicID;
                HiddenFieldTopicID.Value = topicID.ToString();

                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from topicMbTB where mbForTopic=@topicID order by topicMbIdentity ";
                srSql.cmd.Parameters.AddWithValue("@topicID" ,topicID);

                srSql.da.Fill(srSql.ds,"tb_topicMb");

                RepeaterProjMem.DataSource=srSql.ds.Tables["tb_topicMb"].DefaultView;
                RepeaterProjMem.DataBind();

                srSql.conn.Close();
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string tpid = Request.QueryString["tpid"];
            if (tpid == null || tpid == "")
            {
                Response.Redirect("/slip/404.aspx");
            }
            else
            {
                int _tpid = Convert.ToInt32(tpid);
                SRDel.SRSql srSql = new SRDel.SRSql();

                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from tpTB where tpID=@tpid";

                srSql.cmd.Parameters.AddWithValue("@tpid",_tpid);
                srSql.dr = srSql.cmd.ExecuteReader();
                if (srSql.dr.Read())
                {
                    LabelNoticeContent.Text = srSql.dr["tpNotice"].ToString();
                    LabelNoticeTitle.Text = srSql.dr["tpName"].ToString();
                    LabelNoticePostTime.Text = "进行时间:<span style='color:#bf3f3f; font-weight:600; font-size:14px;'>" + ((DateTime)srSql.dr["tpStartTime"]).ToLongDateString() + "</span>  至  <span style='color:#bf3f3f;font-weight:600; font-size:14px;'>" + ((DateTime)srSql.dr["tpEndTime"]).ToLongDateString() + "</span>";
                    switch(Convert.ToInt32(srSql.dr["tpIndex"].ToString())){
                        case 0:
                            HyperLinkOpt.Text = "申请课题";
                            HyperLinkOpt.NavigateUrl = "/slip/Profile/Prj/TopicCollect.aspx";
                            break;
                        case 1:
                            break;
                }

                }
                srSql.conn.Close();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int status = 0;
            string error = "";
            SRSql srSql = new SRSql();
            try
            {
                string dist = context.Request["dist"];
                int imgID = Convert.ToInt32(context.Request["imgID"]);

                srSql.conn.Open();

                srSql.cmd.CommandText = "update topicImgTB set topicImgInfo = @dist where topicImgID= @imgID";
                srSql.cmd.Parameters.AddWithValue("@dist", dist);
                srSql.cmd.Parameters.AddWithValue("@imgID", imgID);

                srSql.cmd.ExecuteNonQuery();
                srSql.conn.Close();
            }
            catch (Exception ex)
            {
                srSql.conn.Close();
                error = ex.ToString();
                status = 1;

            }
            finally
            {
                srSql.conn.Close();
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write("{\"status\":\"" + status.ToString() + "\",\"error\":\"" + error + "\"}");
                context.Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userID"] != null)
            {
                string userID = Session["userID"].ToString();
                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from userTB where userID = @userID";
                srSql.cmd.Parameters.AddWithValue("@userID", userID);
                srSql.da.Fill(srSql.ds, "tb_user");
                this.ImagePortrait.ImageUrl = srSql.ds.Tables["tb_user"].Rows[0]["avatarMini"].ToString();

                //统计消息
                srSql.cmd.CommandText = "select msgType from msgs_tb where msgUser=@userID and msgIsRead=@isread";
                srSql.cmd.Parameters.Clear();
                srSql.cmd.Parameters.AddWithValue("@userID", userID);
                srSql.cmd.Parameters.AddWithValue("@isread", false);

                srSql.da.SelectCommand = srSql.cmd;

                srSql.da.Fill(srSql.ds, "msgs_tb");
                if (srSql.ds.Tables["msgs_tb"].Rows.Count > 0)
                {
                    this.LabelMsgCount.Text = "(" + srSql.ds.Tables["msgs_tb"].Rows.Count + ")";

                    int msgCount = srSql.ds.Tables["msgs_tb"].Select("msgType=1").Length;
                    if (msgCount > 0)
                    {
                        this.HyperLinkDiscussMsg.Text = "论坛消息("+msgCount+")";
                    }
                    int prjCount = srSql.ds.Tables["msgs_tb"].Select("msgType=2").Length;
                    if (prjCount > 0)
                    {
                        this.HyperLinkPrj.Text = "项目反馈(" + msgCount + ")";
                    }
                    int sysCount = srSql.ds.Tables["msgs_tb"].Select("msgType=0").Length;
                    if (sysCount > 0)
                    {
                        this.HyperLinkSysMsg.Text = "系统消息(" + sysCount + ")";
                    }
                    int usermsgCount = srSql.ds.Tables["msgs_tb"].Select("msgType=3").Length;
                    if (usermsgCount > 0)
                    {
                        this.HyperLinkUserMsg.Text = "短信息(" + usermsgCount + ")";
                    }
                }

                srSql.conn.Close();
                srSql = null;

            }
            else
            {
                Response.Redirect("~/Slip/LogOn.aspx?f=noLogin");
            }
        }
Beispiel #7
0
        public void ProcessRequest(HttpContext context)
        {
            string err = "";
            int status = 0;

               // context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            SRCom srCom = new SRCom();
            int avatar_x = (int)Convert.ToDouble(context.Request["px"]);
            int avatar_y = (int)Convert.ToDouble(context.Request["py"]);
            int avatar_w = (int)Convert.ToDouble(context.Request["pw"]);
            int avatar_h = (int)Convert.ToDouble(context.Request["ph"]);
            int topicID = (int)Convert.ToDouble(context.Request["tid"]);
            string img = context.Request["img"].ToString();
            string oldImg = context.Request["oldImg"].ToString();

            string logoMini = "";
            string logo = "";
            string logoOriginal = "";
            if (avatar_w > 0)
            {
                SRCutImage sweet_cutimg = new SRCutImage(avatar_x, avatar_y, avatar_w, avatar_h, 100, 125);
                sweet_cutimg.imgSaveFolder = @"/slip/Sources/ProjectImg/Logo/Mini/";
                logoMini = sweet_cutimg.Sweet_Cut(img);
                logo = srCom.MoveFile(img, @"/slip/Sources/ProjectImg/Logo/");
                logoOriginal = srCom.MoveFile(oldImg,@"/slip/Sources/ProjectImg/Logo/Original/");
            }

            SRSql srSql = new SRSql();
            SRSql srSql_ = new SRSql();
            srSql.conn.Open();
            srSql_.conn.Open();
            //删除原图片
            srSql_.cmd.CommandText = "select topicLogo, topicLogoOriginal,topicLogoMini from topicTB where topicID = @tid";
            srSql_.cmd.Parameters.AddWithValue("@tid", topicID);
            srSql_.da.Fill(srSql_.ds,"tb_topic_img");
            srCom.DeleteFile(srSql_.ds.Tables["tb_topic_img"].Rows[0]["topicLogo"].ToString());
            srCom.DeleteFile(srSql_.ds.Tables["tb_topic_img"].Rows[0]["topicLogoOriginal"].ToString());
            srCom.DeleteFile(srSql_.ds.Tables["tb_topic_img"].Rows[0]["topicLogoMini"].ToString());

            srSql.cmd.CommandText = "update topicTB set topicLogo= @logo, topicLogoOriginal = @logoOriginal ,topicLogoMini= @logoMini where topicID = @tid";
            srSql.cmd.Parameters.AddWithValue("@logo", logo);
            srSql.cmd.Parameters.AddWithValue("@logoOriginal", logoOriginal);
            srSql.cmd.Parameters.AddWithValue("@logoMini", logoMini);
            srSql.cmd.Parameters.AddWithValue("@tid", topicID);

            srSql.cmd.ExecuteNonQuery();

            srSql.conn.Close();
            srSql_.conn.Close();

            context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            context.Response.Write("{\"status\":\"" + status.ToString() + "\",\"error\":\"" + err + "\",\"logo\":\"" + srCom.jsonString(logo) + "\",\"logoMini\":\"" + srCom.jsonString(logoMini) + "\"}");
            context.Response.End();
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRSql srSql = new SRSql();
            srSql.conn.Open();
            int msgID = 0;
            if (Request.QueryString["m"] != "" && Request.QueryString["m"] != null)
            {
                msgID = Convert.ToInt32(Request.QueryString["m"]);
                srSql.cmd.CommandText = "select * from msgs_tb where msgID=" + msgID;
                srSql.dr = srSql.cmd.ExecuteReader();
                if (srSql.dr.Read())
                {
                    this.MsgContent.Text = srSql.dr["msgContent"].ToString();
                    this.MsgTitle.Text = srSql.dr["msgTitle"].ToString();

                    switch (Convert.ToInt32(srSql.dr["msgType"].ToString()))
                    {
                        case 0:
                            this.MsgTypeName.Text = "系统消息";
                            break;
                        case 1:
                            this.MsgTypeName.Text = "论坛消息";
                            break;
                        case 2:

                            this.MsgTypeName.Text = "项目消息";
                            break;
                        case 3:

                            this.MsgTypeName.Text = "短消息";
                            break;
                        default:

                            this.MsgTypeName.Visible = false;
                            break;
                    }
                }
                else
                {
                    Response.Redirect("/slip/404.aspx");
                }
                //更新消息已经被查看
                srSql.dr.Close();
                srSql.cmd.CommandText = "UPDATE msgs_tb set msgIsRead=true where msgID = " + msgID;
                srSql.cmd.ExecuteNonQuery();
                srSql.conn.Close();

            }
            else
            {
                Response.Redirect("/slip/404.aspx");
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRSql srSql = new SRSql();

            srSql.conn.Open();
            srSql.cmd.CommandText = "select * from( topicTB left join userTB on topicTB.topicUser=userTB.userID) order by topicPostTime desc";
            srSql.da.Fill(srSql.ds,"tb_topic");

            RepeaterTopic.DataSource = srSql.ds.Tables["tb_topic"].DefaultView;
            RepeaterTopic.DataBind();
            srSql.conn.Close();
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRDel.SRSql srSql = new SRDel.SRSql();

            srSql.conn.Open();
            srSql.cmd.CommandText = "select opID, opTitle , opYear from oldProjects_tb order by opYear desc ";
            srSql.da.Fill(srSql.ds, "oldProjects_tb");
            RepeaterNewsList.DataSource = srSql.ds.Tables["oldProjects_tb"].DefaultView;
            RepeaterNewsList.DataBind();

            srSql.conn.Close();
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRDel.SRSql srSql = new SRDel.SRSql();

            srSql.conn.Open();
            srSql.cmd.CommandText = "select newsID, newsTitle , newsPostTime from newsTB order by newsPostTime desc ";
            srSql.da.Fill(srSql.ds,"tb_news");
            RepeaterNewsList.DataSource = srSql.ds.Tables["tb_news"].DefaultView;
            RepeaterNewsList.DataBind();

            srSql.conn.Close();
        }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SRSql srSql = new SRSql();
     srSql.cmd.CommandText = "select   * From tags_tb order by tagTimes desc";
     srSql.conn.Open();
     srSql.dr = srSql.cmd.ExecuteReader();
     if (srSql.dr.Read())
     {
         do
         {
             this.LabelTags.Text += "<a href='Default.aspx?tag=" + srSql.dr["tagID"].ToString() + "'>" + srSql.dr["tagName"].ToString() +"("+ srSql.dr["tagTimes"].ToString() + ")</a>";
         } while (srSql.dr.Read());
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            int status = 0;
            string error = "";
            SRSql srSql = new SRSql();
            SRSql srSql_ = new SRSql();
            try
            {
                int topicImgID = Convert.ToInt32(context.Request["imgID"]);
               // SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from topicImgTB where topicImgID = @imgID";
                srSql.cmd.Parameters.AddWithValue("@imgID", topicImgID);
                srSql.dr = srSql.cmd.ExecuteReader();
                srSql.dr.Read();
                string topicImgFile = srSql.dr["topicImgFile"].ToString();
                string topicImgMini = srSql.dr["topicImgMini"].ToString();
                string topicImgOriginal = srSql.dr["topicImgOr"].ToString();

                srSql.conn.Close();

                SRCom srCom = new SRCom();
                srCom.DeleteFile(topicImgFile);
                srCom.DeleteFile(topicImgMini);
                srCom.DeleteFile(topicImgOriginal);

                srSql_.conn.Open();
                srSql_.cmd.CommandText = "delete from topicImgTB where topicImgID = @imgID";
                srSql_.cmd.Parameters.AddWithValue("@imgID", topicImgID);
                srSql_.cmd.ExecuteNonQuery();
                srSql_.conn.Close();
                srSql.conn.Close();

            }
            catch(Exception ex){
                error = ex.ToString();
                srSql_.conn.Close();
                srSql.conn.Close();
                status = 1;
            }
            finally{
                srSql.conn.Close();
                srSql_.conn.Close();
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write("{\"status\":\"" + status.ToString() + "\",\"error\":\"" + error + "\"}");
                context.Response.End();
            }
        }
 public void ProcessRequest(HttpContext context)
 {
     int status = 0;
     string msg = "未知错误!";
     if (context.Session["SlipAdmin"] == null)
     {
         //未登录
         msg = "未登录或登录超时!请重新登陆!<a href='LogOn.aspx'  target='_top'> 请登录</a>";
     }
     else
     {
         if (context.Request["dids"] == "" || context.Request["dids"] == null)
         {
             msg = "您没有提交数据!";
         }
         else
         {
             string dids = context.Request["dids"];
             SRSql srSql = new SRSql();
             try
             {
                 srSql.conn.Open();
                 srSql.cmd.CommandText = "delete from newsTB where newsID in ( " + dids + ") ";
                 int effects = srSql.cmd.ExecuteNonQuery();
                 status = 1;
                 msg = "成功删除" + effects + "条记录";
                 srSql.conn.Close();
             }
             catch (Exception ex)
             {
                 msg = ex.Message;
             }
             finally
             {
                 srSql.conn.Close();
             }
         }
     }
     JsonData jd = new JsonData();
     jd["status"] = status;
     jd["msg"] = msg;
     string echoData = jd.ToJson();
     context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
     context.Response.Write(echoData);
     context.Response.End();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string supportID = Request.QueryString["sid"];
            if (supportID == null || supportID == "")
            {
                Response.Redirect("/slip/404.aspx");
            }
            else
            {
                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from supportTB where supportID=@supportID";
                srSql.cmd.Parameters.AddWithValue("@supportID", Convert.ToInt32(supportID));

                srSql.da.Fill(srSql.ds, "tb_support");
                LabelNewsTitle.Text = srSql.ds.Tables["tb_support"].Rows[0]["supportTitle"].ToString();
                LabelNewsContent.Text = srSql.ds.Tables["tb_support"].Rows[0]["supportContent"].ToString();
                srSql.conn.Close();
            }
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRDel.SRSql srSql = new SRDel.SRSql();

            srSql.conn.Open();
            //新闻
            srSql.cmd.CommandText = "select top 5 newsID, newsTitle from newsTB order by newsPostTime ";

            srSql.da.Fill(srSql.ds, "tb_news");
            RepeaterNews.DataSource = srSql.ds.Tables["tb_news"].DefaultView;
            RepeaterNews.DataBind();

            //项目
            srSql.cmd.CommandText = "select top 6 topicTB.topicID ,topicTB.topicTitle,topicTB.topicInfo,topicTB.topicLogo,topicLogoMini ,userTB.userID,userTB.userName from (topicTB left join userTB on topicTB.TopicUser=userTB.userID) where 1=1 ";
            srSql.da.Fill(srSql.ds,"tb_topic");
            RepeaterTopic.DataSource = srSql.ds.Tables["tb_topic"].DefaultView;
            RepeaterTopic.DataBind();

            srSql.conn.Close();
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //管理项目进程
            string cpid = Request.QueryString["cpid"];
            if (cpid == "" || cpid == null)
            {
                Response.Redirect("/slip/404.aspx");
            }

            int _cpid = Convert.ToInt32(cpid);

            SRSql srSql = new SRSql();
            srSql.conn.Open();
            srSql.cmd.CommandText = "select * from tpTB where forCp=@cpid order by tpIndex";
            srSql.cmd.Parameters.AddWithValue("@cpid",cpid);
            srSql.da.Fill(srSql.ds,"tb_tp");
            int np = srSql.ds.Tables["tb_tp"].Rows.Count;

            if (np <1 )//np==0
            {
                //题目征集未开启
                Panel0_0.Visible = true;
                Panel0_1.Visible = false;
                HyperLinkEcit0_0.NavigateUrl = "EditTp.aspx?cpid="+cpid+"&tpin=0";
            }
            else
            {
                //已经开启
                Panel0_1.Visible = true;
                Panel0_0.Visible = false;
                Label0_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[0]["tpStartTime"]).ToLongDateString();
                Label0_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[0]["tpEndTime"]).ToLongDateString();
                HyperLinkEcit0_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=0&tpid="+srSql.ds.Tables["tb_tp"].Rows[0]["tpID"];
            }

            if (np <2 ) //np==1
            {
                //题目评审未开启
                Panel1_0.Visible = true;
                Panel1_1.Visible = false;
                HyperLinkEdit1_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=1";
            }
            else
            {
                //已经开启
                Panel1_1.Visible = true;
                Panel1_0.Visible = false;
                Label1_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[1]["tpStartTime"]).ToLongDateString();
                Label1_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[1]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit1_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=1&tpid=" + srSql.ds.Tables["tb_tp"].Rows[1]["tpID"];
            }

            if (np < 3) //np==2
            {
                //发布申报指南
                Panel2_0.Visible = true;
                Panel2_1.Visible = false;
                HyperLinkEdit2_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=2";
            }
            else
            {
                //已经开启
                Panel2_1.Visible = true;
                Panel2_0.Visible = false;
                Label2_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[2]["tpStartTime"]).ToLongDateString();
                Label2_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[2]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit2_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=2&tpid=" + srSql.ds.Tables["tb_tp"].Rows[2]["tpID"];
            }

            if (np < 4) //np==3
            {
                //发布申报指南
                Panel3_0.Visible = true;
                Panel3_1.Visible = false;
                HyperLinkEdit3_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=3";
            }
            else
            {
                //已经开启
                Panel3_1.Visible = true;
                Panel3_0.Visible = false;
                Label3_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[3]["tpStartTime"]).ToLongDateString();
                Label3_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[3]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit3_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=3&tpid=" + srSql.ds.Tables["tb_tp"].Rows[3]["tpID"];
            }

            if (np < 5) //np==4
            {
                //发布申报指南
                Panel4_0.Visible = true;
                Panel4_1.Visible = false;
                HyperLinkEdit4_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=4";
            }
            else
            {
                //已经开启
                Panel4_1.Visible = true;
                Panel4_0.Visible = false;
                Label4_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[4]["tpStartTime"]).ToLongDateString();
                Label4_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[4]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit4_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=4&tpid=" + srSql.ds.Tables["tb_tp"].Rows[4]["tpID"];
            }

            if (np < 6) //np==5
            {
                //发布申报指南
                Panel5_0.Visible = true;
                Panel5_1.Visible = false;
                HyperLinkEdit5_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=5";
            }
            else
            {
                //已经开启
                Panel5_1.Visible = true;
                Panel5_0.Visible = false;
                Label5_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[5]["tpStartTime"]).ToLongDateString();
                Label5_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[5]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit5_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=5&tpid=" + srSql.ds.Tables["tb_tp"].Rows[5]["tpID"];
            }

            if (np < 7) //np==6
            {
                //发布申报指南
                Panel6_0.Visible = true;
                Panel6_1.Visible = false;
                HyperLinkEdit6_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=6";
            }
            else
            {
                //已经开启
                Panel6_1.Visible = true;
                Panel6_0.Visible = false;
                Label6_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[6]["tpStartTime"]).ToLongDateString();
                Label6_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[6]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit6_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=6&tpid=" + srSql.ds.Tables["tb_tp"].Rows[6]["tpID"];
            }
            if (np < 8) //np==7
            {
                //发布申报指南
                Panel7_0.Visible = true;
                Panel7_1.Visible = false;
                HyperLinkEdit7_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=7";
            }
            else
            {
                //已经开启
                Panel7_1.Visible = true;
                Panel7_0.Visible = false;
                Label7_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[7]["tpStartTime"]).ToLongDateString();
                Label7_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[7]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit7_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=7&tpid=" + srSql.ds.Tables["tb_tp"].Rows[7]["tpID"];
            }

            if (np < 9) //np==8
            {
                //发布申报指南
                Panel8_0.Visible = true;
                Panel8_1.Visible = false;
                HyperLinkEdit8_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=8";
            }
            else
            {
                //已经开启
                Panel8_1.Visible = true;
                Panel8_0.Visible = false;
                Label8_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[8]["tpStartTime"]).ToLongDateString();
                Label8_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[8]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit8_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=8&tpid=" + srSql.ds.Tables["tb_tp"].Rows[8]["tpID"];
            }
            if (np < 10) //np==9
            {
                //发布申报指南
                Panel9_0.Visible = true;
                Panel9_1.Visible = false;
                HyperLinkEdit9_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=9";
            }
            else
            {
                //已经开启
                Panel9_1.Visible = true;
                Panel9_0.Visible = false;
                Label9_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[9]["tpStartTime"]).ToLongDateString();
                Label9_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[9]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit9_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=9&tpid=" + srSql.ds.Tables["tb_tp"].Rows[9]["tpID"];
            }

            if (np < 11) //np==10
            {
                //发布申报指南
                Panel10_0.Visible = true;
                Panel10_1.Visible = false;
                HyperLinkEdit10_0.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=10";
            }
            else
            {
                //已经开启
                Panel10_1.Visible = true;
                Panel10_0.Visible = false;
                Label10_0.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[10]["tpStartTime"]).ToLongDateString();
                Label10_1.Text = ((DateTime)srSql.ds.Tables["tb_tp"].Rows[10]["tpEndTime"]).ToLongDateString();
                HyperLinkEdit10_1.NavigateUrl = "EditTp.aspx?cpid=" + cpid + "&tpin=10&tpid=" + srSql.ds.Tables["tb_tp"].Rows[10]["tpID"];
            }

            srSql.conn.Close();
        }
Beispiel #18
0
        public void ProcessRequest(HttpContext context)
        {
            int status = 0;
            string msg = "";
            int topicMbID=0;
            SRSql srSql = new SRSql();
            try
            {
                string mbName = context.Request["mbName"];
                int mbId = Convert.ToInt32(context.Request["mbId"]);
                string mbPst = context.Request["mbPst"];
                string mbNum = context.Request["mbNum"];
                string mbPhone = context.Request["mbPhone"];
                string mbCollege = context.Request["mbCollege"];
                string mbMajor = context.Request["mbMajor"];
                string mbWork = context.Request["mbWork"];
                int tid = Convert.ToInt32(context.Request["tid"]);
                string _topicMbID = context.Request["tpoicMbID"];

                srSql.conn.Open();
                if (_topicMbID == "" || _topicMbID == null)
                {
                    srSql.cmd.CommandText = "insert into topicMbTb (topicMbName, topicMbCollege, topicMbMajor, topicMbIdentity,topicMbWork , mbForTopic, topicMbPst, topicMbPhone, topicMbNum) VALUES  (@topicMbName, @topicMbCollege, @topicMbMajor, @topicMbIdentity,@topicMbWork , @mbForTopic, @topicMbPst, @topicMbPhone, @topicMbNum)";

                    srSql.cmd.Parameters.AddWithValue("@topicMbName", mbName);
                    srSql.cmd.Parameters.AddWithValue("@topicMbCollege", mbCollege);
                    srSql.cmd.Parameters.AddWithValue("@topicMbMajor", mbMajor);
                    srSql.cmd.Parameters.AddWithValue("@topicMbIdentity", mbId);
                    srSql.cmd.Parameters.AddWithValue("@topicMbWork", mbWork);
                    srSql.cmd.Parameters.AddWithValue("@mbForTopic", tid);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPst", mbPst);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPhone", mbPhone);
                    srSql.cmd.Parameters.AddWithValue("@topicMbNum", mbNum);
                }
                else
                {
                    srSql.cmd.CommandText = "update topicMbTb set topicMbName=@topicMbName, topicMbCollege=@ topicMbCollege, topicMbMajor=@topicMbMajor, topicMbIdentity=@topicMbIdentity,topicMbWork=@topicMbWork , mbForTopic=@mbForTopic, mbForTopic=@mbForTopic, topicMbPhone=@topicMbPhone, topicMbNum=@topicMbNum where topicMbID=@topicMbID";

                    topicMbID = Convert.ToInt32(_topicMbID);

                    srSql.cmd.Parameters.AddWithValue("@topicMbName", mbName);
                    srSql.cmd.Parameters.AddWithValue("@topicMbCollege", mbCollege);
                    srSql.cmd.Parameters.AddWithValue("@topicMbMajor", mbMajor);
                    srSql.cmd.Parameters.AddWithValue("@topicMbIdentity", mbId);
                    srSql.cmd.Parameters.AddWithValue("@topicMbWork", mbWork);
                    srSql.cmd.Parameters.AddWithValue("@mbForTopic", tid);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPst", mbPst);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPhone", mbPhone);
                    srSql.cmd.Parameters.AddWithValue("@topicMbNum", mbNum);
                    srSql.cmd.Parameters.AddWithValue("@topicMbID", Convert.ToInt32(_topicMbID));

                }

                srSql.cmd.ExecuteNonQuery();

                if (_topicMbID == "" || _topicMbID == null)
                {
                    //获取新插入的ID
                    SRSql srSql_ = new SRSql();
                    srSql_.conn.Open();
                    srSql_.cmd.CommandText = "select Max(topicMbID) from topicMbTb where mbForTopic = @topicID";
                    srSql_.cmd.Parameters.AddWithValue("@topicID", tid);

                    topicMbID = Convert.ToInt32(srSql_.cmd.ExecuteScalar().ToString());

                    srSql_.conn.Close();
                }

                srSql.conn.Close();
            }
            catch (Exception ex)
            {
                srSql.conn.Close();
                status = 1;
                msg = ex.ToString();

            }
            finally
            {
                srSql.conn.Close();
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write("{\"status\":\"" + status.ToString() + "\",\"mbID\":\"" + topicMbID.ToString() + "\",\"msg\":\"" + msg + "\"}");
                context.Response.End();
            }
        }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SRSql srSql = new SRSql();

            if (IsPostBack)
            {
                string newsID = Request.Form[HiddenFieldNewsID.UniqueID];
                string newsTitle = Request.Form[TextBoxNewsTitle.UniqueID];
                string newsPostTime = Request.Form[TextBoxNewsPostTime.UniqueID];
                if (newsPostTime == null || newsPostTime == "")
                {
                    newsPostTime = DateTime.Now.ToString();
                }
                string newsContent = Request.Form[TextBoxNewsContent.UniqueID];
                if (newsID == null || newsID == "")
                {
                    //新添加news
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "insert into newsTB (newsTitle,newsPostTime,newsContent)values(@newsTitle,@newsPostTime,@newsContent)";
                    srSql.cmd.Parameters.AddWithValue("@newsTitle", newsTitle);
                    srSql.cmd.Parameters.AddWithValue("@newsPostTime", newsPostTime);
                    srSql.cmd.Parameters.AddWithValue("@newsContent", newsContent);
                    srSql.cmd.ExecuteNonQuery();
                    srSql.conn.Close();
                    Response.Redirect("MNews.aspx");

                }
                else
                {
                    int _newsID = Convert.ToInt32(newsID);
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "update newsTB set newsTitle=@newsTitle,newsPostTime=@newsPostTime,newsContent=@newsContent where newsID=@newsID";
                    srSql.cmd.Parameters.AddWithValue("@newsTitle", newsTitle);
                    srSql.cmd.Parameters.AddWithValue("@newsPostTime", newsPostTime);
                    srSql.cmd.Parameters.AddWithValue("@newsContent", newsContent);
                    srSql.cmd.Parameters.AddWithValue("@newsID", newsID);
                    srSql.cmd.ExecuteNonQuery();
                    srSql.conn.Close();
                    Response.Redirect("MNews.aspx");
                }
            }
            else
            {
                string _newsID = Request.QueryString["nid"];
                if (_newsID == null || _newsID == "")
                {
                    TextBoxNewsPostTime.Text = DateTime.Now.ToString();
                }
                else
                {
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "select * from newsTB where newsID=@newsID";
                    srSql.cmd.Parameters.AddWithValue("@newsID", Convert.ToInt32(_newsID));
                    srSql.da.Fill(srSql.ds, "tb_news");
                    TextBoxNewsTitle.Text = srSql.ds.Tables["tb_news"].Rows[0]["newsTitle"].ToString();
                    TextBoxNewsPostTime.Text = srSql.ds.Tables["tb_news"].Rows[0]["newsPostTime"].ToString();
                    TextBoxNewsContent.Text = srSql.ds.Tables["tb_news"].Rows[0]["newsContent"].ToString();
                    HiddenFieldNewsID.Value = _newsID;
                    srSql.conn.Close();
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int total = 0;
            JsonData rows = new JsonData();
            if (context.Session["SlipAdmin"] == null)
            {
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write("未登录或登录超时!请重新登陆!<a href='LogOn.aspx'  target='_top'> 请登录</a>");
                context.Response.End();
            }
            else
            {
                //查询所属项目
                int fcp = Convert.ToInt32(context.Request.Params["pc"]);
                int page = 0;
                if (context.Request["page"] != null && context.Request["page"] != "")
                {
                    page = Convert.ToInt32(context.Request["page"]) - 1;
                }
                int pageSize = 10;
                if (context.Request["rows"] != null && context.Request["rows"] != "")
                {
                    pageSize = Convert.ToInt32(context.Request["rows"]);
                }

                string sort = "tpIndex";
                if (context.Request["sort"] != null && context.Request["sort"] != "")
                {
                    sort = (context.Request["sort"]);
                }
                string order = "asc";
                if (context.Request["order"] != null && context.Request["order"] != "")
                {
                    order = (context.Request["order"]);
                }

                SRSql srSql = new SRSql();

                srSql.conn.Open();

                if (page == 0)
                {
                    srSql.cmd.CommandText = "select top " + pageSize
                        + " tpID,tpName ,tpStartTime ,tpEndTime , tpPostTime , tpIndex  from  tpTB where forCp = "+fcp+"  order by " + sort + " " + order + " ";
                }
                else
                {
                    srSql.cmd.CommandText = "select top " + pageSize +
                         " tpID,tpName ,tpStartTime ,tpEndTime , tpPostTime , tpIndex  from  tpTB   where forCp = " + fcp + " and cpID not in ( select top " + page * pageSize +
                         " tpID from tpTB forCp = " + fcp + " order by order by " + sort + " " + order + " )  order by " + sort + " " + order + " )";

                }
                srSql.da.SelectCommand = srSql.cmd;
                srSql.da.Fill(srSql.ds,"tps_tb");

                //循环执行,初始话项目
                int openNext = 1;
                for (int i = 0; i < 12; i++)
                {
                    string tp = "";
                    switch (i)
                    {
                        case 0:
                            tp = "题目征集";
                            break;
                        case 1:
                            tp = "题目审核";
                            break;
                        case 2:
                            tp = "发布申报指南";
                            break;
                        case 3:
                            tp = "项目申报";
                            break;
                        case 4:
                            tp = "项目评审";
                            break;
                        case 5:
                            tp = "项目公式及师生互选";
                            break;
                        case 6:
                            tp = "项目实施";
                            break;
                        case 7:
                            tp = "中期检查";
                            break;
                        case 8:
                            tp = "中期检查结果公示";
                            break;
                        case 9:
                            tp = "开始结题";
                            break;
                        case 10:
                            tp = "结题验收";
                            break;
                        case 11:
                            tp = "题目征集";
                            break;
                        default:
                            break;
                    }

                   DataRow[] drs= srSql.ds.Tables["tps_tb"].Select("tpIndex = "+i);
                   if (drs.Length == 0)
                   {
                       //未开启第i项进程

                       JsonData row = new JsonData();

                       row["open"] = openNext;
                       openNext = 0;
                       row["tp"] = tp;
                       row["tpName"] = "";
                       row["tpID"] = "";
                       row["tpIndex"] = i;
                       row["tpEndTime"] = "";
                       row["tpStartTime"] = "";
                       row["forCp"] = fcp;
                       row["tpPostTime"] = "";
                       rows.Add(row);
                   }
                   else
                   {
                       DataRow dr = drs[0];
                       JsonData row = new JsonData();
                       row["open"] = openNext;
                       openNext = 1;
                       row["tp"] = tp;
                       row["tpName"] = dr["tpName"].ToString();
                       row["tpID"] = dr["tpID"].ToString();
                       row["tpIndex"] = i;
                       row["tpEndTime"] = ((DateTime)dr["tpEndTime"]).ToString("yyyy-MM-dd");
                       row["tpStartTime"] = ((DateTime)dr["tpStartTime"]).ToString("yyyy-MM-dd");
                       row["tpPostTime"] = ((DateTime)dr["tpPostTime"]).ToString("yyyy-MM-dd");
                       row["forCp"] = fcp;
                       rows.Add(row);

                   }
                }

                srSql.conn.Close();

                JsonData jsonData = new JsonData();
                jsonData["total"] = 12;
                jsonData["rows"] = rows;
                string echoString = jsonData.ToJson();

                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write(echoString);
                context.Response.End();
            }
        }
Beispiel #21
0
        public void ProcessRequest(HttpContext context)
        {
            int total = 0;
            JsonData rows = new JsonData();
            if (context.Session["SlipAdmin"] == null)
            {
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write("未登录或登录超时!请重新登陆!<a href='LogOn.aspx'  target='_top'> 请登录</a>");
                context.Response.End();
            }
            else
            {
                int page = 0;
                if (context.Request["page"] != null && context.Request["page"] != "")
                {
                    page = Convert.ToInt32(context.Request["page"]) - 1;
                }
                int pageSize = 10;
                if (context.Request["rows"] != null && context.Request["rows"] != "")
                {
                    pageSize = Convert.ToInt32(context.Request["rows"]);
                }

                string sort = "cpID";
                if (context.Request["sort"] != null && context.Request["sort"] != "")
                {
                    sort = (context.Request["sort"]);
                }
                string order = "desc";
                if (context.Request["order"] != null && context.Request["order"] != "")
                {
                    order = (context.Request["order"]);
                }

                SRSql srSql = new SRSql();

                srSql.conn.Open();

                if (page == 0)
                {
                    srSql.cmd.CommandText = "select top " + pageSize
                        + " cpID,cpName , cpYear ,cpStartTime ,cpEndTime from  cpTB  order by " + sort + " " + order + " ";
                }
                else
                {
                   srSql.cmd.CommandText = "select top " + pageSize +
                        " cpID,cpName , cpYear  ,cpStartTime ,cpEndTime from  cpTB  where  cpID not in ( select top " + page * pageSize +
                        " cpID from cpTB order by order by " + sort + " " + order + " )  order by " + sort + " " + order + " )";

                }

                srSql.dr = srSql.cmd.ExecuteReader();
                if (srSql.dr.Read())
                {
                    do
                    {
                        JsonData row = new JsonData();
                        row["cpName"] = srSql.dr["cpName"].ToString();
                        row["cpID"] = Convert.ToInt32(srSql.dr["cpID"].ToString());
                        row["cpYear"] = srSql.dr["cpYear"].ToString();
                        row["cpEndTime"] = ((DateTime)srSql.dr["cpEndTime"]).ToString("yyyy-MM-dd");
                        row["cpStartTime"] = ((DateTime)srSql.dr["cpStartTime"]).ToString("yyyy-MM-dd");
                        rows.Add(row);
                    } while (srSql.dr.Read());
                }
                else
                {
                    rows = "";
                }
                srSql.dr.Close();
                //查询数量
                srSql.cmd.CommandText = "select count(supportID) from supportTB   ";

                total = Convert.ToInt32(srSql.cmd.ExecuteScalar());

                srSql.conn.Close();

                JsonData jsonData = new JsonData();
                jsonData["total"] = total;
                jsonData["rows"] = rows;
                string echoString = jsonData.ToJson();

                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write(echoString);
                context.Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 未登录
            if (Session["userID"] == null)
            {
                Response.Redirect("/Slip/LogOn.aspx");

            }
            #endregion

            #region 处理提交数据
            if (IsPostBack)
            {
                SRSql srSql = new SRSql();
                srSql.conn.Open();

                string topicTitle = Request.Form[TextBoxTopicTitle.UniqueID];
                string topicInfo = Request.Form[TextBoxTopicInfo.UniqueID];
                string topicDetail = Request.Form[TextBoxTopicDetaile.UniqueID];
                int topicUser = Convert.ToInt32(Session["userID"]);
                int topicID = 0;
                if (HiddenFieldTopicID.Value != null && (HiddenFieldTopicID.Value != ""))
                {
                    topicID = Convert.ToInt32(HiddenFieldTopicID.Value);
                    srSql.cmd.CommandText =
                    "update  topicTB set " +
                   " topicTitle =@topicTitle , topicInfo =@topicInfo  ,  topicDetail =@topicDetail" +
                   " where topicID=@topicID";

                    srSql.cmd.Parameters.AddWithValue("@topicTitle", topicTitle);
                    srSql.cmd.Parameters.AddWithValue("@topicInfo", topicInfo == null ? "" : topicInfo);
                    srSql.cmd.Parameters.AddWithValue("@tipicDetail", topicDetail == null ? "" : topicDetail);
                    srSql.cmd.Parameters.AddWithValue("@topicID", topicID);

                    srSql.cmd.ExecuteNonQuery();
                    srSql.conn.Close();
                    srSql = null;
                    Response.Redirect("/Slip/Profile//Prj/ProjectManage.aspx?tid=" + topicID);
                }
                else
                {
                    string postTime = DateTime.Now.ToLocalTime().ToString();

                    srSql.cmd.CommandText =
                     "insert into topicTB " +
                    "(  topicTitle ,  topicUser ,  topicpostTime,  topicInfo ,  topicDetail ) VALUES " +
                    "( @topicTitle , @topicUser , @topicpostTime ,@topicInfo , @topicDetail) ";

                    srSql.cmd.Parameters.AddWithValue("@topicTitle", topicTitle);
                    srSql.cmd.Parameters.AddWithValue("@topicUser", topicUser);
                    srSql.cmd.Parameters.AddWithValue("@topicpostTime", postTime);
                    srSql.cmd.Parameters.AddWithValue("@topicInfo", topicInfo == null ? "" : topicInfo);
                    srSql.cmd.Parameters.AddWithValue("@tipicDetail", topicDetail == null ? "" : topicDetail);

                    srSql.cmd.ExecuteNonQuery();
                    srSql.conn.Close();
                    srSql = null;
                    Response.Redirect("/Slip/Profile/?f=newTopic");
                }
            }
            #endregion

            if (Request.QueryString["tid"] != null && Request.QueryString["tid"] != "")
            {
                #region 修改
                int topicID = Convert.ToInt32(Request.QueryString["tid"]);
                SRSql srSql = new SRSql();
                try
                {
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "select * from topicTB where topicID=@topicID";
                    srSql.cmd.Parameters.AddWithValue("@topicID", topicID);

                    srSql.da.Fill(srSql.ds, "tb_topic");

                    HiddenFieldTopicID.Value = topicID.ToString();

                    TextBoxTopicTitle.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicTitle"].ToString();
                    this.TextBoxTopicInfo.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicInfo"].ToString();
                    this.TextBoxTopicDetaile.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicDetail"].ToString();

                    srSql.conn.Close();
                }
                catch (Exception ex)
                {
                    Response.Write(ex.ToString());
                    srSql.conn.Close();
                }
                finally
                {
                    srSql.conn.Close();
                    srSql = null;
                }

             #endregion
            }
            else
            {

                #region 新建
                //检查是否是在征集题目时期
                string nd = DateTime.Now.ToString();
                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select count(tpID) from tpTB where tpIndex=0 and tpStartTime < @nowDate and tpEndTime > @nowDate";
                srSql.cmd.Parameters.AddWithValue("@noDate",nd);
                srSql.cmd.Parameters.AddWithValue("@noDate", nd);
                string am = srSql.cmd.ExecuteScalar().ToString();
                int amount = Convert.ToInt32(am);
                srSql.conn.Close();
                if (amount != 1)
                {
                    Response.Write("<script type='text/javascript'>alert('当前不在题目征集时间!');history.go(-1);</script>");
                    Response.End();
                }
                else
                {
                    //检查本期项目是否已经申请
                    srSql = new SRSql();

                    srSql.conn.Open();
                    srSql.cmd.CommandText = "select count(topicID) from topicTB where forCp in (select cpID from cpTB where cpYear=@cpy)";
                    string cpy = DateTime.Now.Year.ToString();

                    srSql.cmd.Parameters.AddWithValue("@cpy",cpy);

                    int ntp =(int) srSql.cmd.ExecuteScalar();

                    if (ntp > 0)
                    {
                        //是,提示已经申请,返回
                        Response.Write("<script type='text/javascript'>alert('您已经申请了本年度项目课题!');history.go(-1);</script>");
                        Response.End();
                    }

                        //否,进入新建页面
                    srSql.conn.Close();
                }
                #endregion
            }
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                SRCom srCom = new SRCom();
                int userIdentity = Convert.ToInt32(Request.Form["user_identity"]);
                string userName = user_name.Text.Trim();//Request.Form[this.user_name.ClientID];
                string userMail = user_mail.Text.Trim().ToLower();
                string userNumber = user_school_num.Text.Trim();
                string userPassword =user_password.Text.Trim();
                userPassword = srCom.HashPassword(userPassword);
                string userPasswordCompare =user_password_compare.Text.Trim();
                string userMobile = user_mobile.Text.Trim();
                string userCollege = user_college.Text.Trim();
                string userMajor =user_major.Text.Trim();

                string userPhoto = Request.Form["userPhoto"];
                string userIntro = Request.Form["userIntro"];

                int avatar_x = (int)Convert.ToDouble(Request.Form["avatar_x"]);
                int avatar_y = (int)Convert.ToDouble(Request.Form["avatar_y"]);
                int avatar_w = (int)Convert.ToDouble(Request.Form["avatar_w"]);
                int avatar_h = (int)Convert.ToDouble(Request.Form["avatar_h"]);
                string img = Request.Form["img"].ToString();
                string oldImg = Request.Form["old_img"].ToString();

                string avatarMini = "";
                string avatar = "";
                string avataOriginal = "";
                if (avatar_w > 0)
                {
                    SRCutImage sweet_cutimg = new SRCutImage(avatar_x, avatar_y, avatar_w, avatar_h, 120, 120);
                    sweet_cutimg.imgSaveFolder = @"/slip/Sources/Portraits/Mini/";
                    avatarMini = sweet_cutimg.Sweet_Cut(img);
                    avatar = srCom.MoveFile(img, @"/slip/Sources/Portraits/");
                    avataOriginal = srCom.MoveFile(oldImg, @"/slip/Sources/Portraits/Original/");
                }

                string postTime = DateTime.Now.ToString();

                SRSql srSql = new SRSql();
                srSql.conn.Open();
                    srSql.cmd.CommandText =
                     "insert into userTB " +
                    "( userName, userMail, userNumber, userIdentity, userPWD, userMobile, userCollege, userMajor, PostTime,avatarMini,avatar,avataOriginal) VALUES " +
                    "(@userName,@userMail,@userNumber,@userIdentity,@userPWD,@userMobile,@userCollege,@userMajor,@PostTime,@avatarMini,@avatar,@avataOriginal) ";

                    srSql.cmd.Parameters.AddWithValue("@userName", userName == null ? "" : userName);
                    srSql.cmd.Parameters.AddWithValue("@userMail", userMail == null ? "" : userMail);
                    srSql.cmd.Parameters.AddWithValue("@userNumber", userNumber == null ? "" : userNumber);
                    srSql.cmd.Parameters.AddWithValue("@userIdentity", userIdentity);
                    srSql.cmd.Parameters.AddWithValue("@userPWD", userPassword == null ? "" : userPassword);
                    srSql.cmd.Parameters.AddWithValue("@userMobile", userMobile == null ? "" : userMobile);
                    srSql.cmd.Parameters.AddWithValue("@userCollege", userCollege == null ? "" : userCollege);
                    srSql.cmd.Parameters.AddWithValue("@userMajor", userMajor == null ? "" : userMajor);
                    srSql.cmd.Parameters.AddWithValue("@PostTime", postTime);
                    srSql.cmd.Parameters.AddWithValue("@avatarMini", avatarMini == null ? "" : avatarMini);
                    srSql.cmd.Parameters.AddWithValue("@avatar", avatar == null ? "" : avatar);
                    srSql.cmd.Parameters.AddWithValue("@avataOriginal", avataOriginal == null ? "" : avataOriginal);
                    srSql.cmd.ExecuteNonQuery();
                    srSql.conn.Close();

                    Response.Redirect("logOn.aspx?f=new_register");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SRSql srSql = new SRSql();
            srSql.conn.Open();
            #region 处理提交表单
            if (IsPostBack)
            {
                int saveType =Convert.ToInt32( Request.Form[HiddenFieldOptTip.UniqueID]);
                int saveTopic = Convert.ToInt32(Request.Form[HiddenFieldTopicID.UniqueID]);
                string saveProjectColumn=Request.Form[HiddenFieldContent.UniqueID];
                string projectContent=Request.Form[TextBoxEditProject.UniqueID];

                switch (saveProjectColumn)
                {
                    case "plan"://方案
                        saveProjectColumn = "projectPlan";
                        break;
                    case "result"://结果
                        saveProjectColumn = "projectResult";
                        break;

                    case "intro"://说明
                        saveProjectColumn = "projectIntro";
                        break;
                    default:
                        Response.Redirect("/Slip/404.aspx");
                        break;
                }
                switch (saveType)
                {
                    case 0://添加

                        srSql.cmd.CommandText =
                        "insert into projectTB " +
                       "( " + saveProjectColumn + ",topic) values (@projectContent,@topicID)";

                        break;
                    case 1://修改
                        srSql.cmd.CommandText =
                        "update  projectTB set " +
                       "  " + saveProjectColumn + " =@projectContent" +
                       " where topic=@topicID";

                        break;
                    default:
                        Response.Redirect("/Slip/404.aspx");
                        break;
                }
                srSql.cmd.Parameters.AddWithValue("@projectContent", projectContent);
                srSql.cmd.Parameters.AddWithValue("@topicID", saveTopic);

                srSql.cmd.ExecuteNonQuery();
                srSql.conn.Close();
                srSql = null;
                Response.Redirect("/Slip/Profile//Prj/ProjectManage.aspx?tid=" + saveTopic);

            }
            #endregion

            #region 请求参数是否正确
            if (Request.QueryString["tid"]==null||Request.QueryString["tid"]==""||Request.QueryString["t"]==null||Request.QueryString["t"]==""||Request.QueryString["c"]==null||Request.QueryString["c"]==""){
                Response.Redirect("/Slip/404.aspx");
            }
            #endregion

            #region 设置编辑器内容
            try
            {
                #region 设置操作提示
                int topicID = Convert.ToInt32(Request.QueryString["tid"]);
                int type = Convert.ToInt32(Request.QueryString["t"]);
                string content = Request.QueryString["c"];
                string optTip = "";

                switch (type)
                {
                    case 0:
                        optTip = "填写";
                        switch (content)
                        {
                            case "plan":
                                optTip = optTip + "项目方案";
                                break;
                            case "result":
                                optTip = optTip + "项目成果";
                                break;
                            case "intro":
                                optTip = optTip + "项目说明";
                                break;
                            default:
                                Response.Redirect("/Slip/404.aspx");
                                break;
                        }

                        break;
                    case 1:
                        optTip = "修改";
                        switch (content)
                        {
                            case "plan":
                                optTip = optTip + "项目方案";
                                srSql.cmd.CommandText = "select projectPlan from projectTB where topic= @topicID";
                                srSql.cmd.Parameters.AddWithValue("@topicID", topicID);
                                srSql.da.Fill(srSql.ds, "tb_project");

                                TextBoxEditProject.Text = srSql.ds.Tables["tb_project"].Rows[0]["projectPlan"].ToString();
                                HiddenFieldTopicID.Value = topicID.ToString();
                                break;
                            case "result":
                                optTip = optTip + "项目成果";
                                srSql.cmd.CommandText = "select projectResult from projectTB where topic= @topicID";
                                srSql.cmd.Parameters.AddWithValue("@topicID", topicID);
                                srSql.da.Fill(srSql.ds, "tb_project");

                                TextBoxEditProject.Text = srSql.ds.Tables["tb_project"].Rows[0]["projectResult"].ToString();
                                HiddenFieldTopicID.Value = topicID.ToString();
                                break;
                            case "intro":
                                optTip = optTip + "项目说明";
                                srSql.cmd.CommandText = "select projectIntro from projectTB where topic= @topicID";
                                srSql.cmd.Parameters.AddWithValue("@topicID", topicID);
                                srSql.da.Fill(srSql.ds, "tb_project");
                                TextBoxEditProject.Text = srSql.ds.Tables["tb_project"].Rows[0]["projectIntro"].ToString();
                                HiddenFieldTopicID.Value = topicID.ToString();
                                break;
                            default:
                                Response.Redirect("/Slip/404.aspx");
                                break;
                        }
                        break;
                    default:
                        Response.Redirect("/Slip/404.aspx");
                        break;
                }

                LabelOptTip.Text = optTip;
                HiddenFieldOptTip.Value = type.ToString();
                HiddenFieldContent.Value = content;
                #endregion

                #region 查询题目
                srSql.cmd.CommandText = "select topicTitle from topicTB where topicID= @topicID";
                srSql.cmd.Parameters.AddWithValue("@topicID", topicID);
                srSql.da.Fill(srSql.ds, "tb_topic");
                LabelTopicTitle.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicTitle"].ToString();
                HiddenFieldTopicID.Value = topicID.ToString();

                #endregion

            }
            catch (Exception ex)
            {
                srSql.conn.Close();
                Response.Redirect("/Slip/404.aspx");
            }
            finally
            {
                srSql.conn.Close();
                srSql = null;
            }
            #endregion
        }
        public void ProcessRequest(HttpContext context)
        {
            SRCom srCom = new SRCom();
            //保存图片
            string err = "";
            string path = "";
            int status = 0;
            int imgID=0;
            string imgNamePath = "";
            string miniImgNamePath = "";

            string filesPath = @"/slip/Sources/ProjectImg/Original/";
            string allowFileExt = "jpg,jpeg,gif,png";
            try
            {
                SRUploadFile fileUpload = new SRUploadFile(filesPath, allowFileExt, null);
                HttpPostedFile file = HttpContext.Current.Request.Files["imgFile"];
                status = fileUpload.UploadFile(file);
                //设置默认文件上传大小
                //设置上传路径
                fileUpload.AllowFileExt = "jpg,jpeg,png,";//文件可上传类型
                switch (status)
                {
                    case 5: err = "未选择文件";
                        break;
                    case 1: err = "文件大小为0";
                        break;
                    case 2: err = "文件大小超过4M";
                        break;
                    case 3: err = "文件类型不明确";
                        break;
                    case 4: err = "该文件类型不允许上传,可上传文件类型为:" + fileUpload.AllowFileExt;
                        break;
                    case 0:
                        path = fileUpload.filesPath + fileUpload.fileName;

                        SRCreatThumbnail setThumbnail = new SRCreatThumbnail();
                        setThumbnail.NewImgPath = @"/slip/Sources/ProjectImg/";
                        setThumbnail.MaxImgWidth = 500;
                        setThumbnail.CreatThumbnail(path);
                        imgNamePath = setThumbnail.NewImgPath + setThumbnail.NewImgName;

                        setThumbnail.NewImgPath = @"/slip/Sources/ProjectImg/Mini/";
                        setThumbnail.MaxImgWidth = 200;
                        setThumbnail.CreatThumbnail(path);
                        miniImgNamePath = setThumbnail.NewImgPath + setThumbnail.NewImgName;

                        int topicID = Convert.ToInt32(context.Request.QueryString["tid"]);
                        SRSql srSql=new SRSql();
                        srSql.conn.Open();
                        srSql.cmd.CommandText = "insert into topicImgTB (forTopic, topicImgFile,topicImgOr,topicImgMini) values(@forTopic, @topicImgFile,@topicImgOr,@topicImgMini)";

                        srSql.cmd.Parameters.AddWithValue("@forTopic",topicID);
                        srSql.cmd.Parameters.AddWithValue("@topicImgFile", imgNamePath);
                        srSql.cmd.Parameters.AddWithValue("@topicImgOr", path);
                        srSql.cmd.Parameters.AddWithValue("@topicImgMini", miniImgNamePath);
                        srSql.cmd.ExecuteNonQuery();
                        srSql.conn.Close();
                        //获取新插入的ID
                        SRSql srSql_ = new SRSql();
                        srSql_.conn.Open();
                        srSql_.cmd.CommandText = "select Max(topicImgID) from topicImgTB where forTopic = @topicID";
                        srSql_.cmd.Parameters.AddWithValue("@topicID",topicID);

                        imgID = Convert.ToInt32(srSql_.cmd.ExecuteScalar().ToString());
                        srSql_.conn.Close();
                        break;
                    default:
                        err = "未知错误:";
                        status = 6;
                        break;
                }
            }
            catch (Exception ex)
            {
                err = ex.ToString();
            }
            Hashtable jdata = new Hashtable();
            jdata["status"] = status;
            jdata["error"] = err;
            jdata["imgNamePath"] = (miniImgNamePath);
            jdata["path"] = (path);
            jdata["imgID"] = imgID;
            string jdataStr = JsonMapper.ToJson(jdata);
            context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            context.Response.Write(jdataStr);
            context.Response.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["tid"] != null && Request.QueryString["tid"].ToString() != "")
            {
                int topicID = Convert.ToInt32(Request.QueryString["tid"]);
                SRSql srSql = new SRSql();
                try
                {
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "SELECT topicTB.*, userTB.*, projectTB.* FROM (topicTB left  JOIN userTB ON userTB.[userID] = topicTB.topicUser) left  JOIN projectTB ON topicTB.topicID = projectTB.topic where topicTB.topicID=@topicID";
                    srSql.cmd.Parameters.AddWithValue("@topicID",topicID);

                    srSql.da.Fill(srSql.ds,"tb_topic");
                    LabelTopicTitle.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicTitle"].ToString();
                    LabelTopicIntro.Text = srSql.ds.Tables["tb_topic"].Rows[0]["topicInfo"].ToString();
                    LabelTopicDetail.Text=srSql.ds.Tables["tb_topic"].Rows[0]["topicDetail"].ToString();
                    HyperLinkEditTopicInfo.Text = "修改";
                    HyperLinkEditTopicInfo.NavigateUrl = "/Slip/Profile/Prj/TopicCollect.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString();
                    HyperLinkEditTopicDetail.Text = "修改";
                    HyperLinkEditTopicDetail.NavigateUrl = "/Slip/Profile/Prj/TopicCollect.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString();

                    HyperLinkMProjMember.NavigateUrl = "/Slip/Profile/Prj/TopicMember.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString();

                    if (srSql.ds.Tables["tb_topic"].Rows[0]["projectID"].ToString() == "")
                    {
                        HyperLinkEditProjectIntro.Text = "填写";
                        HyperLinkEditProjectIntro.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString()+"&t=0&c=intro";
                        LabelProjectIntro.Text = "未填写说明!";
                        HyperLinkEditProjectPlan.Text = "填写";
                        HyperLinkEditProjectPlan.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString() + "&t=0&c=plan";
                        LabelProjectPlan.Text = "未填写实施方案!";
                        HyperLinkEditProjectResult.Text = "填写";
                        HyperLinkEditProjectResult.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString() + "&t=0&c=result";
                        LabelProjectResult.Text = "未填写项目成果!";
                    }
                    else
                    {
                        HyperLinkEditProjectIntro.Text = "修改";
                        HyperLinkEditProjectIntro.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString() + "&t=1&c=intro";
                        LabelProjectIntro.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectIntro"].ToString();
                        HyperLinkEditProjectPlan.Text = "修改";
                        HyperLinkEditProjectPlan.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString() + "&t=1&c=plan";
                        LabelProjectPlan.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectPlan"].ToString();
                        HyperLinkEditProjectResult.Text = "修改";
                        HyperLinkEditProjectResult.NavigateUrl = "/Slip/Profile/Prj/EditProject.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString() + "&t=1&c=result";
                        LabelProjectResult.Text = srSql.ds.Tables["tb_topic"].Rows[0]["projectResult"].ToString();
                    }
                    HyperLinkMProjImg.NavigateUrl = "/Slip/Profile/Prj/ProjectPic.aspx?tid=" + srSql.ds.Tables["tb_topic"].Rows[0]["topicID"].ToString();

                }
                catch (Exception ex)
                {
                    srSql.conn.Close();
                }
                finally
                {
                    srSql.conn.Close();
                }

            }
            else
            {
                Response.Redirect("/Slip/404.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {

                string mbName = Request[TextBoxMbName.UniqueID].Trim();
                string _mbId = (Request[ HiddenFieldTopicMbID.UniqueID]).Trim();
                int mbIdentity= Convert.ToInt32( Request[RadioButtonList1.UniqueID].Trim());
                string mbPst = Request[TextBoxMbPst.UniqueID].Trim();
                string mbNum = Request[TextBoxMbNum.UniqueID].Trim();
                string mbPhone = Request[TextBoxMbPhone.UniqueID].Trim();
                string mbCollege = Request[TextBoxMbCollege.UniqueID].Trim();
                string mbMajor = Request[TextBoxMbMajor.UniqueID].Trim();
                string mbWork = Request[TextBoxMbWork.UniqueID].Trim();
                int tid = Convert.ToInt32(Request[HiddenFieldTopicID.UniqueID].Trim());

                SRSql srSql = new SRSql();
                srSql.conn.Open();
                if (_mbId == "" || _mbId == null)
                {
                    //插入

                    srSql.cmd.CommandText = "insert into topicMbTb (topicMbName, topicMbCollege, topicMbMajor, topicMbIdentity,topicMbWork , mbForTopic, topicMbPst, topicMbPhone, topicMbNum) VALUES  (@topicMbName, @topicMbCollege, @topicMbMajor, @topicMbIdentity,@topicMbWork , @mbForTopic, @topicMbPst, @topicMbPhone, @topicMbNum)";

                    srSql.cmd.Parameters.AddWithValue("@topicMbName", mbName);
                    srSql.cmd.Parameters.AddWithValue("@topicMbCollege", mbCollege);
                    srSql.cmd.Parameters.AddWithValue("@topicMbMajor", mbMajor);
                    srSql.cmd.Parameters.AddWithValue("@topicMbIdentity", mbIdentity);
                    srSql.cmd.Parameters.AddWithValue("@topicMbWork", mbWork);
                    srSql.cmd.Parameters.AddWithValue("@mbForTopic", tid);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPst", mbPst);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPhone", mbPhone);
                    srSql.cmd.Parameters.AddWithValue("@topicMbNum", mbNum);
                    srSql.cmd.ExecuteNonQuery();
                }
                else
                {
                    //更新

                    int topicMbID = Convert.ToInt32(_mbId);

                    srSql.cmd.CommandText = "update topicMbTb set "+
                    "topicMbName=@topicMbName,"+
                    " topicMbCollege=@topicMbCollege," +
                    "  topicMbMajor=@topicMbMajor," +
                    "  topicMbIdentity=@topicMbIdentity," +
                    " topicMbWork=@topicMbWork ," +
                    " mbForTopic=@mbForTopic," +
                    " topicMbPst=@topicMbPst," +
                    "  topicMbPhone=@topicMbPhone," +
                    "  topicMbNum=@topicMbNum" +
                    "  where topicMbID = @topicMbID";

                    srSql.cmd.Parameters.AddWithValue("@topicMbName", mbName);
                    srSql.cmd.Parameters.AddWithValue("@topicMbCollege", mbCollege);
                    srSql.cmd.Parameters.AddWithValue("@topicMbMajor", mbMajor);
                    srSql.cmd.Parameters.AddWithValue("@topicMbIdentity", mbIdentity);
                    srSql.cmd.Parameters.AddWithValue("@topicMbWork", mbWork);
                    srSql.cmd.Parameters.AddWithValue("@mbForTopic", tid);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPst", mbPst);
                    srSql.cmd.Parameters.AddWithValue("@topicMbPhone", mbPhone);
                    srSql.cmd.Parameters.AddWithValue("@topicMbNum", mbNum);
                    srSql.cmd.Parameters.AddWithValue("@topicMbID", topicMbID);

                    srSql.cmd.ExecuteNonQuery();

                }

                srSql.conn.Close();

                Response.Redirect("/Slip/Profile/Prj/TopicMember.aspx?tid="+tid);
            }

            //
            string _mbID = Request.QueryString["mbid"];
            string _topicID = Request.QueryString["tid"];
            if (_topicID == null || _topicID == "")
            {
                Response.Redirect("/slip/404.aspx");
            }

            HyperLinkTopicMb.NavigateUrl = "/Slip/Profile/Prj/TopicMember.aspx?tid=" + _topicID;

            if (_mbID == "" || _mbID == null)
            {
                LabelEdit.Text = "添加成员";
                HiddenFieldTopicID.Value = _topicID;
            }
            else
            {
                int mbID = Convert.ToInt32(_mbID);
                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from topicMbTb where topicMbID=@mbID";
                srSql.cmd.Parameters.AddWithValue("@mbID", mbID);
                srSql.dr = srSql.cmd.ExecuteReader();
                srSql.dr.Read();
                TextBoxMbCollege.Text = srSql.dr["topicMbCollege"].ToString();
                TextBoxMbMajor.Text = srSql.dr["topicMbMajor"].ToString();
                TextBoxMbName.Text = srSql.dr["topicMbName"].ToString();
                TextBoxMbNum.Text = srSql.dr["topicMbNum"].ToString();
                TextBoxMbPhone.Text = srSql.dr["topicMbPhone"].ToString();
                TextBoxMbPst.Text = srSql.dr["topicMbPst"].ToString();
                TextBoxMbWork.Text = srSql.dr["topicMbWork"].ToString();
                HiddenFieldTopicID.Value = _topicID;
                HiddenFieldTopicMbID.Value = mbID.ToString();
                RadioButtonList1.SelectedValue = srSql.dr["topicMbIdentity"].ToString();

                srSql.conn.Close();
                LabelEdit.Text = "修改成员";
            }
        }
Beispiel #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ( Session["userID"] != null)
            {
                Response.Redirect("Profile");
            }

            if (Request.QueryString["f"] == "new_register")
            {
                LabelNewUserTip.Text = "您已经注册成功,请登陆!";
            }
            if (Request.QueryString["f"] == "unlogin")
            {
                LabelNewUserTip.Text = "您未登录,请登陆!";
            }

            #region 处理提交数据
            if (IsPostBack)
            {
                string returnUrl = Request.QueryString["reurl"];

                SRCom srCom = new SRCom();
                string userAccount = user_account.Text.Trim();
                string userPWD = srCom.HashPassword(user_password.Text.Trim());

                SRSql srSql = new SRSql();
                srSql.conn.Open();
                srSql.cmd.CommandText = "select * from userTB where (userMail=@userMail or userNumber=@userNumber or userMobile=@userMobile) order by userID";
                srSql.cmd.Parameters.AddWithValue("@userMail", userAccount);
                srSql.cmd.Parameters.AddWithValue("@userNumber", userAccount);
                srSql.cmd.Parameters.AddWithValue("@userMobile", userAccount);
                srSql.da.Fill(srSql.ds, "tb_login_user");
                srSql.conn.Close();
                int userAmount = 0;
                int userAccountAmount = srSql.ds.Tables["tb_login_user"].Rows.Count;
                foreach (DataRow dataRow in srSql.ds.Tables["tb_login_user"].Rows)
                {
                    if (dataRow["userPWD"].ToString() == userPWD)
                    {
                        userAmount++;
                        Session["userID"] = dataRow["userID"].ToString();
                        Session["userName"] = dataRow["userName"].ToString();
                        Session["userIdentity"] = dataRow["userIdentity"].ToString();
                        Session["userAvatar"] = dataRow["avatarMini"].ToString();
                        Session.Timeout = 100;
                    }
                }

                if (userAmount > 1)
                {
                    this.LabelLoginUserTip.Text = "该账号存在两个,请更换帐号登陆!";
                    Session.Abandon();
                }
                else
                {
                    if (userAccountAmount == 0)
                    {
                        this.LabelLoginUserTip.Text = "该账号不存在!";
                        Session.Abandon();
                    }
                    else
                    {
                        if (userAmount < 1)
                        {
                            this.LabelLoginUserTip.Text = "密码错误!";
                            Session.Abandon();
                        }
                        else
                        {
                            if (returnUrl == "" || returnUrl == null)
                            {
                                Response.Redirect("Profile");
                            }
                            else
                            {
                                Response.Redirect(returnUrl);
                            }
                        }
                    }
                }
            }
            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SlipAdmin"] == null)
            {
                //未登录
                this.panel_Form.Visible = false;
                this.LabeLoginTip.Text = "未登录或登录超时!请重新登陆!<a href='LogOn.aspx'  target='_top'> 请登录</a>";
            }
            else
            {
                if (IsPostBack)
                {
                    int status = 0;
                    string msg = "未知错误!";

                    //保存数据
                    int tpIndex = Convert.ToInt32(Request.Form["tpIndex"]);
                    int forCp = Convert.ToInt32(Request.Form["forCp"]);
                    string tpNotice = Request.Form["tpNotice"];
                    string tpPostTime = Request.Form["tpPostTime"];
                    string tpStartTime = Request.Form["tpStartTime"];
                    string tpEndTime = Request.Form["tpEndTime"];
                    string tpName = Request.Form["tpName"];

                    SRSql srSql = new SRSql();
                    srSql.conn.Open();
                    try
                    {
                        if (Request.Form["tpID"] == "" || Request.Form["tpID"] == null)
                        {
                            srSql.cmd.CommandText = "insert into tpTB (tpName,tpStartTime,tpEndTime,tpNotice,tpPostTime,tpIndex,forCp) values (" +
                                "@tpName,@tpStartTime,@tpEndTime,@tpNotice,@tpPostTime,@tpIndex,@forCp)";
                            srSql.cmd.Parameters.AddWithValue("@tpName", tpName);
                            srSql.cmd.Parameters.AddWithValue("@tpStartTime", tpStartTime);
                            srSql.cmd.Parameters.AddWithValue("@tpEndTime", tpEndTime);
                            srSql.cmd.Parameters.AddWithValue("@tpNotice", tpNotice);
                            srSql.cmd.Parameters.AddWithValue("@tpPostTime", tpPostTime);
                            srSql.cmd.Parameters.AddWithValue("@tpIndex", tpIndex);
                            srSql.cmd.Parameters.AddWithValue("@forCp", forCp);
                        }
                        else
                        {
                            int tpID = Convert.ToInt32(Request.Form["tpID"]);
                            srSql.cmd.CommandText = "update tpTB set tpName=@tpName,tpStartTime=@tpStartTime,tpEndTime=@tpEndTime,tpNotice=@tpNotice,tpPostTime=@tpPostTime,tpIndex=@tpIndex,forCp=@forCp where tpID=@tpID";
                            srSql.cmd.Parameters.AddWithValue("@tpName", tpName);
                            srSql.cmd.Parameters.AddWithValue("@tpStartTime", tpStartTime);
                            srSql.cmd.Parameters.AddWithValue("@tpEndTime", tpEndTime);
                            srSql.cmd.Parameters.AddWithValue("@tpNotice", tpNotice);
                            srSql.cmd.Parameters.AddWithValue("@tpPostTime", tpPostTime);
                            srSql.cmd.Parameters.AddWithValue("@tpIndex", tpIndex);
                            srSql.cmd.Parameters.AddWithValue("@forCp", forCp);
                            srSql.cmd.Parameters.AddWithValue("@tpID", tpID);
                        }

                        srSql.cmd.ExecuteNonQuery();

                        status = 1;
                        msg = "保存成功!";
                    }
                    catch (Exception ex)
                    {
                        msg = ex.Message;
                    }
                    finally
                    {
                        srSql.conn.Close();

                        JsonData jd = new JsonData();
                        jd["status"] = status;
                        jd["msg"] = msg;
                        string echoData = jd.ToJson();
                        Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                        Response.Write(echoData);
                        Response.End();
                    }

                }
                else
                {
                    //初始化页面

                    int tpIndex = Convert.ToInt32(Request.Params["tpIndex"]);
                    int forCp = Convert.ToInt32(Request.Params["forCp"]);
                    SRSql srSql = new SRSql();
                    srSql.conn.Open();
                    srSql.cmd.CommandText = "select * from tpTB where tpIndex= @tpIndex and forCp= @forCp";
                    srSql.cmd.Parameters.AddWithValue("@tpIndex",tpIndex);
                    srSql.cmd.Parameters.AddWithValue("@forCp", forCp);

                    srSql.dr = srSql.cmd.ExecuteReader();

                    this.tpIndex.Value = tpIndex.ToString();
                    this.forCp.Value = forCp.ToString();

                    if (srSql.dr.Read())
                    {
                        this.tpID.Value = srSql.dr["tpID"].ToString();
                        this.tpName.Text = srSql.dr["tpName"].ToString();
                        this.tpNotice.Text = srSql.dr["tpNotice"].ToString();
                        this.tpPostTime.Text = ((DateTime)srSql.dr["tpPostTime"]).ToString("yyyy-MM-dd");
                        this.tpStartTime.Text = ((DateTime)srSql.dr["tpStartTime"]).ToString("yyyy-MM-dd");
                        this.tpEndTime.Text = ((DateTime)srSql.dr["tpEndTime"]).ToString("yyyy-MM-dd");
                    }

                    srSql.conn.Close();
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// 查看消息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userID"] != null)
            {
                SRSql srSql=new SRSql();
                srSql.conn.Open();
                string sqlType = "";
                if (Request.QueryString["t"] != "" &&  Request.QueryString["t"] != null)
                {
                    sqlType = "and msgType=" + Convert.ToInt32(Request.QueryString["t"]);

                    switch (Convert.ToInt32(Request.QueryString["t"]))
                    {
                        case 0:
                            this.MsgTypeName.Text = "系统消息";
                            break;
                        case 1:
                            this.MsgTypeName.Text = "论坛消息";
                            break;
                        case 2:

                            this.MsgTypeName.Text = "项目消息";
                            break;
                        case 3:

                            this.MsgTypeName.Text = "短消息";
                            break;
                        default:

                            this.MsgTypeName.Visible = false;
                            break;
                    }

                }
                else
                {
                    this.MsgTypeName.Visible = false;
                }
                srSql.cmd.CommandText = "select * from msgs_tb where 1=1 "+ sqlType+" order by msgPostTime desc";

                srSql.da.SelectCommand =srSql.cmd;

                srSql.da.Fill(srSql.ds,"msgs_tb");
                this.RepeaterMsg.DataSource = srSql.ds.Tables["msgs_tb"].DefaultView;
                this.RepeaterMsg.DataBind();

                #region 分页导航
                int pages;
                int page = (Request.QueryString["page"] == "" || Request.QueryString["page"] == null) ? 0 : Convert.ToInt32(Request.QueryString["page"]) - 1;
                int pageSize = 20;
                int num = (page + 1) * pageSize;

                srSql.cmd.CommandText = "select count(msgID) from msgs_tb ";
                //cmd.Parameters.AddWithValue("@type", clm);
                pages = Convert.ToInt32(srSql.cmd.ExecuteScalar()) / pageSize + 1;
                if (pages < 2)
                {
                    this.HyperLinkPrePage.Visible = false;
                    this.HyperLinkNextPage.Visible = false;
                }

                if (page == 0)
                {
                    this.HyperLinkPrePage.Visible = false;
                }
                else
                {

                    this.HyperLinkPrePage.NavigateUrl = "msg.aspx?t=" + Request.QueryString["t"] + "&page=" + page;
                }

                if (page == pages - 1)
                {
                    this.HyperLinkNextPage.Visible = false;
                }
                else
                {

                    this.HyperLinkNextPage.NavigateUrl = "msg.aspx?t=" + Request.QueryString["t"] + "&page=" + page+2;
                }
                for (int i = 1; i <= pages; i++)
                {
                    if (i == page + 1)
                    {
                        this.LabelPages.Text = this.LabelPages.Text + "<a href='javascript:;' class='current'>" + i + "</a>";
                    }
                    else
                    {
                        this.LabelPages.Text = this.LabelPages.Text + "<a href='msg.aspx?t=" + Request.QueryString["t"] + "&page=" + i + "'>" + i + "</a>";
                    }
                }
                #endregion

                srSql.conn.Close();
            }
            else
            {
                Response.Redirect("/Slip/LogOn.aspx?reurl=" + Request.Url.ToString());
            }
        }