Example #1
0
        private void DgVechileStandard_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            if (DGVechileStandard.ItemsSource != null)
            {
                T_OA_TAKETHESTANDARDTRANSPORT Standard   = (T_OA_TAKETHESTANDARDTRANSPORT)e.Row.DataContext;
                TravelDictionaryComboBox      ComVechile = DGVechileStandard.Columns[1].GetCellContent(e.Row).FindName("ComVechileType") as TravelDictionaryComboBox;
                TravelDictionaryComboBox      ComLevel   = DGVechileStandard.Columns[2].GetCellContent(e.Row).FindName("ComVechileTypeLeve") as TravelDictionaryComboBox;
                SelectPost EndComPost = DGVechileStandard.Columns[3].GetCellContent(e.Row).FindName("txtSelectPost") as SelectPost;


                DGVechileStandard.SelectedItem = e.Row;
                string dictid = "";
                if (ComVechile != null)
                {
                    foreach (T_SYS_DICTIONARY Region in ComVechile.Items)
                    {
                        if (Region.DICTIONARYVALUE.ToString() == Standard.TYPEOFTRAVELTOOLS)
                        {
                            ComVechile.SelectedItem = Region;
                            dictid = Region.DICTIONARYID;
                            break;
                        }
                    }
                }
                if (ComVechile.SelectedIndex < 0)
                {
                    ComVechile.SelectedIndex = 0;
                }
                if (ComLevel != null)
                {
                    var ents = from ent in ListVechileLevel
                               where ent.T_SYS_DICTIONARY2.DICTIONARYID == dictid
                               select ent;
                    if (ents.Count() > 0)
                    {
                        ComLevel.ItemsSource = ents.ToList();//根据类型绑定级别
                        foreach (T_SYS_DICTIONARY Region in ents)
                        {
                            if (Region.DICTIONARYVALUE.ToString() == Standard.TAKETHETOOLLEVEL)
                            {
                                ComLevel.SelectedItem = Region;
                                break;
                            }
                        }
                    }
                }
                if (ComLevel.SelectedIndex < 0)
                {
                    ComLevel.SelectedIndex = 0;
                }

                if (!string.IsNullOrEmpty(Standard.ENDPOSTLEVEL))
                {
                    //将  岗位值转换为对应的名称
                    //string PostCode = EndComPost.TxtSelectedPost.Text;
                    string   PostCode = "";
                    string[] arrstr   = Standard.ENDPOSTLEVEL.Split(',');
                    foreach (var d in arrstr)
                    {
                        int i    = d.ToInt32();
                        var ents = from n in ListPost
                                   where n.DICTIONARYVALUE == i
                                   select n;
                        if (ents.Count() > 0)
                        {
                            PostCode += ents.FirstOrDefault().DICTIONARYNAME.ToString() + ",";
                        }
                    }
                    if (!(string.IsNullOrEmpty(PostCode)))
                    {
                        PostCode = PostCode.Substring(0, PostCode.Length - 1);
                    }
                    EndComPost.TxtSelectedPost.Text = PostCode;
                }
                //}
            }
        }
Example #2
0
        private void txtSelectPost_SelectClick(object sender, EventArgs e)
        {
            SelectPost txt    = (SelectPost)sender;
            string     StrOld = txt.TxtSelectedPost.Text.ToString();

            PostList SelectCity = new PostList(StrOld, AAA);
            string   citycode   = "";

            SelectCity.SelectedClicked += (obj, ea) =>
            {
                AAA = "";
                string StrPost = SelectCity.Result.Keys.FirstOrDefault();
                if (!string.IsNullOrEmpty(StrPost))
                {
                    txt.TxtSelectedPost.Text = StrPost.Substring(0, StrPost.Length - 1);
                }
                citycode = SelectCity.Result[SelectCity.Result.Keys.FirstOrDefault()].ToString();


                if (!string.IsNullOrEmpty(citycode))
                {
                    citycode = citycode.Substring(0, citycode.Length - 1);
                }

                if (txt.Name == "txtSelectPost")
                {
                    //控件返回值有问题,这里暂时不修改,直接通过文本获取值

                    if (!string.IsNullOrEmpty(txt.TxtSelectedPost.Text))
                    {
                        //添加到数据库中的为数字
                        string   PostCode  = txt.TxtSelectedPost.Text;
                        string   PostValue = "";
                        string[] arrstr    = PostCode.Split(',');
                        foreach (var d in arrstr)
                        {
                            var ents = from en in ListPost
                                       where en.DICTIONARYNAME == d
                                       select en;
                            if (ents.Count() > 0)
                            {
                                PostValue += ents.FirstOrDefault().DICTIONARYVALUE.ToString() + ",";
                            }
                        }
                        if (!(string.IsNullOrEmpty(PostValue)))
                        {
                            PostValue = PostValue.Substring(0, PostValue.Length - 1);
                            StandardList[DGVechileStandard.SelectedIndex].ENDPOSTLEVEL = PostValue;
                        }
                    }
                    //tempDetail.ENDPOSTLEVEL = citycode;
                    AAA = citycode;
                }
            };
            var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("CITY"), "", "123", SelectCity, false, false, null);

            if (SelectCity is PostList)
            {
                (SelectCity as PostList).Close += (o, args) =>
                {
                    windows.Close();
                };
            }
        }