Exemple #1
0
    private void DisplayDepartmentData()
    {
        if (c.qsAct == ConfigFormAction.edit)
        {
            DepartmentForBackend dept = empAuth.GetDepartmentData(c.qsId);

            if (dept != null)
            {
                txtSortNo.Text   = dept.SortNo.ToString();
                txtDeptName.Text = dept.DeptName;

                //modification info
                ltrPostAccount.Text = dept.PostAccount;
                ltrPostDate.Text    = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dept.PostDate);

                if (dept.MdfDate.HasValue)
                {
                    ltrMdfAccount.Text = dept.MdfAccount;
                    ltrMdfDate.Text    = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dept.MdfDate);
                }

                btnSave.Visible = true;
            }
        }
        else if (c.qsAct == ConfigFormAction.add)
        {
            int newSortNo = empAuth.GetDepartmentMaxSortNo() + 10;
            txtSortNo.Text = newSortNo.ToString();

            btnSave.Visible = true;
        }
    }
Exemple #2
0
        /// <summary>
        /// 取得部門資料
        /// </summary>
        public DepartmentForBackend GetDepartmentData(int deptId)
        {
            DepartmentForBackend entity = null;

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                entity   = empAuthDao.GetDepartmentDataForBackend(deptId);
                dbErrMsg = empAuthDao.GetErrMsg();
            }

            return(entity);
        }
Exemple #3
0
        public EmployeeAuthorizationsWithOwnerInfoOfDataExamined InitialAuthorizationResult(bool isTopPageOfOperation, EmployeeAuthorizations authorizations)
        {
            EmployeeAuthorizationsWithOwnerInfoOfDataExamined authAndOwner = new EmployeeAuthorizationsWithOwnerInfoOfDataExamined(authorizations);

            if (!isTopPageOfOperation)
            {
                // get owner info for config-form
                using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
                {
                    DepartmentForBackend dept = empAuthDao.GetDepartmentDataForBackend(qsId);
                    string dbErrMsg           = empAuthDao.GetErrMsg();

                    if (dept != null)
                    {
                        authAndOwner.OwnerAccountOfDataExamined = dept.PostAccount ?? "";
                        authAndOwner.OwnerDeptIdOfDataExamined  = dept.PostDeptId;
                    }
                }
            }

            return(authAndOwner);
        }
    protected void rptDepartments_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DepartmentForBackend deptData = (DepartmentForBackend)e.Item.DataItem;

        int    deptId   = deptData.DeptId;
        string deptName = deptData.DeptName;
        int    empTotal = deptData.EmpTotal;

        HtmlAnchor btnEdit = (HtmlAnchor)e.Item.FindControl("btnEdit");

        btnEdit.Attributes["onclick"] = string.Format("popWin('Department-Config.aspx?act={0}&id={1}', 700, 600); return false;", ConfigFormAction.edit, deptId);
        btnEdit.Title = Resources.Lang.Main_btnEdit_Hint;

        Literal ltrEdit = (Literal)e.Item.FindControl("ltrEdit");

        ltrEdit.Text = Resources.Lang.Main_btnEdit;

        LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete");

        btnDelete.CommandArgument = string.Join(",", deptId.ToString(), deptName);
        btnDelete.Text            = "<i class='fa fa-trash-o'></i> " + Resources.Lang.Main_btnDelete;
        btnDelete.ToolTip         = Resources.Lang.Main_btnDelete_Hint;
        btnDelete.OnClientClick   = string.Format("return confirm('" + Resources.Lang.Dept_ConfirmDelete_Format + "');",
                                                  deptId, deptName);

        string ownerAccount = deptData.PostAccount;
        int    ownerDeptId  = deptData.PostDeptId;

        btnEdit.Visible = empAuth.CanEditThisPage(false, ownerAccount, ownerDeptId);

        if (!empAuth.CanDelThisPage(ownerAccount, ownerDeptId) ||
            empTotal > 0)
        {
            btnDelete.Visible = false;
        }
    }