/// <summary>
        ///
        /// </summary>
        //private void BindCompany()
        //{
        //    treeOrganization.Items.Clear();
        //    if (allCompanys != null)
        //    {
        //        foreach (T_HR_COMPANY tmpOrg in allCompanys)
        //        {
        //            if (tmpOrg.T_HR_COMPANY2 == null || string.IsNullOrEmpty(tmpOrg.T_HR_COMPANY2.COMPANYID))
        //            {
        //                TreeViewItem item = new TreeViewItem();
        //                item.Header = tmpOrg.CNAME;
        //                item.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate;
        //                item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style;
        //                item.DataContext = tmpOrg;

        //                //标记为公司
        //                item.Tag = "0";
        //                treeOrganization.Items.Add(item);

        //                AddChildOrgItems(item, tmpOrg.COMPANYID);
        //            }
        //        }
        //    }
        //}

        //private void AddChildOrgItems(TreeViewItem item, string companyID)
        //{
        //    List<T_HR_COMPANY> childs = GetChildORG(companyID);
        //    if (childs == null || childs.Count <= 0)
        //        return;

        //    foreach (T_HR_COMPANY childOrg in childs)
        //    {
        //        TreeViewItem childItem = new TreeViewItem();
        //        childItem.Header = childOrg.CNAME;
        //        childItem.DataContext = childOrg;
        //        childItem.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate;
        //        childItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style;

        //        //标记为公司
        //        childItem.Tag = "0";
        //        item.Items.Add(childItem);

        //        AddChildOrgItems(childItem, childOrg.COMPANYID);
        //    }
        //}

        //private List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> GetChildORG(string companyID)
        //{
        //    List<T_HR_COMPANY> orgs = new List<T_HR_COMPANY>();

        //    foreach (T_HR_COMPANY org in allCompanys)
        //    {
        //        if (org.T_HR_COMPANY2 != null && org.T_HR_COMPANY2.COMPANYID == companyID)
        //            orgs.Add(org);
        //    }
        //    return orgs;
        //}

        //private void BindDepartment()
        //{
        //    if (allDepartments != null)
        //    {
        //        foreach (T_HR_DEPARTMENT tmpDep in allDepartments)
        //        {
        //            if (tmpDep.T_HR_COMPANY == null)
        //                continue;

        //            TreeViewItem parentItem = GetParentItem("0", tmpDep.T_HR_COMPANY.COMPANYID);
        //            if (parentItem != null)
        //            {
        //                TreeViewItem item = new TreeViewItem();

        //                item.Header = tmpDep.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
        //                item.DataContext = tmpDep;
        //                item.HeaderTemplate = Application.Current.Resources["DepartmentItemStyle"] as DataTemplate;
        //                item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style;

        //                //标记为部门
        //                item.Tag = "1";
        //                parentItem.Items.Add(item);
        //            }
        //        }
        //    }
        //}

        //private TreeViewItem GetParentItem(string parentType, string parentID)
        //{
        //    TreeViewItem tmpItem = null;
        //    foreach (TreeViewItem item in treeOrganization.Items)
        //    {
        //        tmpItem = GetParentItemFromChild(item, parentType, parentID);
        //        if (tmpItem != null)
        //        {
        //            break;
        //        }
        //    }
        //    return tmpItem;
        //}

        //private TreeViewItem GetParentItemFromChild(TreeViewItem item, string parentType, string parentID)
        //{
        //    TreeViewItem tmpItem = null;
        //    if (item.Tag != null && item.Tag.ToString() == parentType)
        //    {
        //        switch (parentType)
        //        {
        //            case "0":
        //                T_HR_COMPANY tmpOrg = item.DataContext as T_HR_COMPANY;
        //                if (tmpOrg != null)
        //                {
        //                    if (tmpOrg.COMPANYID == parentID)
        //                        return item;
        //                }
        //                break;
        //            case "1":
        //                T_HR_DEPARTMENT tmpDep = item.DataContext as T_HR_DEPARTMENT;
        //                if (tmpDep != null)
        //                {
        //                    if (tmpDep.DEPARTMENTID == parentID)
        //                        return item;
        //                }
        //                break;
        //        }

        //    }
        //    if (item.Items != null && item.Items.Count > 0)
        //    {
        //        foreach (TreeViewItem childitem in item.Items)
        //        {
        //            tmpItem = GetParentItemFromChild(childitem, parentType, parentID);
        //            if (tmpItem != null)
        //            {
        //                break;
        //            }
        //        }
        //    }
        //    return tmpItem;
        //}

        //private void BindPosition()
        //{
        //    if (allPositions != null)
        //    {
        //        foreach (T_HR_POST tmpPosition in allPositions)
        //        {
        //            if (tmpPosition.T_HR_DEPARTMENT == null || string.IsNullOrEmpty(tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID))
        //                continue;
        //            TreeViewItem parentItem = GetParentItem("1", tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID);
        //            if (parentItem != null)
        //            {
        //                TreeViewItem item = new TreeViewItem();
        //                item.Header = tmpPosition.T_HR_POSTDICTIONARY.POSTNAME;
        //                item.DataContext = tmpPosition;
        //                item.HeaderTemplate = Application.Current.Resources["PositionItemStyle"] as DataTemplate;
        //                item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style;

        //                //标记为岗位
        //                item.Tag = "2";
        //                parentItem.Items.Add(item);
        //            }
        //        }
        //    }
        //}

        /// <summary>
        /// 单人审核
        /// </summary>
        private void AuditPerBalance()
        {
            string strMonthlyBalanceID = string.Empty;
            //if (dgAMBList.SelectedItems == null)
            //{
            //    ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "APPOVALBUTTON"), Utility.GetResourceStr("CONFIRMBUTTON"));
            //    return;
            //}

            //if (dgAMBList.SelectedItems.Count == 0)
            //{
            //    ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "APPOVALBUTTON"), Utility.GetResourceStr("CONFIRMBUTTON"));
            //    return;
            //}

            T_HR_ATTENDMONTHLYBALANCE entAttBalance = dgAMBList.SelectedItems[0] as T_HR_ATTENDMONTHLYBALANCE;

            strMonthlyBalanceID = entAttBalance.MONTHLYBALANCEID;
            AttendMonthlyBalanceForm formAttBalance = new AttendMonthlyBalanceForm(FormTypes.Audit, strMonthlyBalanceID);
            EntityBrowser            browser        = new EntityBrowser(formAttBalance);

            browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
            browser.FormType         = FormTypes.Audit;
            browser.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
        }
        void clientAtt_GetAttendMonthlyBalanceByIDCompleted(object sender, GetAttendMonthlyBalanceByIDCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                entAttendMonthlyBalance = e.Result;
                this.DataContext        = entAttendMonthlyBalance;

                if (entAttendMonthlyBalance != null)
                {
                    clientPer.GetEmployeeDetailByIDAsync(entAttendMonthlyBalance.EMPLOYEEID);
                }


                RefreshUI(RefreshedTypes.AuditInfo);
                SetToolBar();
            }
            else
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Error.Message));
            }
        }
        void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            string strID = "";

            if (dgAMBList.SelectedItems == null)
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON"));
                return;
            }

            if (dgAMBList.SelectedItems.Count == 0)
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON"));
                return;
            }

            foreach (object ovj in dgAMBList.SelectedItems)
            {
                T_HR_ATTENDMONTHLYBALANCE ent = ovj as T_HR_ATTENDMONTHLYBALANCE;

                string Result = "";
                if (ent != null)
                {
                    //strID = ent.MONTHLYBALANCEID.ToString();
                    strID += ent.MONTHLYBALANCEID + ",";
                    if (ent.CHECKSTATE == Convert.ToInt32(CheckStates.Approving).ToString() || ent.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString() || ent.CHECKSTATE == Convert.ToInt32(CheckStates.UnApproved).ToString())
                    {
                        ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("DELETEAUDITERROR"), Utility.GetResourceStr("CONFIRMBUTTON"));
                        return;
                    }
                }
                ComfirmWindow delComfirm = new ComfirmWindow();
                delComfirm.OnSelectionBoxClosed += (obj, result) =>
                {
                    clientAtt.RemoveAttendMonthlyBalanceAsync(strID);
                };
                delComfirm.SelectionBox(Utility.GetResourceStr("DELETECONFIRM"), Utility.GetResourceStr("DELETEALTER"), ComfirmWindow.titlename, Result);
            }
        }
Exemple #4
0
 public string ModifyAttendMonthlyBalance(T_HR_ATTENDMONTHLYBALANCE entTemp)
 {
     using (AttendMonthlyBalanceBLL bllAttendMonthlyBalance = new AttendMonthlyBalanceBLL())
     {
         return bllAttendMonthlyBalance.ModifyMonthlyBalance(entTemp);
     }
 }
        void clientAtt_GetAttendMonthlyBalanceByIDCompleted(object sender, GetAttendMonthlyBalanceByIDCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                entAttendMonthlyBalance = e.Result;
                this.DataContext = entAttendMonthlyBalance;

                if (entAttendMonthlyBalance != null)
                {
                    clientPer.GetEmployeeDetailByIDAsync(entAttendMonthlyBalance.EMPLOYEEID);
                }


                RefreshUI(RefreshedTypes.AuditInfo);
                SetToolBar();
            }
            else
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Error.Message));
            }
        }