Exemple #1
0
    protected void GridBind()//第一次进入、查询、添加、删除和排序时使用
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();

        note.ordername    = ViewState["SortExpression"].ToString();
        note.orderMenthod = ViewState["SortDirection"].ToString();
        note.UnitCode     = _user.UnitCode;
        note.DYear        = DDL_Year.SelectedValue;
        note.DMonth       = DDL_Month.SelectedValue;
        if (DDL_State.SelectedValue != "")
        {
            note.State = int.Parse(DDL_State.SelectedValue);
        }
        GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        if (GridSource.Rows.Count == 0 && currentPage > 1)
        {
            currentPage--;
            GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        }
        total = note.total;
        GridView1.DataSource   = GridSource;
        GridView1.DataKeyNames = new string[] { "tableid", "name", "state", "islocked", "unitcode" };
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;
        HF_Key.Value            = "";
        HF_State.Value          = "";
        //给HF和Session赋值
        HF_total.Value        = total.ToString();
        HF_currentPage.Value  = currentPage.ToString();
        Session["GridSource"] = GridSource;
    }
Exemple #2
0
    protected void Lbtn_finish_Click(object sender, EventArgs e)
    {
        int result = -1;

        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID        = Int32.Parse(HF_Key.Value);
        note.ChgPerson = User.Identity.Name;
        result         = note.Finish();
        if (result == 0)
        {
            //if (GridSource.Rows[GridView1.SelectedIndex]["ID"].ToString() == HF_Key.Value)
            //    {
            GridSource.Rows[GridView1.SelectedIndex]["state"]   = "2";
            GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
            //    break;
            //}

            Lb_result.Text = "提交完毕";
            GridBindFAPR();
        }
        else
        {
            Lb_result.Text = "提交完成失败";
        }
    }
Exemple #3
0
    protected void Lbtn_approve_Click(object sender, EventArgs e)
    {
        int result = -1;

        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID            = Int32.Parse(HF_Key.Value);
        note.ApprovePerson = User.Identity.Name;
        string app = Request["__EVENTARGUMENT"];

        if (app == "0")
        {
            note.IsApproved = true;
        }
        else
        {
            note.IsApproved = false;
        }
        note.log_moduleName = ModuleName;
        note.log_userName   = _user.UserName;
        result = note.Approve();
        if (result == 0)
        {
            //for (int i = 0; i < GridSource.Rows.Count; i++)
            //{
            //    if (GridSource.Rows[i]["ID"].ToString() == HF_Key.Value)
            //    {
            if (app == "0")
            {
                GridSource.Rows[GridView1.SelectedIndex]["state"] = "4";
            }
            else
            {
                GridSource.Rows[GridView1.SelectedIndex]["state"] = "3";
            }
            GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
            //break;
            //    }
            //}
            GridBindFAPR();

            Lb_result.Text = "审批完毕";
        }
        else
        {
            Lb_result.Text = "审批失败";
        }
    }
Exemple #4
0
 protected void PagerButtonClick(object sender, EventArgs e)
 {
     try
     {
         int pagenum = total / (GridView1.PageSize);
         if (GridView1.PageSize * pagenum < total)
         {
             pagenum += 1;
         }
         if (txt_page.Text == "0")
         {
             txt_page.Text = "1";
         }
         else if (int.Parse(txt_page.Text) > pagenum)
         {
             txt_page.Text = pagenum.ToString();
         }
         GridView1.SelectedIndex = -1;
         HF_Key.Value            = "";
         HF_State.Value          = "";
         linkBtnPage.CommandName = txt_page.Text;
         EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
         note.ordername    = ViewState["SortExpression"].ToString();
         note.orderMenthod = ViewState["SortDirection"].ToString();
         note.UnitCode     = _user.UnitCode;
         note.DYear        = DDL_Year.SelectedValue;
         note.DMonth       = DDL_Month.SelectedValue;
         if (DDL_State.SelectedValue != "")
         {
             note.State = int.Parse(DDL_State.SelectedValue);
         }
         currentPage = Convert.ToInt32(((LinkButton)sender).CommandName);
         GridSource  = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
         GridBindFAPR();
         //给HF和Session赋值
         HF_total.Value        = total.ToString();
         HF_currentPage.Value  = currentPage.ToString();
         Session["GridSource"] = GridSource;
     }
     catch
     {
         Lb_result.Text = "输入页码非法!";
     }
 }
Exemple #5
0
    protected void Lbtn_OK_Click(object sender, EventArgs e)
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        int result = -1;

        note.Name       = TB_name.Value;
        note.UnitCode   = _user.UnitCode;
        note.IsApproved = false;
        //note.Memo = "";
        try
        {
            Stream myStream   = File1.PostedFile.InputStream;
            int    imgDataLen = File1.PostedFile.ContentLength;
            byte[] imgData    = new byte[imgDataLen];
            myStream.Read(imgData, 0, imgDataLen);
            note.File = imgData;

            note.ContentType = File1.PostedFile.ContentType;
            string fielName = File1.PostedFile.FileName;
            int    i        = fielName.LastIndexOf('.');
            note.FileType = fielName.Substring(i + 1, fielName.Length - i - 1);
        }
        catch
        {
        }
        note.log_moduleName = ModuleName;
        note.log_userName   = _user.UserName;
        note.Memo           = TA_Memo.Value;
        if (HF_Operate.Value == "add")
        {
            note.AddPerson = User.Identity.Name;
            note.DYear     = Request["year"].ToString();
            note.DMonth    = Request["month"].ToString();
            result         = note.Insert();
        }
        if (HF_Operate.Value == "edit")
        {
            note.ChgPerson = User.Identity.Name;
            note.ID        = Int32.Parse(HF_ID.Value);
            result         = note.Update();
        }
        Response.Write("<script language='javascript'>javascript:var s=new Object();s.success=true;s.data='" + result + "';window.returnValue=s;self.close();</script>");
    }
Exemple #6
0
    protected void Lbtn_publish_Click(object sender, EventArgs e)
    {
        int result = -1;

        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID        = Int32.Parse(HF_Key.Value);
        note.ChgPerson = User.Identity.Name;
        string state = Request["__EVENTARGUMENT"];

        result = note.Publish(state);
        if (result == 0)
        {
            //for (int i = 0; i < GridSource.Rows.Count; i++)
            //{
            //    if (GridSource.Rows[i]["ID"].ToString() == HF_Key.Value)
            //    {
            GridSource.Rows[GridView1.SelectedIndex]["state"]   = state;
            GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
            //        break;
            //    }
            //}
            GridBindFAPR();
            if (state == "6")
            {
                Lb_result.Text = "发布成功";
            }
            else
            {
                Lb_result.Text = "取消发布成功";
            }
        }
        else
        {
            if (state == "6")
            {
                Lb_result.Text = "发布失败";
            }
            else
            {
                Lb_result.Text = "取消发布失败";
            }
        }
    }
    protected void Lbtn_OK_Click(object sender, EventArgs e)
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        int result = -1;
        note.Name = TB_name.Value;
        note.UnitCode = _user.UnitCode;
        note.IsApproved = false;
        //note.Memo = "";
        try
        {
            Stream myStream = File1.PostedFile.InputStream;
            int imgDataLen = File1.PostedFile.ContentLength;
            byte[] imgData = new byte[imgDataLen];
            myStream.Read(imgData, 0, imgDataLen);
            note.File = imgData;

            note.ContentType = File1.PostedFile.ContentType;
            string fielName = File1.PostedFile.FileName;
            int i = fielName.LastIndexOf('.');
            note.FileType = fielName.Substring(i + 1, fielName.Length - i - 1);
        }
        catch
        {
        }
        note.log_moduleName = ModuleName;
        note.log_userName = _user.UserName;
        note.Memo = TA_Memo.Value;
        if (HF_Operate.Value == "add")
        {
            note.AddPerson = User.Identity.Name;
            note.DYear = Request["year"].ToString();
            note.DMonth = Request["month"].ToString();
            result = note.Insert();
        }
        if (HF_Operate.Value == "edit")
        {
            note.ChgPerson = User.Identity.Name;
            note.ID = Int32.Parse(HF_ID.Value);
            result = note.Update();
        }
        Response.Write("<script language='javascript'>javascript:var s=new Object();s.success=true;s.data='"+result+"';window.returnValue=s;self.close();</script>");
    }
Exemple #8
0
    protected void Lbtn_del_Click(object sender, EventArgs e)
    {
        int result = -1;

        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID             = Int32.Parse(HF_Key.Value);
        note.ChgPerson      = User.Identity.Name;
        note.log_moduleName = ModuleName;
        note.log_userName   = _user.UserName;
        result = note.Delete();
        if (result == 0)
        {
            GridBind();
            Lb_result.Text = "删除成功";
        }
        else
        {
            Lb_result.Text = "删除失败";
        }
    }
Exemple #9
0
    public void UpdateGridSource()
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID = Int32.Parse(HF_Key.Value);
        DataTable dt = note.getCoulmnNamesByID();
        int j;
        if (dt.Rows.Count > 0)
        {
            //for (i = 0; i < GridSource.Rows.Count; i++)
            //{
            //    if (GridSource.Rows[i]["ID"].ToString() == dt.Rows[0]["ID"].ToString())
            //    {
            for (j = 0; j < dt.Columns.Count; j++)
            {
                GridSource.Rows[GridView1.SelectedIndex][j] = dt.Rows[0][j];
            }

            //        break;
            //    }
            //}
        }
    }
Exemple #10
0
    public void UpdateGridSource()
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID = Int32.Parse(HF_Key.Value);
        DataTable dt = note.getCoulmnNamesByID();
        int       j;

        if (dt.Rows.Count > 0)
        {
            //for (i = 0; i < GridSource.Rows.Count; i++)
            //{
            //    if (GridSource.Rows[i]["ID"].ToString() == dt.Rows[0]["ID"].ToString())
            //    {
            for (j = 0; j < dt.Columns.Count; j++)
            {
                GridSource.Rows[GridView1.SelectedIndex][j] = dt.Rows[0][j];
            }

            //        break;
            //    }
            //}
        }
    }
Exemple #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ModuleKey  = "010101";
     ModuleName = "日常办公-通知通告";
     Response.Cache.SetExpires(DateTime.Now);
     Response.Cache.SetCacheability(HttpCacheability.Public);
     Response.Cache.SetValidUntilExpires(true);
     if (!IsPostBack)
     {
         string operate = Request["code"].ToString();
         HF_Operate.Value = operate;
         if (operate != "add")
         {
             string id = Request["id"].ToString();
             HF_ID.Value = id;
             EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
             note.ID = Int32.Parse(id);
             DataTable table = note.getOriginTableByID();
             TB_name.Value = table.Rows[0]["name"].ToString();
             TA_Memo.Value = table.Rows[0]["memo"].ToString();
             this.Title    = "修改通知通告";
         }
     }
 }
Exemple #12
0
    public void DownContent(int ID)
    {
        Lb_result.Text = "";
        EnterpriseOpration.Notification filePub = new EnterpriseOpration.Notification();
        filePub.ID = ID;
        DataTable dt = filePub.getOriginTableByID();
        if (dt.Rows[0]["thefile"] != System.DBNull.Value)
        {
            byte[] thefile = (byte[])dt.Rows[0]["thefile"];

            string fileName = dt.Rows[0]["name"].ToString() + "." + dt.Rows[0]["filetype"].ToString();
            fileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
            this.Response.ContentType = dt.Rows[0]["ContentType"].ToString();
            this.Response.AppendHeader("Content-Disposition", "attachment;filename = " + fileName);
            this.Response.OutputStream.Write(thefile, 0, thefile.Length);
            this.Response.OutputStream.Close();
            HttpContext.Current.Response.End();
        }
        else
        {
            Lb_result.Text = "本记录没有文件!";

        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     ModuleKey = "010101";
     ModuleName = "日常办公-通知通告";
     Response.Cache.SetExpires(DateTime.Now);
     Response.Cache.SetCacheability(HttpCacheability.Public);
     Response.Cache.SetValidUntilExpires(true);
     if (!IsPostBack)
     {
         string operate = Request["code"].ToString();
         HF_Operate.Value = operate;
         if (operate != "add")
         {
             string id = Request["id"].ToString();
             HF_ID.Value = id;
             EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
             note.ID = Int32.Parse(id);
             DataTable table = note.getOriginTableByID();
             TB_name.Value = table.Rows[0]["name"].ToString();
             TA_Memo.Value = table.Rows[0]["memo"].ToString();
             this.Title = "修改通知通告";
         }
     }
 }
Exemple #14
0
    protected void Lbtn_newsContent_Click(object sender, EventArgs e)
    {
        Lb_result.Text = "";
        EnterpriseOpration.Notification filePub = new EnterpriseOpration.Notification();
        filePub.ID = Convert.ToInt32(Request["__EVENTARGUMENT"]);
        DataTable dt = filePub.getOriginTableByID();

        if (dt.Rows[0]["thefile"] != System.DBNull.Value)
        {
            byte[] thefile = (byte[])dt.Rows[0]["thefile"];

            string fileName = dt.Rows[0]["name"].ToString() + "." + dt.Rows[0]["filetype"].ToString();
            fileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
            this.Response.ContentType = dt.Rows[0]["ContentType"].ToString();
            this.Response.AppendHeader("Content-Disposition", "attachment;filename = " + fileName);
            this.Response.OutputStream.Write(thefile, 0, thefile.Length);
            this.Response.OutputStream.Close();
            HttpContext.Current.Response.End();
        }
        else
        {
            Lb_result.Text = "本记录没有文件!";
        }
    }
Exemple #15
0
    public void DownContent(int ID)
    {
        Lb_result.Text = "";
        EnterpriseOpration.Notification filePub = new EnterpriseOpration.Notification();
        filePub.ID = ID;
        DataTable dt = filePub.getOriginTableByID();

        if (dt.Rows[0]["thefile"] != System.DBNull.Value)
        {
            byte[] thefile = (byte[])dt.Rows[0]["thefile"];

            string fileName = dt.Rows[0]["name"].ToString() + "." + dt.Rows[0]["filetype"].ToString();
            fileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
            this.Response.ContentType = dt.Rows[0]["ContentType"].ToString();
            this.Response.AppendHeader("Content-Disposition", "attachment;filename = " + fileName);
            this.Response.OutputStream.Write(thefile, 0, thefile.Length);
            this.Response.OutputStream.Close();
            HttpContext.Current.Response.End();
        }
        else
        {
            Lb_result.Text = "本记录没有文件!";
        }
    }
Exemple #16
0
 protected void PagerButtonClick(object sender, EventArgs e)
 {
     try
     {
         int pagenum = total / (GridView1.PageSize);
         if (GridView1.PageSize * pagenum < total)
             pagenum += 1;
         if (txt_page.Text == "0")
             txt_page.Text = "1";
         else if (int.Parse(txt_page.Text) > pagenum)
             txt_page.Text = pagenum.ToString();
         GridView1.SelectedIndex = -1;
         HF_Key.Value = "";
         HF_State.Value = "";
         linkBtnPage.CommandName = txt_page.Text;
         EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
         note.ordername = ViewState["SortExpression"].ToString();
         note.orderMenthod = ViewState["SortDirection"].ToString();
         note.UnitCode = _user.UnitCode;
         note.DYear = DDL_Year.SelectedValue;
         note.DMonth = DDL_Month.SelectedValue;
         if (DDL_State.SelectedValue != "")
             note.State = int.Parse(DDL_State.SelectedValue);
         currentPage = Convert.ToInt32(((LinkButton)sender).CommandName);
         GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
         GridBindFAPR();
         //给HF和Session赋值
         HF_total.Value = total.ToString();
         HF_currentPage.Value = currentPage.ToString();
         Session["GridSource"] = GridSource;
     }
     catch
     {
         Lb_result.Text = "输入页码非法!";
     }
 }
Exemple #17
0
 protected void Lbtn_publish_Click(object sender, EventArgs e)
 {
     int result = -1;
     EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
     note.ID = Int32.Parse(HF_Key.Value);
     note.ChgPerson = User.Identity.Name;
     string state = Request["__EVENTARGUMENT"];
     result = note.Publish(state);
     if (result == 0)
     {
         //for (int i = 0; i < GridSource.Rows.Count; i++)
         //{
         //    if (GridSource.Rows[i]["ID"].ToString() == HF_Key.Value)
         //    {
         GridSource.Rows[GridView1.SelectedIndex]["state"] = state;
         GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
         //        break;
         //    }
         //}
         GridBindFAPR();
         if (state == "6")
             Lb_result.Text = "发布成功";
         else
             Lb_result.Text = "取消发布成功";
     }
     else
     {
         if (state == "6")
             Lb_result.Text = "发布失败";
         else
             Lb_result.Text = "取消发布失败";
     }
 }
Exemple #18
0
    protected void Lbtn_newsContent_Click(object sender, EventArgs e)
    {
        Lb_result.Text = "";
        EnterpriseOpration.Notification filePub = new EnterpriseOpration.Notification();
        filePub.ID = Convert.ToInt32(Request["__EVENTARGUMENT"]);
        DataTable dt = filePub.getOriginTableByID();
        if (dt.Rows[0]["thefile"] != System.DBNull.Value)
        {
            byte[] thefile = (byte[])dt.Rows[0]["thefile"];

            string fileName = dt.Rows[0]["name"].ToString() + "." + dt.Rows[0]["filetype"].ToString();
            fileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
            this.Response.ContentType = dt.Rows[0]["ContentType"].ToString();
            this.Response.AppendHeader("Content-Disposition", "attachment;filename = " + fileName);
            this.Response.OutputStream.Write(thefile, 0, thefile.Length);
            this.Response.OutputStream.Close();
            HttpContext.Current.Response.End();
        }
        else
        {
            Lb_result.Text = "本记录没有文件!";
        }
    }
Exemple #19
0
    protected void Lbtn_finish_Click(object sender, EventArgs e)
    {
        int result = -1;
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID = Int32.Parse(HF_Key.Value);
        note.ChgPerson = User.Identity.Name;
        result = note.Finish();
        if (result == 0)
        {
            //if (GridSource.Rows[GridView1.SelectedIndex]["ID"].ToString() == HF_Key.Value)
            //    {
            GridSource.Rows[GridView1.SelectedIndex]["state"] = "2";
            GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
            //    break;
            //}

            Lb_result.Text = "提交完毕";
            GridBindFAPR();

        }
        else
            Lb_result.Text = "提交完成失败";
    }
Exemple #20
0
 protected void Lbtn_del_Click(object sender, EventArgs e)
 {
     int result = -1;
     EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
     note.ID = Int32.Parse(HF_Key.Value);
     note.ChgPerson = User.Identity.Name;
     note.log_moduleName = ModuleName;
     note.log_userName = _user.UserName;
     result = note.Delete();
     if (result == 0)
     {
         GridBind();
         Lb_result.Text = "删除成功";
     }
     else
         Lb_result.Text = "删除失败";
 }
Exemple #21
0
    protected void Lbtn_approve_Click(object sender, EventArgs e)
    {
        int result = -1;
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
        note.ID = Int32.Parse(HF_Key.Value);
        note.ApprovePerson = User.Identity.Name;
        string app = Request["__EVENTARGUMENT"];
        if (app == "0")
            note.IsApproved = true;
        else
            note.IsApproved = false;
        note.log_moduleName = ModuleName;
        note.log_userName = _user.UserName;
        result = note.Approve();
        if (result == 0)
        {
            //for (int i = 0; i < GridSource.Rows.Count; i++)
            //{
            //    if (GridSource.Rows[i]["ID"].ToString() == HF_Key.Value)
            //    {
            if (app == "0")
                GridSource.Rows[GridView1.SelectedIndex]["state"] = "4";
            else
                GridSource.Rows[GridView1.SelectedIndex]["state"] = "3";
            GridSource.Rows[GridView1.SelectedIndex]["chgDate"] = note.ChgDate;
            //break;
            //    }
            //}
            GridBindFAPR();

            Lb_result.Text = "审批完毕";

        }
        else
            Lb_result.Text = "审批失败";
    }
Exemple #22
0
    //第一次进入、查询、添加、删除和排序时使用
    protected void GridBind()
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();

        note.ordername = ViewState["SortExpression"].ToString();
        note.orderMenthod = ViewState["SortDirection"].ToString();
        note.UnitCode = _user.UnitCode;
        note.DYear = DDL_Year.SelectedValue;
        note.DMonth = DDL_Month.SelectedValue;
        if (DDL_State.SelectedValue != "")
            note.State = int.Parse(DDL_State.SelectedValue);
        GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        if (GridSource.Rows.Count == 0 && currentPage > 1)
        {
            currentPage--;
            GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        }
        total = note.total;
        GridView1.DataSource = GridSource;
        GridView1.DataKeyNames = new string[] { "tableid", "name", "state", "islocked", "unitcode" };
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;
        HF_Key.Value = "";
        HF_State.Value = "";
        //给HF和Session赋值
        HF_total.Value = total.ToString();
        HF_currentPage.Value = currentPage.ToString();
        Session["GridSource"] = GridSource;
    }