Example #1
0
 public IActionResult SearchCity(SearchCity model)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("GetCity", "WeatherAPI", new { city = model.CityName }));
     }
     return(View(model));
 }
Example #2
0
 public void Request(SearchCity searchCity)
 {
     if (IsAutorized && searchCity.Period == 1)
     {
         ctx.Users.AddRequestFromUser(Id, searchCity.Name);
         ctx.Complete();
     }
 }
Example #3
0
 public IActionResult SearchCity(SearchCity model)
 {
     // If the model is valid, consume the Weather API to bring the data of the city
     if (ModelState.IsValid)
     {
         return(RedirectToAction("City", "ForecastApp", new { city = model.CityName }));
     }
     return(View(model));
 }
        public IActionResult SearchCity(SearchCity model)
        {
            if (ModelState.IsValid)
            {
                return(RedirectToAction("City", "ForecastApp", new { city = model.CityName }));
            }

            return(View(model));
        }
        public async System.Threading.Tasks.Task <IHttpActionResult> Get([FromUri] SearchCity request)
        {
            if (request.Period > 17)
            {
                request.Period = 17;
            }
            Forecast forecast = await forecastService.GetJsonFromUrl(request);

            return(Json(forecast));
        }
Example #6
0
 public IActionResult SearchCity(SearchCity model)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Index", "Home", new { city = model.CityName }));
     }
     else
     {
         return(View(model));
     }
 }
        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
        }
Example #8
0
        private bool CheckIsFinishedCitys()
        {
            bool   IsResult     = true;
            string StrStartDt   = "";
            string EndDt        = "";
            string StrStartTime = "";
            string StrEndTime   = "";

            foreach (object obje in DaGrEdit.ItemsSource)
            {
                TrDetail = new T_OA_REIMBURSEMENTDETAIL();
                SearchCity myCitys = DaGrEdit.Columns[3].GetCellContent(obje).FindName("txtTARGETCITIES") as SearchCity;

                TrDetail.T_OA_TRAVELREIMBURSEMENT = TravelReimbursement_Golbal;
                DateTimePicker StartDate = DaGrEdit.Columns[0].GetCellContent(obje).FindName("StartTime") as DateTimePicker;
                DateTimePicker EndDate   = DaGrEdit.Columns[2].GetCellContent(obje).FindName("EndTime") as DateTimePicker;

                TravelDictionaryComboBox ToolType  = ((TravelDictionaryComboBox)((StackPanel)DaGrEdit.Columns[6].GetCellContent(obje)).Children.FirstOrDefault()) as TravelDictionaryComboBox;
                TravelDictionaryComboBox ToolLevel = ((TravelDictionaryComboBox)((StackPanel)DaGrEdit.Columns[7].GetCellContent(obje)).Children.FirstOrDefault()) as TravelDictionaryComboBox;

                StrStartDt   = StartDate.Value.Value.ToString("d");                         //开始日期
                EndDt        = EndDate.Value.Value.ToString("d");                           //结束日期
                StrStartTime = StartDate.Value.Value.ToString("HH:mm");                     //开始时间
                StrEndTime   = EndDate.Value.Value.ToString("HH:mm");                       //结束时间

                if (string.IsNullOrEmpty(StrStartDt) || string.IsNullOrEmpty(StrStartTime)) //开始日期不能为空
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "开始时间的年月日或时分不能为空", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    IsResult = false;
                }

                if (string.IsNullOrEmpty(EndDt) || string.IsNullOrEmpty(StrEndTime))//结束日期不能为空
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "结束时间的年月日或时分不能为空", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    IsResult = false;
                }
                DateTime DtStart = System.Convert.ToDateTime(StrStartDt + " " + StrStartTime);
                DateTime DtEnd   = System.Convert.ToDateTime(EndDt + " " + StrEndTime);
                if (DtStart >= DtEnd)
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "开始时间不能大于等于结束时间", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    IsResult = false;
                }


                if (ToolType.SelectedIndex <= 0)//交通工具类型
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "TYPEOFTRAVELTOOLS"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    IsResult = false;
                }
            }
            return(IsResult);
        }
Example #9
0
        public NewCustomerUC(searchCustomerTypeEnum displayType)
        {
            InitializeComponent();

            viewModel = new NewCustomer_ViewModel(displayType);
            DataContext = viewModel;

            viewModel.CityRequested += (s, a) =>
            {
                cityChooserWindow = new SearchCity();
                cityChooserVM = cityChooserWindow.DataContext as SearchCity_ViewModel;
                cityChooserVM.citySelected += (so, ar) =>
                {
                    viewModel.newCustomer.city = (CityRepresentation)so;
                    cityChooserWindow.Close();
                };
                cityChooserWindow.Show();
            };
        }
        public async System.Threading.Tasks.Task <ActionResult> Index(SearchCity searchCity)
        {
            ViewBag.Search = true;
            Forecast forecast = await forecastService.GetJsonFromUrl(searchCity);

            if (forecast == null)
            {
                return(View("~/Views/Home/NotFoundCity.cshtml", new Forecast()
                {
                    City = new Models.City()
                    {
                        Name = searchCity.Name
                    }, Cnt = 1
                }));
            }
            forecast.Period = searchCity.Period;
            userAccount.Request(searchCity);
            return(View(forecast));
        }
Example #11
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (DaGrEdit.SelectedItems == null)
            {
                return;
            }

            if (DaGrEdit.SelectedItems.Count == 0)
            {
                return;
            }

            TravelDetailList_Golbal = DaGrEdit.ItemsSource as ObservableCollection <T_OA_REIMBURSEMENTDETAIL>;
            if (TravelDetailList_Golbal.Count() > 1)
            {
                int index  = DaGrEdit.SelectedIndex;                        //当前选中行
                var entity = TravelDetailList_Golbal[index];                //当前选择实体
                if (index > 0 && index < TravelDetailList_Golbal.Count - 1) //选择的不是第一条也不是最后一条
                {
                    //下一城市出发城市改为上一城市的到达城市值
                    TravelDetailList_Golbal[index + 1].DEPCITY = TravelDetailList_Golbal[index - 1].DESTCITY;
                    SearchCity mystarteachCity = DaGrEdit.Columns[1].GetCellContent(TravelDetailList_Golbal[index + 1]).FindName("txtDEPARTURECITY") as SearchCity;
                    mystarteachCity.TxtSelectedCity.Text = GetCityName(TravelDetailList_Golbal[index + 1].DEPCITY);
                }

                TravelDetailList_Golbal.Remove(entity);

                //DaGrEdit.ItemsSource = TravelDetailList_Golbal;
            }
            else
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "必须保留一条出差时间及地点!", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                return;
            }
            StandardsMethod(0);//显示选中的城市的出差标准
            //计算并给实体赋值
            SetTraveValueAndFBChargeValue();
            DisAbleLastTxtASubsidies();
        }
Example #12
0
        public async System.Threading.Tasks.Task <Forecast> GetJsonFromUrl(SearchCity city)
        {
            var json = "";

            using (var httpClient = new HttpClient())
            {
                try
                {
                    _logger.Log(LogLevel.Info, "Getting JSON for " + city.Name + "...");
                    string apiKey = WebConfigurationManager.AppSettings["ApiKey"];
                    var    url    = string.Empty;
                    url  = String.Format(WebConfigurationManager.AppSettings["ForecastWeatherUrl"], city.Name, city.Period, apiKey);
                    json = await httpClient.GetStringAsync(url);

                    _logger.Log(LogLevel.Success, "Received JSON data for " + city.Name + ".");
                }
                catch (Exception e)
                {
                    _logger.Log(LogLevel.Error, "Can't get JSON for " + city.Name + ". " + e.Message);
                    return(null);
                }
            }
            Forecast forecast;

            try
            {
                _logger.Log(LogLevel.Info, "Deserializing JSON for " + city.Name + "...");
                forecast = JsonConvert.DeserializeObject <Forecast>(json);
            }
            catch (Exception e)
            {
                _logger.Log(LogLevel.Error, "Can't deserialize JSON. " + e.Message);
                forecast = null;
            }
            return(forecast);
        }
Example #13
0
        // GET: ForecastApp/SearchCity . Apenas monta a UI pro user digitar a cidade
        public IActionResult SearchCity()
        {
            var viewModel = new SearchCity();

            return(View(viewModel));
        }
Example #14
0
        void btnNew_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckIsFinishedCitys())
            {
                return;
            }

            BtnNewButton = true;
            int i = 0;
            T_OA_REIMBURSEMENTDETAIL NewDetail = new T_OA_REIMBURSEMENTDETAIL();

            NewDetail.REIMBURSEMENTDETAILID = Guid.NewGuid().ToString();

            if (formType != FormTypes.New)
            {
                if (TravelDetailList_Golbal.Count() > 0)
                {
                    if (TravelDetailList_Golbal.LastOrDefault().DESTCITY == TravelDetailList_Golbal.FirstOrDefault().DEPCITY)
                    {
                        MessageBox.Show("请修改最后一条记录的到达城市后再新增记录!");
                        return;
                    }
                    //将原有记录的最后一条记录的目的城市作为出发城市。
                    //NewDetail.DEPCITY = SMT.SaaS.FrameworkUI.Common.Utility.GetCityName(TrList.LastOrDefault<T_OA_REIMBURSEMENTDETAIL>().DESTCITY);
                    if (TravelDetailList_Golbal.LastOrDefault <T_OA_REIMBURSEMENTDETAIL>() != null)
                    {
                        //默认出发城市为上一条记录的到达城市
                        NewDetail.DEPCITY = TravelDetailList_Golbal.LastOrDefault <T_OA_REIMBURSEMENTDETAIL>().DESTCITY;
                        //默认出发日期为上一条记录的结束时间+1天
                        NewDetail.STARTDATE = TravelDetailList_Golbal.LastOrDefault <T_OA_REIMBURSEMENTDETAIL>().ENDDATE.Value.AddDays(1);
                        //默认结束城市为出差出发城市
                        NewDetail.DESTCITY = TravelDetailList_Golbal.FirstOrDefault <T_OA_REIMBURSEMENTDETAIL>().DEPCITY;
                        //默认结束日期为出发时间+1
                        NewDetail.ENDDATE = NewDetail.STARTDATE.Value.AddDays(1);
                    }
                }
                NewDetail.TYPEOFTRAVELTOOLS = "3"; //默认乘坐交通工具为火车
                NewDetail.TAKETHETOOLLEVEL  = "1"; //默认交通工具级别为硬卧
                //NewDetail.ENDDATE = DateTime.Now;
                TravelDetailList_Golbal.Add(NewDetail);
                //禁用所有开始城市选择控件?
                foreach (Object obje in DaGrEdit.ItemsSource)
                {
                    if (DaGrEdit.Columns[1].GetCellContent(obje) != null)
                    {
                        SearchCity myCity = DaGrEdit.Columns[1].GetCellContent(obje).FindName("txtDEPARTURECITY") as SearchCity;

                        if (myCity != null)
                        {
                            myCity.IsEnabled = false;
                            ((DataGridCell)((StackPanel)myCity.Parent).Parent).IsEnabled = false;
                        }
                    }
                }
            }

            int lastIndex = TravelDetailList_Golbal.Count() - 1;

            StandardsMethod(lastIndex);//显示选中的城市的出差标准
            //计算并给实体赋值
            SetTraveValueAndFBChargeValue();
            DisAbleLastTxtASubsidies();
        }
        public ActionResult FilterForm()
        {
            SearchCity city = new SearchCity();

            return(PartialView(city));
        }
        private bool Check()
        {
            string StrStartDt   = string.Empty;
            string EndDt        = string.Empty;
            string StrStartTime = string.Empty;
            string StrEndTime   = string.Empty;
            bool   checkPrivate = false;
            bool   checkMeet    = false;
            ObservableCollection <T_OA_REIMBURSEMENTDETAIL> TripDetails = DaGrEdit.ItemsSource as ObservableCollection <T_OA_REIMBURSEMENTDETAIL>;

            #region 出差时间验证


            foreach (object obje in DaGrEdit.ItemsSource)
            {
                SearchCity     myCitys    = DaGrEdit.Columns[3].GetCellContent(obje).FindName("txtTARGETCITIES") as SearchCity;
                DateTimePicker StartDate  = DaGrEdit.Columns[0].GetCellContent(obje).FindName("StartTime") as DateTimePicker;
                DateTimePicker EndDate    = DaGrEdit.Columns[2].GetCellContent(obje).FindName("EndTime") as DateTimePicker;
                CheckBox       chbPrivate = DaGrEdit.Columns[13].GetCellContent(obje).FindName("myChkBox") as CheckBox;
                CheckBox       chbMeet    = DaGrEdit.Columns[14].GetCellContent(obje).FindName("myChkBoxMeet") as CheckBox;

                if (chbPrivate.IsChecked == true)
                {
                    checkPrivate = true;
                }
                if (chbMeet.IsChecked == true)
                {
                    checkMeet = true;
                }

                if (StartDate.Value != null)
                {
                    StrStartDt = StartDate.Value.Value.ToString("d");//开始日期
                }
                if (EndDate.Value != null)
                {
                    EndDt = EndDate.Value.Value.ToString("d");//结束日期
                }
                if (StartDate.Value != null)
                {
                    StrStartTime = StartDate.Value.Value.ToString("HH:mm");//开始时间
                }
                if (EndDate.Value != null)
                {
                    StrEndTime = EndDate.Value.Value.ToString("HH:mm");                     //结束时间
                }
                if (string.IsNullOrEmpty(StrStartDt) || string.IsNullOrEmpty(StrStartTime)) //开始日期不能为空
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出发时间的年月日或时分不能为空", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }

                if (string.IsNullOrEmpty(EndDt) || string.IsNullOrEmpty(StrEndTime))//结束日期不能为空
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "到达时间的年月日或时分不能为空", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }
                DateTime DtStart = System.Convert.ToDateTime(StrStartDt + " " + StrStartTime);
                DateTime DtEnd   = System.Convert.ToDateTime(EndDt + " " + StrEndTime);
                if (DtStart >= DtEnd)
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出发时间不能大于等于到达时间", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }

                DateTimePicker dpStartTime = DaGrEdit.Columns[0].GetCellContent(obje).FindName("StartTime") as DateTimePicker;
                DateTimePicker dpEndTime   = DaGrEdit.Columns[2].GetCellContent(obje).FindName("EndTime") as DateTimePicker;
                if (dpStartTime.Value != null)
                {
                    TimeSpan tsStart = new TimeSpan(dpStartTime.Value.Value.Hour);
                    if (tsStart == null)//开始时间不能为空
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "STARTDATETIME"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }
                    if (dpStartTime.Value.Value.Date == null)//开始日期不能为空
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "STARTDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }

                    if (dpEndTime.Value != null)
                    {
                        TimeSpan tsEnd = new TimeSpan(dpEndTime.Value.Value.Hour);
                        if (tsEnd == null)//结束时间不能为空
                        {
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "ENDDATETIME"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            return(false);
                        }
                        if (dpEndTime.Value.Value.Date == null)//结束日期不能为空
                        {
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "ENDDATETITLE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            return(false);
                        }
                        if (dpStartTime.Value >= dpEndTime.Value)
                        {
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("ERRORSTARTDATEGTENDDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            return(false);
                        }
                    }
                    else
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "ENDDATETIME"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }
                }
                else
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "STARTDATETIME"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }

                //T_OA_REIMBURSEMENTDETAIL entDetail = obje as T_OA_REIMBURSEMENTDETAIL;

                //var queryData = from c in TripDetails
                //                where c.STARTDATE > dpStartTime.Value && c.ENDDATE > dpEndTime.Value && c.REIMBURSEMENTDETAILID != entDetail.REIMBURSEMENTDETAILID
                //                orderby c.STARTDATE
                //                select c;

                //if (queryData.Count() > 0)
                //{
                //    if (queryData.FirstOrDefault().STARTDATE < entDetail.ENDDATE)
                //    {
                //        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("CANNOTBEREPEATEDTOADD", "KPIRECEIVEDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                //        return false;
                //    }
                //}


                TravelDictionaryComboBox ComVechile = ((TravelDictionaryComboBox)((StackPanel)DaGrEdit.Columns[6].GetCellContent(obje)).Children.FirstOrDefault()) as TravelDictionaryComboBox;
                if (ComVechile.SelectedIndex <= 0)//交通工具类型
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "TYPEOFTRAVELTOOLS"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }

                TravelDictionaryComboBox ComVechileLevel = ((TravelDictionaryComboBox)((StackPanel)DaGrEdit.Columns[7].GetCellContent(obje)).Children.FirstOrDefault()) as TravelDictionaryComboBox;
                if (ComVechileLevel.SelectedIndex < 0)//交通工具级别
                {
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "交通工具级别不能为空", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }
            }
            #region 判断出差明细开始时间
            for (int i = 0; i < TripDetails.Count; i++)
            {
                for (int j = i + 1; j < TripDetails.Count; j++)
                {
                    if (TripDetails[j].STARTDATE.Value <= TripDetails[i].ENDDATE.Value)
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("CANNOTBEREPEATEDTOADD", "KPIRECEIVEDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }
                }
            }
            #endregion
            #endregion

            #region "判断出差开始城市是否用重复,下一条开始时间是否小于上一条结束时间"
            for (int i = 0; i < TravelDetailList_Golbal.Count; i++)
            {
                if (TravelDetailList_Golbal.Count > 1)
                {
                    //如果不是第一条记录,判断结束时间是否大于上一条开始时间
                    if (i > 0)
                    {
                        if (TravelDetailList_Golbal[i].STARTDATE < TravelDetailList_Golbal[i - 1].ENDDATE)
                        {
                            //出发城市为空
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出差开始时间大于上一条出差记录的结束时间!", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            return(false);
                        }
                    }
                }
                if (string.IsNullOrEmpty(TravelDetailList_Golbal[i].DEPCITY) || string.IsNullOrEmpty(TravelDetailList_Golbal[i].DESTCITY))
                {
                    //出发城市为空
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出发或到达城市不能为空!", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }
                if (i > 0)
                {
                    if (TravelDetailList_Golbal[i].DEPCITY == TravelDetailList_Golbal[i].DESTCITY)
                    {
                        //出发城市与开始城市不能相同
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出发到达城市重复!", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }
                }
            }
            if (TravelDetailList_Golbal.Count > 1)
            {
                //如果上下两条出差记录城市一样
                string strStarCity = TravelDetailList_Golbal[0].DEPCITY;
                var    q           = from ent in TravelDetailList_Golbal
                                     where ent.DEPCITY == strStarCity
                                     select ent;
                if (q.Count() > 1)
                {
                    //出发城市与开始城市不能相同
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出差出发城市重复!", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }
            }
            #endregion

            #region 出差报销其他验证
            if (string.IsNullOrEmpty(this.txtReport.Text.Trim()))//报告内容
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("STRINGNOTNULL", "REPORT"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                this.txtRemark.Focus();
                return(false);
            }
            if (OpenFrom != "FromMVC")
            {
                if (fbCtr.FromFB == true)
                {
                    if (string.IsNullOrEmpty(txtPAYMENTINFO.Text))//支付信息
                    {
                        RefreshUI(RefreshedTypes.HideProgressBar);
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "支付信息不能为空,请重新填写", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                        return(false);
                    }
                }
            }
            if (string.IsNullOrEmpty(this.txtSubTotal.Text) && this.txtSubTotal.Text.Trim() != "0")
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "出差报销费用不可为零,请重新填写单据", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                return(false);
            }
            if (string.IsNullOrEmpty(txtPAYMENTINFO.Text))
            {
                if (fbCtr.FromFB == true)
                {
                    RefreshUI(RefreshedTypes.HideProgressBar);
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), "支付信息不能为空,请重新填写", Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return(false);
                }
            }
            else
            {
                //txtPAYMENTINFO.Text.Split("\r\n");
                string   TempText  = string.Empty;
                string   text      = this.txtPAYMENTINFO.Text;
                string[] arrary    = text.Split('\r');
                var      tempArray = arrary.Reverse();
                int      count     = tempArray.Count();
                if (count > 3)
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("TIPS"), "由于打印限制,支付信息不能超过3行,请重新填写支付信息");
                    return(false);
                }
            }
            //add by luojie
            //当没有报销金额时弹出提醒
            decimal totalFee = Convert.ToDecimal(txtChargeApplyTotal.Text);
            if (totalFee <= 0 && (!checkMeet && !checkPrivate))
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("出差报销费用不能为零,请填写报销费用!"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                return(false);
            }

            List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();
            if (validators.Count > 0)
            {
                foreach (var h in validators)
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("TIPS"), Utility.GetResourceStr(h.ErrorMessage));
                    return(false);
                }
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
            #endregion

            return(true);
        }
Example #17
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();
                };
            }
        }
Example #18
0
        public IActionResult SearchCity()
        {
            SearchCity model = new SearchCity();

            return(View(model));
        }
        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
        }
Example #20
0
        private void DaGrs_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            try
            {
                T_OA_BUSINESSTRIPDETAIL tmp = (T_OA_BUSINESSTRIPDETAIL)e.Row.DataContext;
                ImageButton             MyButton_Delbaodao = DaGrs.Columns[10].GetCellContent(e.Row).FindName("myDelete") as ImageButton;
                SearchCity myCity      = DaGrs.Columns[1].GetCellContent(e.Row).FindName("txtDEPARTURECITY") as SearchCity;
                SearchCity myCitys     = DaGrs.Columns[3].GetCellContent(e.Row).FindName("txtTARGETCITIES") as SearchCity;
                CheckBox   IsCheck     = DaGrs.Columns[7].GetCellContent(e.Row).FindName("myChkBox") as CheckBox;
                CheckBox   IsCheckMeet = DaGrs.Columns[8].GetCellContent(e.Row).FindName("myChkBoxMeet") as CheckBox;
                CheckBox   IsCheckCar  = DaGrs.Columns[9].GetCellContent(e.Row).FindName("myChkBoxCar") as CheckBox;
                TravelDictionaryComboBox ComVechile = DaGrs.Columns[4].GetCellContent(e.Row).FindName("ComVechileType") as TravelDictionaryComboBox;
                TravelDictionaryComboBox ComLevel   = DaGrs.Columns[5].GetCellContent(e.Row).FindName("ComVechileTypeLeve") as TravelDictionaryComboBox;
                if (BtnNewButton == true)
                {
                    myCitys.TxtSelectedCity.Text = string.Empty;
                    //citysStartList_Golbal.Add(tmp.DEPCITY);
                }
                else
                {
                    BtnNewButton = false;
                }
                MyButton_Delbaodao.Margin = new Thickness(0);
                MyButton_Delbaodao.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png", Utility.GetResourceStr("DELETE"));
                MyButton_Delbaodao.Tag = tmp;
                myCity.Tag             = tmp;

                myCitys.Tag = tmp;
                ComVechile.SelectedIndex = 0;
                ComLevel.SelectedIndex   = 0;
                //对默认颜色进行赋值
                tempcomTypeBorderBrush  = ComVechile.BorderBrush;
                tempcomTypeForeBrush    = ComVechile.Foreground;
                tempcomLevelBorderBrush = ComLevel.BorderBrush;
                tempcomLevelForeBrush   = ComLevel.Foreground;

                ObservableCollection <T_OA_BUSINESSTRIPDETAIL> objs = DaGrs.ItemsSource as ObservableCollection <T_OA_BUSINESSTRIPDETAIL>;
                if (formType != FormTypes.New)
                {
                    int j = 0;
                    if (DaGrs.ItemsSource != null && TraveDetailList_Golbal != null)
                    {
                        foreach (var obje in objs)
                        {
                            StandardsMethod(j);
                            j++;
                            if (obje.BUSINESSTRIPDETAILID == tmp.BUSINESSTRIPDETAILID) //判断记录的ID是否相同
                            {
                                if (myCity != null)                                    //出发城市
                                {
                                    if (obje.DEPCITY != null)
                                    {
                                        myCity.TxtSelectedCity.Text = GetCityName(obje.DEPCITY);
                                        if (TraveDetailList_Golbal.Count() > 1)
                                        {
                                            if (j > 1)
                                            {
                                                //By  : Sam
                                                //Date: 2011-9-6
                                                //For : 此处之前设置双击的时候还会出现打开状态
                                                myCity.IsEnabled = false;
                                                ((DataGridCell)((StackPanel)myCity.Parent).Parent).IsEnabled = false;
                                            }
                                        }
                                    }
                                }
                                if (myCitys != null)//目标城市
                                {
                                    if (obje.DESTCITY != null)
                                    {
                                        myCitys.TxtSelectedCity.Text = GetCityName(obje.DESTCITY);
                                    }
                                }
                                if (obje.PRIVATEAFFAIR == "1")//私事
                                {
                                    IsCheck.IsChecked = true;
                                }
                                if (obje.GOOUTTOMEET == "1")//外出开会
                                {
                                    IsCheckMeet.IsChecked = true;
                                }
                                if (obje.COMPANYCAR == "1")//公司派车
                                {
                                    IsCheckCar.IsChecked = true;
                                }
                            }
                            else
                            {
                                continue;
                            }

                            string dictid = "";
                            //获取交通工具类型、级别
                            if (ComVechile != null)
                            {
                                T_SYS_DICTIONARY type  = new T_SYS_DICTIONARY();
                                T_SYS_DICTIONARY level = new T_SYS_DICTIONARY();
                                type  = ComVechile.SelectedItem as T_SYS_DICTIONARY;
                                level = ComLevel.SelectedItem as T_SYS_DICTIONARY;
                                var thd = transportToolStand.FirstOrDefault();
                                if (type != null)
                                {
                                    thd = this.GetVehicleTypeValue(type.DICTIONARYVALUE.ToString());
                                    foreach (T_SYS_DICTIONARY Region in ComVechile.Items)
                                    {
                                        if (thd != null)
                                        {
                                            dictid = Region.DICTIONARYID;
                                            if (Region.DICTIONARYVALUE.ToString() == tmp.TYPEOFTRAVELTOOLS)
                                            {
                                                if (transportToolStand.Count() > 0)
                                                {
                                                    ComVechile.SelectedItem = Region;
                                                    if (thd.TYPEOFTRAVELTOOLS.ToInt32() > Region.DICTIONARYVALUE)
                                                    {
                                                        ComVechile.BorderBrush = new SolidColorBrush(Colors.Red);
                                                        ComVechile.Foreground  = new SolidColorBrush(Colors.Red);
                                                        ComLevel.BorderBrush   = new SolidColorBrush(Colors.Red);
                                                        ComLevel.Foreground    = new SolidColorBrush(Colors.Red);
                                                    }
                                                    if (thd.TYPEOFTRAVELTOOLS.ToInt32() <= Region.DICTIONARYVALUE)
                                                    {
                                                        if (tempcomTypeBorderBrush != null)
                                                        {
                                                            ComVechile.BorderBrush = tempcomTypeBorderBrush;
                                                        }
                                                        if (tempcomTypeForeBrush != null)
                                                        {
                                                            ComVechile.Foreground = tempcomTypeForeBrush;
                                                        }
                                                    }
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            if (ComLevel != null)
                            {
                                var ents = from ent in ListVechileLevel
                                           where ent.T_SYS_DICTIONARY2.DICTIONARYID == dictid
                                           select ent;
                                ComLevel.ItemsSource = ents.ToList();
                                if (ents.Count() > 0)
                                {
                                    T_SYS_DICTIONARY type  = new T_SYS_DICTIONARY();
                                    T_SYS_DICTIONARY level = new T_SYS_DICTIONARY();
                                    type  = ComVechile.SelectedItem as T_SYS_DICTIONARY;
                                    level = ComLevel.SelectedItem as T_SYS_DICTIONARY;

                                    var thd = transportToolStand.FirstOrDefault();
                                    if (type != null)
                                    {
                                        thd = this.GetVehicleTypeValue(type.DICTIONARYVALUE.ToString());
                                    }
                                    if (thd != null)
                                    {
                                        foreach (T_SYS_DICTIONARY RegionLevel in ComLevel.Items)
                                        {
                                            if (RegionLevel.DICTIONARYVALUE.ToString() == tmp.TAKETHETOOLLEVEL)
                                            {
                                                ComLevel.SelectedItem = RegionLevel;
                                                if (thd.TAKETHETOOLLEVEL.ToInt32() <= RegionLevel.DICTIONARYVALUE)
                                                {
                                                    if (tempcomLevelForeBrush != null)
                                                    {
                                                        ComLevel.Foreground = tempcomLevelForeBrush;
                                                    }
                                                    if (tempcomLevelBorderBrush != null)
                                                    {
                                                        ComLevel.BorderBrush = tempcomLevelBorderBrush;
                                                    }
                                                }
                                                else
                                                {
                                                    if (thd.TAKETHETOOLLEVEL.ToInt32() > RegionLevel.DICTIONARYVALUE)
                                                    {
                                                        ComLevel.BorderBrush = new SolidColorBrush(Colors.Red);
                                                        ComLevel.Foreground  = new SolidColorBrush(Colors.Red);
                                                        return;
                                                    }
                                                    else
                                                    {
                                                        if (tempcomLevelForeBrush != null)
                                                        {
                                                            ComLevel.Foreground = tempcomLevelForeBrush;
                                                        }
                                                        if (tempcomLevelBorderBrush != null)
                                                        {
                                                            ComLevel.BorderBrush = tempcomLevelBorderBrush;
                                                        }
                                                    }
                                                }
                                                break;
                                            }
                                        }
                                    }
                                }// ComLevel != null
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("出差申请DaGrs_LoadingRow异常:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
        }