Example #1
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();
                };
            }
        }
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")
                {
                    StandardList[DGVechileStandard.SelectedIndex].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();
                };
            }
        }