Beispiel #1
0
        private bool GetFilter(ref string filter, ref ObservableCollection <object> paras, out int iYear, out int iMonthStart, out int iMonthEnd)
        {
            int.TryParse(nudYear.Value.ToString(), out iYear);
            int.TryParse(nudMonthStart.Value.ToString(), out iMonthStart);
            int.TryParse(nudMonthEnd.Value.ToString(), out iMonthEnd);

            OrgSelectEntity ose = lkOrg.DataContext as OrgSelectEntity;

            if (ose == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("WARNING"), "请选择机构后再进行查询");
                return(false);
            }
            else if (ose.IsMultipleType)
            {
                Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("WARNING"), "请选择相同类型的机构,如全是公司或全是人员");
                return(false);
            }
            else if (iMonthStart > iMonthEnd)
            {
                Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("WARNING"), "请输入正确的起止月份!");
                return(false);
            }


            ose.GetSqlValue(ref filter, ref paras);
            if (!string.IsNullOrWhiteSpace(strSearchSubjects))
            {
                GetSearchConditionBySubjectID(ref filter, ref paras);
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 选择预算科目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lkSubject_FindClick(object sender, EventArgs e)
        {
            string filter = string.Empty;
            ObservableCollection <object> paras = new ObservableCollection <object>();
            string          strOrgType          = string.Empty;
            string          strOrgID            = string.Empty;
            OrgSelectEntity ose = lkOrg.DataContext as OrgSelectEntity;

            if (ose == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("WARNING"), "请选择机构后再进行查询");
                return;
            }
            else if (ose.IsMultipleType)
            {
                Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("WARNING"), "请选择相同类型的机构,如全是公司或全是人员");
                return;
            }

            ose.GetSqlValue(ref filter, ref paras);
            var intOrgType = (int)ose.SelectedOrgType;


            Dictionary <string, string> cols = new Dictionary <string, string>();

            cols.Add("SUBJECTCODE", "SUBJECTCODE");
            cols.Add("SUBJECTNAME", "SUBJECTNAME");


            if (intOrgType == 3)
            {
                paras.Clear();
                List <string> filters = new List <string>();
                foreach (var item in ose.SelectedValue)
                {
                    var entEmp = item.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;
                    var temp   = string.Format("(OWNERPOSTID=@{0})", paras.Count);
                    paras.Add(entEmp.OWNERPOSTID);
                    filters.Add(temp);
                }
                filter = "( " + string.Join(" or ", filters) + " )";
            }

            LookupForm lookup = new LookupForm(FBAEnumsBLLPrefixNames.Execution,
                                               typeof(T_FB_SUBJECT[]), cols, "T_FB_BUDGETCHECK", filter, paras);

            lookup.SelectedClick += (o, ev) =>
            {
                if (lookup.SelectedObj == null)
                {
                    return;
                }

                ObservableCollection <object> entList = lookup.SelectedObj as ObservableCollection <object>;

                StringBuilder strIDlist   = new StringBuilder();
                StringBuilder strNamelist = new StringBuilder();

                foreach (var obj in entList)
                {
                    T_FB_SUBJECT ent = obj as T_FB_SUBJECT;

                    strIDlist.Append(ent.SUBJECTID + ";");
                    strNamelist.Append(ent.SUBJECTNAME + ";");
                }

                strSearchSubjects        = strIDlist.ToString();
                lkSubject.TxtLookUp.Text = strNamelist.ToString();
            };

            lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
        }