protected void btnExport_Click(object sender, EventArgs e)
 {
     OrgmanagerModel model = new OrgmanagerModel();
     List<OrgmanagerModel> list = bll.GetList(dt_global);
     string[] header = { ControlText.gvHeadWorkNo, ControlText.gvHeadLocalName, ControlText.gvHeadParamsOrgDepName, ControlText.gvHeadLevelName, ControlText.gvHeadManagerName, ControlText.gvHeadIsManager, ControlText.gvHeadIsTW, ControlText.gvHeadTel, ControlText.gvHeadNotes};
     string[] properties = { "WorkNo", "LocalName", "DepName", "LevelName", "ManagerName", "IsDirectlyUnder", "IsTW", "Tel", "Notes"};
     string filePath = MapPath("~/ExportFileTemp/") + DateTime.Now.Ticks + ".xls";
     NPOIHelper.ExportExcel(list, header, properties, 5000, filePath);
     PageHelper.ReturnHTTPStream(filePath, true);
 }
        protected override void AjaxProcess()
        {
            string noticeJson = null;
            DataTable dt = new DataTable();
            if (!string.IsNullOrEmpty(Request.Form["Empno"]))
            {
                OrgmanagerBll bll = new OrgmanagerBll();
                string empno = Request.Form["Empno"];
                OrgmanagerModel model = new OrgmanagerModel();
                dt = bll.GetInfo(empno);
                if (dt.Rows.Count != 0)
                {
                    model.LocalName = dt.Rows[0]["LocalName"].ToString();
                    model.Manager = dt.Rows[0]["managercode"].ToString();
                    model.Notes = dt.Rows[0]["notes"].ToString();
                }
                if (model != null)
                {
                    noticeJson = JsSerializer.Serialize(model);
                }
                Response.Clear();
                Response.Write(noticeJson);
                Response.End();
            }
            if (!string.IsNullOrEmpty(Request.Form["Deputy"]))
            {
                OrgmanagerBll bll = new OrgmanagerBll();
                string empno = Request.Form["Deputy"];
                OrgmanagerModel model = new OrgmanagerModel();
                dt = bll.GetInfo(empno);
                if (dt.Rows.Count != 0)
                {
                    model.DeputyName = dt.Rows[0]["LocalName"].ToString();
                    model.DeputyNotes = dt.Rows[0]["notes"].ToString();
                }
                if (model != null)
                {
                    noticeJson = JsSerializer.Serialize(model);
                }
                Response.Clear();
                Response.Write(noticeJson);
                Response.End();
            }

            if (!string.IsNullOrEmpty(Request.Form["WorkNo"]))
            {
                OrgmanagerModel model = new OrgmanagerModel();
                OrgmanagerBll bll = new OrgmanagerBll();
                DataTable dt1 = new DataTable();
                if (!string.IsNullOrEmpty(Request.Form["WorkNo"]))
                {
                    model.WorkNo = Request.Form["WorkNo"];
                    model.DepCode = Request.Form["DepCode"];
                    dt1 = bll.GetOrgmanager(model);

                    if (dt1 != null)
                    {
                        noticeJson = dt1.Rows.Count.ToString();
                    }
                    Response.Clear();
                    Response.Write(noticeJson);
                    Response.End();
                }
            }
        }
 /// <summary>
 /// 綁定數據
 /// </summary>
 private void DataBind()
 {
     ImportFlag.Value = "1";
     txtDepName.Attributes.Add("readonly", "true");
     txtWorkNo.Attributes.Add("readonly", "true");
     txtLocalName.Attributes.Add("readonly", "true");
     ddlManager.Attributes.Add("disabled", "true");
     txtNotes.Attributes.Add("readonly", "true");
     txtDeputy.Attributes.Add("readonly", "true");
     txtDeputyName.Attributes.Add("readonly", "true");
     txtDeputyNotes.Attributes.Add("readonly", "true");
     chkIsDirectlyUnder.Attributes.Add("disabled", "true");
     chkIsBGAudit.Attributes.Add("disabled", "true");
     btnSave.Attributes.Add("disabled", "true");
     btnCancel.Attributes.Add("disabled", "true");
     btnCondition.Attributes.Clear();
     btnQuery.Attributes.Clear();
     btnAdd.Attributes.Clear();
     btnDelete.Attributes.Clear();
     btnModify.Attributes.Clear();
     PanelData.Attributes.Add("class", "inner_table");
     PanelImport.Attributes.Add("class", "img_hidden");
     btnImport.Text = Message.btnImport;
     OrgmanagerModel model = new OrgmanagerModel();
     OrgmanagerBll bll = new OrgmanagerBll();
     ddlManager.DataSource = bll.GetManager();
     ddlManager.DataValueField = "MANAGERCODE";
     ddlManager.DataTextField = "MANAGERNAME";
     ddlManager.DataBind();
     this.ddlManager.Items.Insert(0, new ListItem("", ""));
     this.ddlManager.SelectedValue = "";
     DataTable dt = bll.GetOrgmanager(model, pager.CurrentPageIndex, pager.PageSize, out totalCount, base.SqlDep);
     pager.RecordCount = totalCount;
     this.UltraWebGridManagerInfo.DataSource = dt;
     this.UltraWebGridManagerInfo.DataBind();
     pager.TextAfterPageIndexBox = "/" + pager.PageCount.ToString();
 }