コード例 #1
0
ファイル: ModelCodeEdit.xaml.cs プロジェクト: JuRogn/OA
        private void btnSelect2_Click(object sender, RoutedEventArgs e)
        {

            CompanyLookUp up = new CompanyLookUp();
            up.SelectedClick += (obj, ev) =>
            {
                if (up.SelectList != null)
                {
                    foreach (var item in up.SelectList)
                    {
                        var companyObj = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)(item.ObjectInstance);
                        string companyid = companyObj.COMPANYID;
                        string companyName = companyObj.CNAME;
                        FLOW_MODELDEFINE_FREEFLOW entity = new FLOW_MODELDEFINE_FREEFLOW();
                        entity.MODELDEFINEFREEFLOWID = Guid.NewGuid().ToString().Replace("-", ""); ;
                        entity.MODELCODE = this.txtModelCode.Text;//模块代码
                        entity.COMPANYNAME = companyName;//允许[自选流程]的公司名称
                        entity.COMPANYID = companyid;//允许[自选流程]的公司D
                        entity.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;// Utility.CurrentUser.EMPLOYEEID;//创建人ID
                        entity.CREATEUSERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;// Utility.CurrentUser.USERNAME;//创建人名
                        entity.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;// Utility.CurrentUser.OWNERCOMPANYID;//创建公司ID
                        entity.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;//  Utility.CurrentUser.OWNERDEPARTMENTID;//创建部门ID
                        entity.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;//  Utility.CurrentUser.OWNERPOSTID;//创建岗位ID
                        entity.CREATEDATE = DateTime.Now;//创建时间
                        var company = from ee in FreeFlowCompanyList
                                      where ee.COMPANYID == companyid
                                      select ee;
                        if (company.FirstOrDefault() == null)
                        {
                            FreeFlowCompanyList.Add(entity);
                        }                        
                    }
                    dgCompany2.ItemsSource = FreeFlowCompanyList;
                }
            };
            up.Show();
            #region
            //object objs = null;
            //if (Application.Current.Resources["CurrentUserID"] != null)
            //{
            //    objs = Application.Current.Resources["CurrentUserID"];
            //    Application.Current.Resources.Remove("CurrentUserID");
            //    Application.Current.Resources.Add("CurrentUserID", "");
            //}
            //if (Application.Current.Resources["CurrentUserID"] == null)
            //{
            //    Application.Current.Resources.Add("CurrentUserID", "");
            //}
            //SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup lookup = new SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup(Utility.CurrentUser.EMPLOYEEID, "3", "");
            //lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
            //lookup.MultiSelected = true;
            //lookup.SelectedClick += (obj, ev) =>
            //{
            //    if (lookup.SelectedObj != null)
            //    {                   
            //        foreach (var item in lookup.SelectedObj)
            //        {
            //            var companyObj = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)(item.ObjectInstance);
            //            string companyid = companyObj.COMPANYID;
            //            string companyName = companyObj.CNAME;
            //            FLOW_MODELDEFINE_FREEFLOW entity = new FLOW_MODELDEFINE_FREEFLOW();
            //            entity.MODELDEFINEFREEFLOWID = Guid.NewGuid().ToString().Replace("-", ""); ;
            //            entity.MODELCODE = this.txtModelCode.Text;//模块代码
            //            entity.COMPANYNAME = companyName;//允许[自选流程]的公司名称
            //            entity.COMPANYID = companyid;//允许[自选流程]的公司D
            //            entity.CREATEUSERID = Utility.CurrentUser.OWNERID;//创建人ID
            //            entity.CREATEUSERNAME = Utility.CurrentUser.USERNAME;//创建人名
            //            entity.CREATECOMPANYID = Utility.CurrentUser.OWNERCOMPANYID;//创建公司ID
            //            entity.CREATEDEPARTMENTID = Utility.CurrentUser.OWNERDEPARTMENTID;//创建部门ID
            //            entity.CREATEPOSTID = Utility.CurrentUser.OWNERPOSTID;//创建岗位ID
            //            entity.CREATEDATE = DateTime.Now;//创建时间
            //            FreeFlowCompanyList.Add(entity);

            //            Application.Current.Resources.Remove("CurrentUserID");
            //            if (objs != null)
            //            {
            //                Application.Current.Resources.Add("CurrentUserID", objs);
            //            }
            //        }
            //        dgCompany2.ItemsSource = FreeFlowCompanyList;
            //    }
            //};
            //lookup.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });


            #endregion
        }
コード例 #2
0
        private void btnSelect2_Click(object sender, RoutedEventArgs e)
        {
            CompanyLookUp up = new CompanyLookUp();

            up.SelectedClick += (obj, ev) =>
            {
                if (up.SelectList != null)
                {
                    foreach (var item in up.SelectList)
                    {
                        var    companyObj  = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)(item.ObjectInstance);
                        string companyid   = companyObj.COMPANYID;
                        string companyName = companyObj.CNAME;
                        FLOW_MODELDEFINE_FREEFLOW entity = new FLOW_MODELDEFINE_FREEFLOW();
                        entity.MODELDEFINEFREEFLOWID = Guid.NewGuid().ToString().Replace("-", "");;
                        entity.MODELCODE             = this.txtModelCode.Text;                                                             //模块代码
                        entity.COMPANYNAME           = companyName;                                                                        //允许[自选流程]的公司名称
                        entity.COMPANYID             = companyid;                                                                          //允许[自选流程]的公司D
                        entity.CREATEUSERID          = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;                // Utility.CurrentUser.EMPLOYEEID;//创建人ID
                        entity.CREATEUSERNAME        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;              // Utility.CurrentUser.USERNAME;//创建人名
                        entity.CREATECOMPANYID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;    // Utility.CurrentUser.OWNERCOMPANYID;//创建公司ID
                        entity.CREATEDEPARTMENTID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //  Utility.CurrentUser.OWNERDEPARTMENTID;//创建部门ID
                        entity.CREATEPOSTID          = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;       //  Utility.CurrentUser.OWNERPOSTID;//创建岗位ID
                        entity.CREATEDATE            = DateTime.Now;                                                                       //创建时间
                        var company = from ee in FreeFlowCompanyList
                                      where ee.COMPANYID == companyid
                                      select ee;
                        if (company.FirstOrDefault() == null)
                        {
                            FreeFlowCompanyList.Add(entity);
                        }
                    }
                    dgCompany2.ItemsSource = FreeFlowCompanyList;
                }
            };
            up.Show();
            #region
            //object objs = null;
            //if (Application.Current.Resources["CurrentUserID"] != null)
            //{
            //    objs = Application.Current.Resources["CurrentUserID"];
            //    Application.Current.Resources.Remove("CurrentUserID");
            //    Application.Current.Resources.Add("CurrentUserID", "");
            //}
            //if (Application.Current.Resources["CurrentUserID"] == null)
            //{
            //    Application.Current.Resources.Add("CurrentUserID", "");
            //}
            //SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup lookup = new SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup(Utility.CurrentUser.EMPLOYEEID, "3", "");
            //lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
            //lookup.MultiSelected = true;
            //lookup.SelectedClick += (obj, ev) =>
            //{
            //    if (lookup.SelectedObj != null)
            //    {
            //        foreach (var item in lookup.SelectedObj)
            //        {
            //            var companyObj = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)(item.ObjectInstance);
            //            string companyid = companyObj.COMPANYID;
            //            string companyName = companyObj.CNAME;
            //            FLOW_MODELDEFINE_FREEFLOW entity = new FLOW_MODELDEFINE_FREEFLOW();
            //            entity.MODELDEFINEFREEFLOWID = Guid.NewGuid().ToString().Replace("-", ""); ;
            //            entity.MODELCODE = this.txtModelCode.Text;//模块代码
            //            entity.COMPANYNAME = companyName;//允许[自选流程]的公司名称
            //            entity.COMPANYID = companyid;//允许[自选流程]的公司D
            //            entity.CREATEUSERID = Utility.CurrentUser.OWNERID;//创建人ID
            //            entity.CREATEUSERNAME = Utility.CurrentUser.USERNAME;//创建人名
            //            entity.CREATECOMPANYID = Utility.CurrentUser.OWNERCOMPANYID;//创建公司ID
            //            entity.CREATEDEPARTMENTID = Utility.CurrentUser.OWNERDEPARTMENTID;//创建部门ID
            //            entity.CREATEPOSTID = Utility.CurrentUser.OWNERPOSTID;//创建岗位ID
            //            entity.CREATEDATE = DateTime.Now;//创建时间
            //            FreeFlowCompanyList.Add(entity);

            //            Application.Current.Resources.Remove("CurrentUserID");
            //            if (objs != null)
            //            {
            //                Application.Current.Resources.Add("CurrentUserID", objs);
            //            }
            //        }
            //        dgCompany2.ItemsSource = FreeFlowCompanyList;
            //    }
            //};
            //lookup.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });


            #endregion
        }