예제 #1
0
 private void txtTARGETCITIES_SelectClick(object sender, EventArgs e)
 {
     SearchCity txt = (SearchCity)sender;
     AreaSortCity SelectCity = new AreaSortCity();
     int SelectIndex = 0;
     if (DaGrEdit.SelectedItem != null)
     {
         SelectIndex = DaGrEdit.SelectedIndex;//选择的行数,选择的行数也就是目的城市的位置,从0开始算起  
     }
     else
     {
         return;
     }
     SelectCity.SelectedClicked += (obj, ea) =>
     {
         txt.TxtSelectedCity.Text = SelectCity.Result.Keys.FirstOrDefault();
         
             if (DaGrEdit.Columns[3].GetCellContent(DaGrEdit.SelectedItem) != null)
             {
                 T_OA_REIMBURSEMENTDETAIL detailEntity = TravelDetailList_Golbal[SelectIndex];
                 SearchCity myCitys = DaGrEdit.Columns[3].GetCellContent(DaGrEdit.SelectedItem).FindName("txtTARGETCITIES") as SearchCity;
                 SearchCity mystartCity = DaGrEdit.Columns[1].GetCellContent(DaGrEdit.SelectedItem).FindName("txtDEPARTURECITY") as SearchCity;
                 //如果出发城市为空
                 if (string.IsNullOrEmpty(detailEntity.DEPCITY))
                 {
                     txt.TxtSelectedCity.Text = string.Empty;
                     ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("请先选择出发城市"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                     return;
                 }
                 if (TravelDetailList_Golbal.Count > 1)//如果是非当天往返,判断出发城市目标城市是否相同
                 {
                     if (detailEntity.DEPCITY.Trim() == SelectCity.Result.Keys.FirstOrDefault().ToString())
                     {
                         myCitys.TxtSelectedCity.Text = string.Empty;
                         ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("出发城市和目标城市不能相同"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                         return;
                     }
                 }
                 //如果选择的是中间的记录,赋值并修改下一行记录的出发城市
                 if (SelectIndex >= 0 && SelectIndex < TravelDetailList_Golbal.Count-1)//selectIndex从1开始
                 {
                     //修改本行到达城市
                     TravelDetailList_Golbal[SelectIndex].DESTCITY = SelectCity.Result.Values.FirstOrDefault().ToString();
                     //修改下一行的出发城市
                     TravelDetailList_Golbal[SelectIndex+1].DEPCITY = SelectCity.Result.Values.FirstOrDefault().ToString();
                     SearchCity mystarteachCity = DaGrEdit.Columns[1].GetCellContent(TravelDetailList_Golbal[SelectIndex + 1]).FindName("txtDEPARTURECITY") as SearchCity;
                     mystarteachCity.TxtSelectedCity.Text = GetCityName(TravelDetailList_Golbal[SelectIndex + 1].DEPCITY);
                 }
                 if (TravelDetailList_Golbal.Count == (SelectIndex + 1))//选择的是最后一行的结束城市
                 {
                     TravelDetailList_Golbal[SelectIndex].DESTCITY=SelectCity.Result.Values.FirstOrDefault().ToString();
                    
                 }
             }
         StandardsMethod(SelectIndex);//显示选中的城市的出差标准
         //计算并给实体赋值
         SetTraveValueAndFBChargeValue();
         DaGrEdit.ItemsSource = TravelDetailList_Golbal;
     };
     var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("CITY"), "", "123", SelectCity, false, false, null);
     if (SelectCity is AreaSortCity)
     {
         (SelectCity as AreaSortCity).Close += (o, args) =>
         {
             windows.Close();
         };
     }
     SelectCity.GetSelectedCities.Visibility = Visibility.Collapsed;//隐藏已选中城市的Border
 }
예제 #2
0
        /// <summary>
        /// 到达城市lookup
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtTARGETCITIES_SelectClick(object sender, EventArgs e)
        {
            SearchCity serchCitySender = (SearchCity)sender;
            AreaSortCity SelectCity = new AreaSortCity();
            int SelectIndex = 0;
            if (DaGrs.SelectedItem != null)
            {
                SelectIndex = DaGrs.SelectedIndex;//选择的行数,选择的行数也就是目的城市的位置,从0开始算起  
            }
            else
            {
                return;
            }
            SelectCity.SelectedClicked += (obj, ea) =>
            {
                string selectCityName = SelectCity.Result.Keys.FirstOrDefault();
                string selectCityValue = SelectCity.Result[SelectCity.Result.Keys.FirstOrDefault()].ToString();
                selectCityValue = selectCityValue.Replace(',', ' ').Trim();

                try
                {
                    int selectGridRowIndex = DaGrs.SelectedIndex;

                    if (TraveDetailList_Golbal.Count>1)//如果不是只有一条记录,且出发城市跟选择的结束城市一致,返回。
                    {
                        if (TraveDetailList_Golbal[selectGridRowIndex].DEPCITY == selectCityValue)
                        {
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("出发城市和目标城市不能相同"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            return;
                        }
                    }
                    //设置当前出差明细的到达城市
                    TraveDetailList_Golbal[selectGridRowIndex].DESTCITY = selectCityValue;
                    serchCitySender.TxtSelectedCity.Text = selectCityName;
                    //设置下一行的起始城市 如果为最后一行数据,且grid有下一行,增加下一行
                    if (selectGridRowIndex<TraveDetailList_Golbal.Count-1 )//非最后一条明细
                    {
                        TraveDetailList_Golbal[selectGridRowIndex+1].DEPCITY = selectCityValue;//下一条记录出发城市
                        SetNextDepartureCity(selectGridRowIndex);
                    }
                    StandardsMethod(SelectIndex);//显示选中的城市的出差标准
                }
                catch (Exception ex)
                {
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("系统错误,请联系管理员:" + ex.ToString());
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                }
            };
            var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("CITY"), "", "123", SelectCity, false, false, null);
            if (SelectCity is AreaSortCity)
            {
                (SelectCity as AreaSortCity).Close += (o, args) =>
                {
                    windows.Close();
                };
            }
            SelectCity.GetSelectedCities.Visibility = Visibility.Collapsed;//隐藏已选中城市的Border
        }
예제 #3
0
        private void txtDEPARTURECITY_SelectClick(object sender, EventArgs e)
        {
            SearchCity txt = (SearchCity)sender;
            AreaSortCity SelectCity = new AreaSortCity();
            int SelectIndex = 0;
            if (DaGrEdit.SelectedItem != null)
            {
                SelectIndex = DaGrEdit.SelectedIndex;//选择的行数,选择的行数也就是出发城市的位置,从0开始算起  
            }
            else
            {
                return;
            }
            SelectCity.SelectedClicked += (obj, ea) =>
            {
                txt.TxtSelectedCity.Text = SelectCity.Result.Keys.FirstOrDefault();
                if (DaGrEdit.SelectedItem != null)
                {
                    if (DaGrEdit.Columns[1].GetCellContent(DaGrEdit.SelectedItem) != null)
                    {
                        T_OA_REIMBURSEMENTDETAIL Detail = DaGrEdit.SelectedItem as T_OA_REIMBURSEMENTDETAIL;
                        SearchCity myCitys = DaGrEdit.Columns[1].GetCellContent(DaGrEdit.SelectedItem).FindName("txtDEPARTURECITY") as SearchCity;//出发城市
                        SearchCity mystartCity = DaGrEdit.Columns[3].GetCellContent(DaGrEdit.SelectedItem).FindName("txtTARGETCITIES") as SearchCity;//目标城市

                        if (TravelDetailList_Golbal.Count > 1)
                        {
                            if (SelectCity.Result.Keys.FirstOrDefault().Trim() == TravelDetailList_Golbal[SelectIndex].DESTCITY.Trim())
                            {
                                myCitys.TxtSelectedCity.Text = string.Empty;
                                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("出发城市和目标城市不能相同"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                                return;
                            }
                        }
                        //赋值
                        TravelDetailList_Golbal[SelectIndex].DEPCITY = SelectCity.Result.Values.FirstOrDefault().Trim();

                    }
                }
                StandardsMethod(SelectIndex);//显示选中的城市的出差标准
                //计算并给实体赋值
                SetTraveValueAndFBChargeValue();
            };
            var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("CITY"), "", "123", SelectCity, false, false, null);
            if (SelectCity is AreaSortCity)
            {
                (SelectCity as AreaSortCity).Close += (o, args) =>
                {
                    windows.Close();
                };
            }
            SelectCity.GetSelectedCities.Visibility = Visibility.Collapsed;//隐藏已选中城市的Border
        }
예제 #4
0
        private void scSearchCity_SelectClick(object sender, EventArgs e)
        {
            SearchCity txt = (SearchCity)sender;
            AreaSortCity SelectCity;
            if (hasSaved)
            {
                ExistedCode = citycode; //获取旧的城市代码
                hasSaved = false;
            }
            if (!string.IsNullOrEmpty(citycode))
                SelectCity = new AreaSortCity(citycode);
            else
                SelectCity = new AreaSortCity();

            SelectCity.SelectMulti = true;
            
            SelectCity.SelectedClicked += (obj, ea) =>
            {
                txt.TxtSelectedCity.Text = SelectCity.Result.Keys.FirstOrDefault();
                citycode = SelectCity.Result[SelectCity.Result.Keys.FirstOrDefault()].ToString();
                if (string.IsNullOrEmpty(citycode))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("SELECTEDCITY"));
                }
                //if (citycode.Split(',').Count() > 2)
                //{
                //    txt.TxtSelectedCity.Text = "";
                //    citycode = "";
                //    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("CANONLYCHOOSEONE", "DEPARTURECITY"));
                //    return;
                //}
                //if (txt.Name == "txtDEPARTURECITY")
                //{
                //    buipList[DaGrs.SelectedIndex].DEPCITY = citycode;
                //}
                //foreach (Object obje in DaGrs.ItemsSource)//判断所选的出发城市是否与目标城市相同
                //{
                //    SearchCity City = ((SearchCity)((StackPanel)DaGrs.Columns[3].GetCellContent(obje)).Children.FirstOrDefault()) as SearchCity;
                //    if (City != null)
                //    {
                //        if (txt.TxtSelectedCity.Text == City.TxtSelectedCity.Text)
                //        {
                //            txt.TxtSelectedCity.Text = "";
                //            citycode = "";
                //            Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("NOTTHESAMEASTHETARGECITY", "DEPARTURECITY"));
                //            return;
                //        }
                //    }
                //}
            };
            var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("CITY"), "", "123", SelectCity, false, false, null);
            if (SelectCity is AreaSortCity)
            {
                (SelectCity as AreaSortCity).Close += (o, args) =>
                {
                    windows.Close();
                };
            }
        }