Exemple #1
0
    protected void btn1_Click(object sender, EventArgs e)
    {
        Hashtable ht = new Hashtable();

        string[] arr1 = new string[] { "title", "kind", "remark", "time0" };
        for (int i = 0; i < arr1.Length - 1; i++)
        {
            ht.Add(arr1[i], Util.GetControlValue(this.title.Parent.FindControl(arr1[i])));
        }

        ht["remark"] = this.remark.Text;
        ht.Add(arr1[3], DateTime.Now.ToString());
        ZX_InfoBU info1  = new ZX_InfoBU();
        bool      result = info1.EditInfo(Request["ID"], ht);

        info1.Close();
        if (result)
        {
            //Util.alert(this.Page, "修改数据成功,按返回按钮,返回信息维护页面!");
            string newurl = Application["root"] + "/Info/InfoMaintenance.aspx";
            //Util.alert(this.Page, "修改数据成功,按确定按钮,返回信息维护页面!",newurl);
            Response.Redirect(newurl, true);
        }
        else
        {
            Util.alert(this.Page, "错误提示:修改数据错误!");
        }
    }
Exemple #2
0
    //update data

    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string    id = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        Hashtable ht = new Hashtable();

        string[] arr1 = new string[] { "title", "time0", "kind" };
        for (int i = 0; i < arr1.Length - 1; i++)
        {
            ht.Add(arr1[i], Util.GetControlValue(this.GridView1.Rows[e.RowIndex].Cells[i].Controls[0]));
        }

        ht.Add(arr1[2], ((DropDownList)this.GridView1.Rows[e.RowIndex].Cells[2].FindControl("DropDownList1")).SelectedValue);
        if (ht["title"].ToString().Trim() == "")
        {
            Util.alert(this.Page, "错误提示:标题不能为空");
        }
        else
        {
            ZX_InfoBU info1  = new ZX_InfoBU();
            bool      result = info1.UpdateData(id, ht);
            info1.Close();
            if (result)
            {
                this.GridView1.EditIndex = -1;
                this.BindData(info1);
                Util.alert(this.Page, "修改成功!");
            }
            else
            {
                Util.alert(this.Page, "修改失败!");
            }
        }
    }
Exemple #3
0
    //bind data
    private void BindData()
    {
        ZX_InfoBU info1 = new ZX_InfoBU();
        DataSet   ds1   = info1.GetInfoByID(Request.QueryString["ID"]);

        this.title.Text         = ds1.Tables[0].Rows[0]["title"].ToString();
        this.kind.SelectedValue = ds1.Tables[0].Rows[0]["kind"].ToString();
        this.remark.Text        = ds1.Tables[0].Rows[0]["remark"].ToString();
    }
Exemple #4
0
    //delete data
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string        id    = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        ZX_InfoBU     info1 = new ZX_InfoBU();
        ZX_InfoReadBU info2 = new ZX_InfoReadBU();

        info1.DeleteData(id);
        this.BindData(info1);
        info2.DelDataByID(id);
        info1.Close();
        info2.Close();
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            U_RolesBU role1    = new U_RolesBU();
            bool      isLeader = role1.isRole(new String[] { "公司领导", "综合管理", "评审部角色" });
            role1.Close();
            if (isLeader)
            {
                Response.Redirect("~/ZcMng1/ZongHeSearch.aspx", true);
            }
            else
            {
                this.BindData(null);
                //设置时效警告、邮件、最新信息的提示数据
                U_ZCTimeBU time1 = new U_ZCTimeBU();
                DataSet    ds1   = time1.GetMyTimeList(User.Identity.Name, null, 1);
                this.MyTimeCount.Value = ds1.Tables[0].Rows.Count + "";
                time1.Close();

                ZX_EmailBu email1 = new ZX_EmailBu();
                this.MyEmail.Value = email1.GetNewMailCount() + "";
                email1.Close();

                ZX_InfoBU info1 = new ZX_InfoBU();
                this.MyInfo.Value = info1.GetNewInfoCount() + "";
                info1.Close();


                if ((this.MyTimeCount.Value != "0" || this.MyEmail.Value != "0" || this.MyInfo.Value != "0") &&
                    Session["noReminder_" + User.Identity.Name] == null &&
                    Request.Cookies["noReminder_" + User.Identity.Name] == null)
                {
                    string js = "StartReminder();";
                    if (!Page.ClientScript.IsStartupScriptRegistered("StartJS"))
                    {
                        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "StartJS", js, true);
                    }
                }
            }
        }
        this.AdvanceSearch1.SetDepartRow(false);
        this.AdvanceSearch1.OnMySearchClick += new EventHandler(AdvanceSearch1_OnMySearchClick);
        this.SearchControl1.SearchEvent     += new EventHandler(SearchControl1_SearchEvent);
    }
Exemple #6
0
    //insert data
    protected void btn1_Click(object sender, EventArgs e)
    {
        Hashtable ht = new Hashtable();

        string[] arr1 = new string[] { "title", "remark", "kind", "time0" };
        for (int i = 0; i < arr1.Length - 1; i++)
        {
            ht.Add(arr1[i], Util.GetControlValue(this.title.Parent.FindControl(arr1[i])));
        }
        ht.Add(arr1[3], DateTime.Now.ToString());
        ht["remark"] = this.remark.Text;

        if (ht["title"].ToString().Trim() == "" || ht["remark"].ToString().Trim() == "")
        {
            Util.alert(this.Page, "错误提示:请输入标题或正文");
        }
        else
        {
            for (int i = 1; i <= 5; i++)
            {
                FileUpload f = this.title.Parent.FindControl("file" + i) as FileUpload;
                if (f != null && f.FileName != null && f.FileName != String.Empty)
                {
                    String fname = Path.GetFileNameWithoutExtension(f.FileName);
                    String Rnd   = JSJ.CJZC.Business.Comm.GetMD5String(Util.GetRandomString(10));
                    String exd   = Path.GetExtension(f.FileName);
                    ht["file" + i] = fname + Rnd + exd;
                    f.SaveAs(Server.MapPath(Application["root"] + "/Common/MailFiles/" + ht["file" + i].ToString()));
                }
            }


            ZX_InfoBU info1  = new ZX_InfoBU();
            bool      result = info1.InsertData(ht);
            info1.Close();
            if (result)
            {
                Response.Redirect("InfoMaintenance.aspx", true);
            }
            else
            {
                Util.alert(this.Page, "错误提示:新信息插入失败");
            }
        }
    }
Exemple #7
0
    //绑定数据
    private void BindData()
    {
        ZX_InfoBU info1    = new ZX_InfoBU();
        int       totalRow = 0;
        int       curpage  = 1;

        if (ViewState["curpage"] != null)
        {
            curpage = (int)ViewState["curpage"];
        }
        string orderby = null;

        if (ViewState["orderby"] != null)
        {
            orderby = ((SqlOrderBy)(ViewState["orderby"])).OrderExpression;
        }
        DataSet ds1 = new DataSet();

        if (this.DropDownList1.SelectedValue == "全部")
        {
            ds1 = info1.GetInfo("", this.titleTxt.Text, curpage, this.PageNavigator1.PageSize, orderby, out totalRow);
        }
        else
        {
            ds1 = info1.GetInfo(this.DropDownList1.SelectedValue.Trim().ToString(), this.titleTxt.Text, curpage, this.PageNavigator1.PageSize, orderby, out totalRow);
        }
        this.GridView1.DataSource = ds1;
        this.GridView1.DataBind();

        this.PageNavigator1.TotalRows   = totalRow;
        this.PageNavigator1.CurrentPage = curpage;

        if (ds1.Tables[0].Rows.Count == 0 && curpage > 1)
        {
            ViewState["curpage"] = curpage - 1;
            this.BindData();
        }

        if (totalRow == 0)
        {
            this.PageNavigator1.Visible = false;
        }

        info1.Close();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZX_EmailBu email1 = new ZX_EmailBu();
            this.newmail.Text = email1.GetNewMailCount() + "";
            email1.Close();

            ZX_InfoBU info1 = new ZX_InfoBU();
            this.newinfo.Text = info1.GetNewInfoCount() + "";
            info1.Close();

            U_ZCTimeBU time1 = new U_ZCTimeBU();
            DataSet    ds1   = time1.GetMyTimeList(User.Identity.Name, null, 1);
            this.MyTime.Text = ds1.Tables[0].Rows.Count + "";
            ds1.Dispose();
            time1.Close();
        }
    }
    private void BindData()
    {
        ZX_InfoBU info1 = new ZX_InfoBU();
        string    ID    = Request.QueryString["id"];
        DataSet   ds1   = info1.ReadInfoByID(ID);

        this.FormView1.DataSource = ds1;
        this.FormView1.DataBind();

        Repeater rep1 = this.file;

        if (rep1 != null)
        {
            if (ds1.Tables[0].Rows.Count > 0)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("filename");
                dt.Columns.Add("filename1");
                for (int i = 1; i <= 5; i++)
                {
                    if (ds1.Tables[0].Rows[0]["file" + i].ToString() != String.Empty)
                    {
                        DataRow dr = dt.NewRow();
                        dr["filename"] = ds1.Tables[0].Rows[0]["file" + i].ToString();
                        String fname = Path.GetFileNameWithoutExtension(dr["filename"].ToString());
                        fname           = fname.Substring(0, fname.Length - 32);
                        dr["filename1"] = fname + Path.GetExtension(dr["filename"].ToString());
                        dt.Rows.Add(dr);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    rep1.DataSource = dt;
                    rep1.DataBind();
                }
            }
        }
    }
Exemple #10
0
 //
 private void BindData(ZX_InfoBU info1)
 {
     this.GridView1.DataSource = info1.GetInfo("", "");
     this.GridView1.DataBind();
 }