// 提交数据到后台服务器 private void SaveClick(object sender, RoutedEventArgs e) { //如果数据有错,提示不能保存 GeneralObject kbfee = kbfee1.DataContext as GeneralObject; if (kbfee.HasErrors) { MessageBox.Show("输入数据有错,请检查!"); return; } GeneralObject loginUser = (GeneralObject)FrameworkElementExtension.FindResource(this, "LoginUser"); if (loginUser == null) { MessageBox.Show("无法获取当前登陆用户信息,请重新登陆后操作!"); return; } string loginid = (string)loginUser.GetPropertyValue("id"); //显示正在工作 busy.IsBusy = true; //获取基础地址 WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"]; // 提交 string str = wci.BaseAddress + "/sell/" + ui_userid.Text + "/" + shoukuan.Text + "/" + ui_zhinajin.Text + "/" + f_payment.SelectedValue + "/" + loginid + "?uuid=" + System.Guid.NewGuid().ToString(); Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
//鼠标离开时,计算阶梯气价 private void ui_lastinputgasnum_LostFocus(object sender, RoutedEventArgs e) { if (!"".Equals(ui_lastinputgasnum.Text) && !"".Equals(ui_lastrecord.Text)) { //取用户编号 string userid = ui_userid.Text; //计算气量 int lastinputgasnum = int.Parse(ui_lastinputgasnum.Text); int lastrecord = int.Parse(ui_lastrecord.Text); int pregas = lastrecord - lastinputgasnum; if (pregas < 0) { MessageBox.Show("抄表指数录入错误"); return; } //转换日期为文本 String date = ((DateTime)ui_lastinputdate.SelectedDate).ToString("yyyyMMdd"); WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"]; string str = wci.BaseAddress + "/handcharge/num/" + userid + "/" + pregas + "/" + date; Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchObject conditions = (criteriaPanel.DataContext as SearchObject); conditions.Search(); WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; String dt = "1=1"; if (StartDate.Text.Trim().Length != 0) { dt = " DEPARTURE_TIME>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt.Length > 3) { dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } else { dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' "; } } checkerList.LoadOnPathChanged = false; checkerList.Path = "sql"; checkerList.Names = "id,CONDITION,UNIT_NAME,CUS_DOM,CUS_DY,CUS_FLOOR,CUS_ROOM,USER_NAME,TELPHONE,RQB_AROUND,CONTENT,SAVE_PEOPLE,DEPARTURE_TIME,REPAIRMAN"; String sql = @"SELECT id, CONDITION, UNIT_NAME, CUS_DOM, CUS_DY, CUS_FLOOR, CUS_ROOM, f_consumername USER_NAME, f_consumerphone TELPHONE, f_rqbiaoxing RQB_AROUND, CAST(CASE f_sibiao WHEN 1 THEN '死表' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_changtong WHEN 1 THEN '常通' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_fanzhuang WHEN 1 THEN '反装' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_qblouqi WHEN 1 THEN '漏气' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_reading_mismatch WHEN 1 THEN '气量不符' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_qbqita WHEN 1 THEN f_qibiao ELSE '' END AS VARCHAR (50)) CONTENT, SAVE_PEOPLE, DEPARTURE_TIME, REPAIRMAN FROM T_INSPECTION WHERE 1=1 AND (f_sibiao = 1 OR f_changtong = 1 OR f_fanzhuang = 1 OR f_qblouqi = 1 OR f_reading_mismatch = 1 OR f_qbqita = 1) AND {0} AND {1}"; checkerList.HQL = String.Format(sql, new String[] { conditions.Condition, dt }).Replace("\r", " ").Replace("\t", " ").Replace("\n", " "); checkerList.Load(); }
private void ui_pregas_LostFocus(object sender, RoutedEventArgs e) { ui_chargeBusy.IsBusy = true; string userid = f_userid.Text; string pregas = ui_pregas.Text; string f_filiale = ui_filiale.Text; if (userid.Equals("")) { MessageBox.Show("请输入表编号!"); ui_chargeBusy.IsBusy = false; return; } else if (pregas.Equals("")) { MessageBox.Show("请输入预购气量!"); ui_chargeBusy.IsBusy = false; return; } WebClientInfo wci = (WebClientInfo)Application.Current.Resources["chargeserver"]; string str = wci.BaseAddress + "/num/" + userid + "/" + pregas + "/" + f_filiale + "?uuid=" + System.Guid.NewGuid().ToString(); Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
private void saveButton_Click(object sender, RoutedEventArgs e) { ui_handBusy.IsBusy = true; string json = "["; BaseObjectList list = daninfos.ItemsSource as BaseObjectList; List <GeneralObject> removed = new List <GeneralObject>(); //对于每一条记录 foreach (GeneralObject go in list) { // 抄表记录里的上期指数 var lastinputnum = go.GetPropertyValue("lastinputgasnum"); // 本次抄表指数 var lastrecord = go.GetPropertyValue("lastrecord"); //卡表剩余水量 var f_leftgas = go.GetPropertyValue("f_leftgas"); // 本次指数为空,这条不上传 if (lastrecord == null) { continue; } // 本期指数小于上期指数,不上传 if (double.Parse(lastrecord.ToString()) < double.Parse(lastinputnum.ToString())) { continue; } // 从列表中去除 removed.Add(go); //已经有项目,加逗号区分 if (json != "[") { json += ','; } //产生要发送后台的JSON串 json += ("{userid:" + go.GetPropertyValue("f_userid") + ",lastreading:" + lastinputnum + ",reading:" + lastrecord + ",leftgas:" + f_leftgas + ",meterstate:" + meterstate + "}"); } json += "]"; foreach (GeneralObject go in removed) { list.Remove(go); } //将产生的json串送后台服务进行处理 WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string uri = wci.BaseAddress + "/handcharge/record/batch/" + ui_handdate.SelectedDate + "/" + ui_sgnetwork.Text + "/" + ui_sgoperator.Text + "/" + chaobiaoriqi.SelectedDate + "/" + meter.SelectedValue.ToString() + "?uuid=" + System.Guid.NewGuid().ToString(); WebClient client = new WebClient(); client.UploadStringCompleted += client_UploadStringCompleted; client.UploadStringAsync(new Uri(uri), json); }
private void client1_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { ui_chargeBusy.IsBusy = false; if (e.Error == null) { JsonObject items = JsonValue.Parse(e.Result) as JsonObject; //如果有错误信息弹出 if (items.Keys.Contains("error")) { MessageBox.Show(items["error"]); return; } pregas = Math.Floor(double.Parse(items["chargeamont"].ToString())); WebClientInfo wci = (WebClientInfo)Application.Current.Resources["chargeserver"]; string str = wci.BaseAddress + "/num/" + userid + "/" + pregas; Uri uri = new Uri(str); WebClient client2 = new WebClient(); client2.DownloadStringCompleted += client2_DownloadStringCompleted; client2.DownloadStringAsync(uri); } else { ui_chargeBusy.IsBusy = false; MessageBox.Show(e.Error.Message); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchObject conditions = (criteriaPanel.DataContext as SearchObject); conditions.Search(); WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; String dt = "1=1"; if (StartDate.Text.Trim().Length != 0) { dt = " DEPARTURE_TIME>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt.Length > 3) { dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } else { dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' "; } } checkerList.LoadOnPathChanged = false; checkerList.Path = "sql"; checkerList.Names = "id,CONDITION,UNIT_NAME,CUS_DOM,CUS_DY,CUS_FLOOR,CUS_ROOM,USER_NAME,CARD_ID,TELPHONE,SAVE_PEOPLE,DEPARTURE_TIME,ARRIVAL_TIME,RQB_AROUND,REPAIRMAN,CONTENT,sn"; String sql = @"select t.id,t.CONDITION,t.UNIT_NAME,t.CUS_DOM,t.CUS_DY,t.CUS_FLOOR,t.CUS_ROOM,t.USER_NAME,t.CARD_ID,t.TELPHONE,t.SAVE_PEOPLE,t.DEPARTURE_TIME,t.ARRIVAL_TIME,t.RQB_AROUND,t.REPAIRMAN,tt.CONTENT from T_INSPECTION t , T_INSPECTION_LINE tt where t.id=tt.inspection_id and (t.DELETED is null or t.DELETED <> '是') and tt.EQUIPMENT='燃气表' and tt.CONTENT in ('表不过气', '长通表', '死表') and {0} and {1}"; checkerList.HQL = String.Format(sql, new String[] { conditions.Condition, dt }).Replace("\r\n", " "); checkerList.Load(); }
// 提交数据到后台服务器 private void SaveClick(object sender, RoutedEventArgs e) { //显示正在工作 busy.IsBusy = true; userid = f_userid.Text; //取出登陆用户id,后台根据id查找登陆用户放入分公司等信息 GeneralObject loginUser = (GeneralObject)FrameworkElementExtension.FindResource(this, "LoginUser"); if (loginUser == null) { MessageBox.Show("无法获取当前登陆用户信息,请重新登陆后操作!"); return; } string loginid = (string)loginUser.GetPropertyValue("id"); //获取基础地址 WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"]; // 提交 string str = wci.BaseAddress + "/sell/" + f_userid.Text + "/" + shoukuan.Text + "/" + f_zhinajin.Text + "/" + f_payment.SelectedValue + "/" + loginid; Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
private void save_Click(object sender, RoutedEventArgs e) { String sql = @"insert into t_gasaddress(id,f_road,f_districtname,f_cusDy,f_cusDom,f_cusFloor,f_apartment) ( select NEWID(),road,districtname,cusDy,cusDom,cusFloor,apartment from ( select case when a.f_districtname is null then '新增' when b.f_districtname is null then '已建' else '重复 ' end state, isnull( a.f_road, b.f_road) road, isnull( a.f_districtname, b.f_districtname) districtname, isnull( a.f_cusDy, b.f_cusDy) cusDy, isnull( a.f_cusDom, b.f_cusDom) cusDom, isnull( a.f_cusFloor, b.f_cusFloor) cusFloor, isnull( a.f_apartment, b.f_apartment) apartment from (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESS where f_districtname='{0}') a full join (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESSTEMP) b on a.f_road = b.f_road and a.f_districtname = b.f_districtname and a.f_cusDy=b.f_cusDy and a.f_cusDom=b.f_cusDom and a.f_cusFloor = b.f_cusFloor and a.f_apartment=b.f_apartment ) t where state='新增')"; sql = String.Format(sql, new String[] { districtname.Text }); WebClientInfo wi = Application.Current.Resources["dbclient"] as WebClientInfo; WebClient wc = new WebClient(); wc.UploadStringCompleted += saveAndClearCompleted; wc.UploadStringAsync(new Uri(wi.BaseAddress), "[{operator:\"sql\",data:\"" + sql.Replace("\r\n", "") + "\"}]"); }
private void ui_grossproceeds_LostFocus(object sender, RoutedEventArgs e) { ui_chargeBusy.IsBusy = true; string grossproceeds = ui_grossproceeds.Text; if (f_userid.Text.Equals("")) { MessageBox.Show("请先读卡!"); ui_chargeBusy.IsBusy = false; return; } else if (grossproceeds.Equals("")) { MessageBox.Show("请输入预购金额!"); ui_chargeBusy.IsBusy = false; return; } userid = f_userid.Text; WebClientInfo wci = (WebClientInfo)Application.Current.Resources["chargeserver"]; string str = wci.BaseAddress + "/fee/" + userid + "/" + grossproceeds; Uri uri = new Uri(str); WebClient client1 = new WebClient(); client1.DownloadStringCompleted += client1_DownloadStringCompleted; client1.DownloadStringAsync(uri); }
void save_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { busy.IsBusy = true; BatchExcuteAction save = sender as BatchExcuteAction; save.Completed -= save_Completed; //取出登陆用户id,后台根据id查找登陆用户放入分公司等信息 GeneralObject loginUser = (GeneralObject)FrameworkElementExtension.FindResource(this, "LoginUser"); if (loginUser == null) { MessageBox.Show("无法获取当前登陆用户信息,请重新登陆后操作!"); return; } string loginid = (string)loginUser.GetPropertyValue("id"); //获取基础地址 WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"]; // 提交 string str = wci.BaseAddress + "/sell/" + userid + "/" + id + "/" + loginid; Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { WebClient client = sender as WebClient; client.DownloadStringCompleted -= client_DownloadStringCompleted; // 没有出错 if (e.Error == null) { try { String retid = e.Result as String; if (!"noid".Equals(retid) && userid != null) { //产生要发送后台的JSON串 WebClientInfo wci1 = Application.Current.Resources["server"] as WebClientInfo; string uri1 = wci1.BaseAddress + "/iesgas/gascz/comand"; WebClient client1 = new WebClient(); client1.UploadStringCompleted += client1_UploadStringCompleted; client1.UploadStringAsync(new Uri(uri1), ("[{customer_code:\"" + userid + "\",id:\"" + retid + "\"}]")); } } catch (Exception ex) { } } busy.IsBusy = false; }
void go2_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("State")) { GasADObject obj = sender as GasADObject; if (obj.State.Equals(State.Loaded)) { WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; applyslist.LoadOnPathChanged = false; applyslist.Path = "sql"; applyslist.Names = "state,road,districtname,cusDy,cusDom,cusFloor,apartment,placeholder"; String sql = @"select * from (select case when a.f_districtname is null then '新增' when b.f_districtname is null then '已建' else '重复 ' end state, isnull(a.f_road, b.f_road) road, isnull(a.f_districtname, b.f_districtname) districtname, isnull( a.f_cusDy, b.f_cusDy) cusDy, isnull( a.f_cusDom, b.f_cusDom) cusDom, isnull(a.f_cusFloor, b.f_cusFloor) cusFloor, isnull(a.f_apartment, b.f_apartment) apartment from (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESS where f_districtname='{0}') a full join (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESSTEMP) b on a.f_road = b.f_road and a.f_districtname = b.f_districtname and a.f_cusDy=b.f_cusDy and a.f_cusDom=b.f_cusDom and a.f_cusFloor = b.f_cusFloor and a.f_apartment=b.f_apartment ) t "; string orderBy = " order by len(road), road, len(districtname), districtname,len(cusDom), cusDom,len(cusDy), cusDy,len(cusFloor), cusFloor,len(apartment), apartment"; applyslist.SumHQL = String.Format(sql, new String[] { districtname.Text }).Replace("\r\n", " "); applyslist.HQL = (applyslist.SumHQL + orderBy).Replace("\r\n", " "); applyslist.Load(); save.IsEnabled = true; search.IsEnabled = true; cancel.IsEnabled = true; } } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchObject conditions = (criteriaPanel.DataContext as SearchObject); conditions.Search(); WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; String where = conditions.Condition; String dt = "1=1"; if (StartDate.Text.Trim().Length != 0) { dt = " DEPARTURE_TIME>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt.Length > 3) { dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } else { dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } } checkerList.Path = "sql"; checkerList.Names = "save_people,days,papers,notifications,notins,defects,leakages"; String sql = @"SELECT t0.save_people,days,papers,notifications,notins,defects,leakages FROM(SELECT save_people,SUM (ruhu) papers,COUNT (DISTINCT dt) days,SUM (notin) notins FROM(SELECT id,save_people,SUBSTRING (departure_time, 1, 10) dt,CAST (CASE condition WHEN '正常' THEN 1 ELSE 0 END AS INTEGER) ruhu,CAST (CASE condition WHEN '无人' THEN 1 ELSE 0 END AS INTEGER) notin FROM T_INSPECTION WHERE 1 = 1 AND {0} AND {1}) b GROUP BY save_people) t0 LEFT JOIN (SELECT save_people,COUNT (id) leakages FROM(SELECT id, save_people FROM T_INSPECTION WHERE (f_qblouqi = 1 OR f_jpglouqi = 1 OR f_lglouqi = 1 OR f_cooker_leakage = 1 OR f_heater_leakage = 1 OR f_furnace_leakage = 1 OR f_bhglouqi = 1 OR f_biaoqianfa = '漏气' OR f_zaoqianfa = '漏气' OR f_zibifa = '漏气' OR f_zjxianzhuang = '漏气' OR f_rshqxianzhuang = '漏气' OR f_bglxianzhuang = '漏气') AND {0} AND {1}) a GROUP BY save_people) t1 ON t0.save_people = t1.save_people LEFT JOIN (SELECT save_people,COUNT (id) notifications FROM(SELECT id, save_people FROM T_INSPECTION WHERE f_renow_id IS NOT NULL AND f_renow_id <> '' AND {0} AND {1}) c GROUP BY save_people) t2 ON t0.save_people = t2.save_people LEFT JOIN (SELECT save_people,COUNT (id) defects FROM(SELECT id,save_people FROM T_INSPECTION WHERE (f_sibiao = 1 OR f_changtong = 1 OR f_fanzhuang = 1 OR f_qblouqi = 1 OR f_reading_mismatch = 1 OR (f_qibiao IS NOT NULL AND f_qibiao <> '')) AND {0} AND {1}) d GROUP BY save_people) t3 ON t0.save_people = t3.save_people"; checkerList.HQL = String.Format(sql, new String[] { where, dt }); checkerList.Load(); }
void go2_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("State")) { GasADObject obj = sender as GasADObject; if (obj.State.Equals(State.Loaded)) { WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; applyslist.LoadOnPathChanged = false; applyslist.Path = "sql"; applyslist.Names = "state,road,districtname,cusDy,cusDom,cusFloor,apartment,placeholder"; String sql = @"select cast(nvl2(a.f_districtname, nvl2(b.f_districtname,'重复','已建'), '新增') as varchar(10)) state, nvl2(a.f_road, a.f_road, b.f_road) road, nvl2(a.f_districtname, a.f_districtname, b.f_districtname) districtname, nvl2(a.f_cusDy, a.f_cusDy, b.f_cusDy) cusDy, nvl2(a.f_cusDom, a.f_cusDom, b.f_cusDom) cusDom, nvl2(a.f_cusFloor, a.f_cusFloor, b.f_cusFloor) cusFloor, nvl2(a.f_apartment, a.f_apartment, b.f_apartment) apartment from (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESS where f_districtname='{0}') a full join (select f_road, f_districtname, f_cusDy, f_cusDom, f_cusFloor, f_apartment from T_GASADDRESSTEMP) b on a.f_road = b.f_road and a.f_districtname = b.f_districtname and a.f_cusDy=b.f_cusDy and a.f_cusDom=b.f_cusDom and a.f_cusFloor = b.f_cusFloor and a.f_apartment=b.f_apartment order by length(road), road, length(districtname), districtname,length(cusDom), cusDom,length(cusDy), cusDy,length(cusFloor), cusFloor,length(apartment), apartment"; applyslist.HQL = String.Format(sql, new String[] { districtname.Text }); applyslist.Load(); save.IsEnabled = true; search.IsEnabled = true; cancel.IsEnabled = true; } } }
private void ui_pregas_LostFocus(object sender, RoutedEventArgs e) { ui_busy.IsBusy = true; string userid = ui_userid.Text; string pregas = ui_pregas.Text; if (userid.Equals("")) { MessageBox.Show("请先查询!"); ui_busy.IsBusy = false; return; } else if (pregas.Equals("")) { MessageBox.Show("请输入气量!"); ui_busy.IsBusy = false; return; } WebClientInfo wci = (WebClientInfo)Application.Current.Resources["chargeserver"]; string str = wci.BaseAddress + "/num/" + userid + "/" + pregas; Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchObject conditions = (criteriaPanel.DataContext as SearchObject); conditions.Search(); WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; String dt = " 1=1"; if (StartDate.Text.Trim().Length != 0) { dt = " DEPARTURE_TIME>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt.Length > 3) { dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } else { dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' "; } } dt = " and " + dt; checkerList.Path = "sql"; checkerList.Names = "precaution,road,unit_name,cus_dom,cus_dy,cus_floor,cus_room,user_name,telphone,departure_time,precaution_notified"; String sql = @"SELECT CAST (CASE f_heater_trapped WHEN 1 THEN '热水器直排或烟道未排出室外' ELSE '' END AS VARCHAR (50)) + CAST (CASE f_furnace_trapped WHEN 1 THEN '壁挂锅炉直排或烟道未排出室外' ELSE '' END AS VARCHAR (50)) + CAST ( CASE f_precaution_kitchen WHEN 1 THEN '开放式或密闭式厨房' ELSE '' END AS VARCHAR (50)) + CAST (CASE f_precaution_multisource WHEN 1 THEN '多种火源' ELSE '' END AS VARCHAR (50)) + CAST (CASE f_precaution_otheruse WHEN '卧室' THEN '更改用途(卧室)' WHEN '客厅' THEN '更改用途(客厅)' WHEN '浴室' THEN '更改用途(浴室)' ELSE '' END AS VARCHAR (50)) precaution, road,unit_name, cus_dom,cus_dy,cus_floor,cus_room,f_consumername user_name,f_consumerphone telphone,SUBSTRING (DEPARTURE_TIME, 1, 10) departure_time,CAST ( CASE ISNULL(f_renow_id, '') WHEN '' THEN '否' ELSE '是' END AS VARCHAR (50)) precaution_notified FROM T_INSPECTION WHERE 1=1 and {0}"; checkerList.HQL = String.Format(sql, new string[] { conditions.Condition + dt }).Replace("\t", " ").Replace("\n", " ").Replace("\r", " "); checkerList.Load(); }
void Print(object sender, RoutedEventArgs e) { WebClientInfo wci = Application.Current.Resources["dbclient"] as WebClientInfo; WebClient client = new WebClient(); client.UploadStringCompleted += wc_UploadStringCompleted; client.UploadStringAsync(new Uri(wci.BaseAddress), String.Format("[{{\"operator\":\"sql\",\"data\":\"update t_fapiaoinfos set f_fapiaostatue='已用' where f_invoicenum={0}\"}}]", fapiaoNum1.Text)); }
private void toExcel_Completed(object sender, EventArgs e) { WebClientInfo wc = Application.Current.Resources["server"] as WebClientInfo; string uro = wc.BaseAddress + "/file/" + toExcel.FileName; downLoad.Path = uro; downLoad.Completed += download_Completed; downLoad.Down(); }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchObject conditions = (criteriaPanel.DataContext as SearchObject); conditions.Search(); WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo; String where = conditions.Condition; String dt = "1=1"; if (StartDate.Text.Trim().Length != 0) { dt = " DEPARTURE_TIME>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt.Length > 3) { dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } else { dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'"; } } String dt2 = "1=1"; if (StartDate.Text.Trim().Length != 0) { dt2 = " SAVE_DATE>='" + StartDate.Text + "'"; } if (EndDate.Text.Trim().Length != 0) { if (dt2.Length > 3) { dt2 += " and SAVE_DATE<='" + EndDate.Text + " 23:59:59'"; } else { dt2 = " SAVE_DATE<='" + EndDate.Text + " 23:59:59'"; } } checkerList.Path = "sql"; checkerList.Names = "save_people,papers,days,notifications,notins,leakages,defects"; String sql = @"SELECT t0.save_people, papers, days, notifications,notins, leakages, defects from (select save_people, sum(ruhu) papers, count(DISTINCT dt) days, sum(notin) notins from ( select id, save_people, substring(departure_time, 1, 10) dt,cast(case condition when '正常' then 1 else 0 end as INTEGER) ruhu, cast(case condition when '无人' then 1 else 0 end as INTEGER) notin from T_INSPECTION where (deleted is null or deleted!='是') and {0} and {1} ) b group by save_people) t0 left join (select save_people, count(save_people) leakages FROM( select save_people from T_INSPECTION_LINE where inspection_id is not null and content like '%漏气%' and {2} and {3} ) a group by save_people) t1 on t0.save_people = t1.save_people left join (select save_people, count(DISTINCT inspection_id) defects FROM( select inspection_id,save_people from T_INSPECTION_LINE where inspection_id is not null and equipment = '燃气表' and content in('长通表', '死表', '表不过气', '其他') and {4} and {5} ) c group by save_people) t2 on t1.save_people=t2.save_people left join (select save_people, count(save_people) notifications FROM( select save_people from T_INSPECTION_LINE where inspection_id is not null and content = '已发近期安检报告书' and {6} and {7} ) d group by save_people) t3 on t2.save_people = t3.save_people"; checkerList.HQL = String.Format(sql, new String[] { where, dt, where, dt2, where, dt2, where, dt2 }); checkerList.Load(); }
private void save_Click(object sender, RoutedEventArgs e) { LeftGridBusy.IsBusy = true; GeneralObject go = handUserUnit.DataContext as GeneralObject; WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string str = ""; Uri uri = new Uri(str); WebClient client = new WebClient(); client.UploadStringCompleted += client_UploadStringCompleted; client.UploadStringAsync(uri, "aa"); }
// 查询按钮处理过程 private void dansearchbutton_Click(object sender, RoutedEventArgs e) { // 调用服务 WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string uri = wci.BaseAddress + "/DBFService/savefile/" + f_inputtor.SelectedValue + "/" + f_device.SelectedValue; Com.Aote.Controls.DownLoad dl = new Com.Aote.Controls.DownLoad(); dl.Filter = "(*.dbf)|*.dbf"; dl.Path = uri; dl.Down(); dl.Completed += dl_Completed; }
private void saveButton_Click(object sender, RoutedEventArgs e) { // 调用服务 WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string uri = wci.BaseAddress + "/DBFService/readfile/" + f_inputtor.SelectedValue + "/" + f_device.SelectedValue; Com.Aote.Controls.FileLoad fl = new Com.Aote.Controls.FileLoad(); fl.Filter = "(*.dbf)|*.dbf"; fl.Path = uri; fl.UpLoadNOFileName(); fl.Completed += fl_Completed; }
//提及时的处理过程 private void submittip2_OK(object sender, EventArgs e) { ObjectList ObjectList = FrameworkElementExtension.FindResource(this.searchbutton, "dangans") as ObjectList; WebClientInfo server = FrameworkElementExtension.FindResource(this.searchbutton, "server") as WebClientInfo; GeneralObject user = FrameworkElementExtension.FindResource(this.searchbutton, "LoginUser") as GeneralObject; string uuid = System.Guid.NewGuid().ToString(); Uri uri = new Uri(server.BaseAddress + "/files/touinfo/用户编号/表编号/" + user.GetPropertyValue("id") + "?uuid=" + uuid); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.UploadStringAsync(uri, ObjectList.ToJson().ToString()); }
private void countGas(object sender, RoutedEventArgs e) { //ui_handBusy.IsBusy = true; try { TextBox box = sender as TextBox; GeneralObject go = box.DataContext as GeneralObject; //上期底数从数据对象取 double lastinputgasnum = double.Parse(go.GetPropertyValue("lastinputgasnum").ToString()); if (box.Text == null || box.Text == "") { go.SetPropertyValue("oughtamount", null, false); } //由于焦点离开时,数据未传递到对象中,从界面取 double lastrecord = double.Parse(box.Text); //设置气量 double oughtamount = lastrecord - lastinputgasnum; go.SetPropertyValue("oughtamount", oughtamount, false); //获取应交金额 //用户编号 string f_userinfoid = go.GetPropertyValue("f_userinfoid") + ""; WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; SystemTime systemTime = FrameworkElementExtension.FindResource(this.saveButton, "SysTime") as SystemTime; Uri uri = new Uri(wci.BaseAddress + "/handcharge/num/" + f_userinfoid + "/" + oughtamount + "/" + ((DateTime)systemTime.Now).ToString("yyyyMMdd") + "?uuid=" + System.Guid.NewGuid().ToString()); WebClient client = new WebClient(); client.OpenReadCompleted += (o, a) => { if (a.Error == null) { JsonObject json = JsonValue.Load(a.Result) as JsonObject; double chargenum = (double)json["f_chargenum"]; double f_zhye = double.Parse(go.GetPropertyValue("f_zhye").ToString()); go.SetPropertyValue("gasfee", chargenum, false); double oughtfee = chargenum - f_zhye; if (oughtfee < 0) { oughtfee = 0; } go.SetPropertyValue("oughtfee", oughtfee, true); go.SetPropertyValue("f_grossproceeds", oughtfee + "", true); go.FromJson(json); } ui_handBusy.IsBusy = false; }; client.OpenReadAsync(uri); } catch (Exception ex) { ui_handBusy.IsBusy = false; } }
void save1_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { BatchExcuteAction c = sender as BatchExcuteAction; c.Completed -= save_Completed; //同步 将产生的json串送后台服务进行处理 WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string uri = wci.BaseAddress + "/iesgas/user/comand"; WebClient client = new WebClient(); client.UploadStringCompleted += client_UploadStringCompleted; client.UploadStringAsync(new Uri(uri), jsontb); }
// 提交数据到后台服务器 private void SaveClick(object sender, RoutedEventArgs e) { //保存前获取欠费表信息和表编号 count = (dataGrid1.ItemsSource as ObjectList).Count(); if (count > 0) { ObjectList handList = dataGrid1.ItemsSource as ObjectList; GeneralObject go = handList.First(); iesid = go.GetPropertyValue("f_userid").ToString(); } ; //如果数据有错,提示不能保存 GeneralObject kbfee = kbfee1.DataContext as GeneralObject; if (kbfee.HasErrors) { MessageBox.Show("输入数据有错,请检查!"); return; } GeneralObject loginUser = (GeneralObject)FrameworkElementExtension.FindResource(this, "LoginUser"); if (loginUser == null) { MessageBox.Show("无法获取当前登陆用户信息,请重新登陆后操作!"); return; } string loginid = (string)loginUser.GetPropertyValue("id"); //显示正在工作 busy.IsBusy = true; //发票号 string f_invoicenum = kbfee.GetPropertyValue("f_invoicenum") + ""; if (string.IsNullOrEmpty(f_invoicenum)) { f_invoicenum = "0"; } //获取基础地址 WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"]; // 提交 string str = wci.BaseAddress + "/sell/" + ui_userid.Text + "/" + shoukuan.Text + "/" + ui_zhinajin.Text + "/" + f_payment.SelectedValue + "/" + loginid + "?uuid=" + System.Guid.NewGuid().ToString(); Uri uri = new Uri(str); WebClient client = new WebClient(); client.DownloadStringCompleted += client_DownloadStringCompleted; client.DownloadStringAsync(uri); }
void save_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { BatchExcuteAction c = sender as BatchExcuteAction; c.Completed -= save_Completed; //计算抄表费用 WebClientInfo wci1 = Application.Current.Resources["server"] as WebClientInfo; string uri1 = wci1.BaseAddress + url; WebClient client1 = new WebClient(); client1.UploadStringCompleted += client1_UploadStringCompleted; client1.UploadStringAsync(new Uri(uri1), jsonjs); }
private void preview_Click(object sender, RoutedEventArgs e) { if ((apply.DataContext as GasADObject).HasErrors) { return; } previewButton.IsEnabled = false; //先去清空临时表 WebClientInfo wi = Application.Current.Resources["dbclient"] as WebClientInfo; WebClient wc = new WebClient(); wc.UploadStringCompleted += deleteTmpCompleted; wc.UploadStringAsync(new Uri(wi.BaseAddress), "[{operator:'sql',data:'delete from t_gasaddresstemp'}]"); }
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //busy.IsBusy = false; WebClient client = sender as WebClient; client.DownloadStringCompleted -= client_DownloadStringCompleted; // 没有出错 if (e.Error == null) { try { String retid = e.Result as String; if (!"noid".Equals(retid) && userid != null) { //产生要发送后台的JSON串 WebClientInfo wci1 = Application.Current.Resources["server"] as WebClientInfo; string uri1 = wci1.BaseAddress + "/iesgas/gascz/comand"; WebClient client1 = new WebClient(); client1.UploadStringCompleted += client1_UploadStringCompleted; client1.UploadStringAsync(new Uri(uri1), ("[{customer_code:\"" + userid + "\",id:\"" + retid + "\"}]")); } } catch (Exception ex) { } // 调用打印 MessageBoxResult mbr = MessageBox.Show("是否打印", "提示", MessageBoxButton.OKCancel); if (mbr == MessageBoxResult.OK) { print1.Print(); print1.Completed += print_Completed; } else { GeneralObject kbfee = (GeneralObject)(from r in loader.Res where r.Name.Equals("kbfee") select r).First(); BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction111") select p).First() as BatchExcuteAction; save.Invoke(); kbfee.New(); busy.IsBusy = false; } } else { // 提示出错 MessageBox.Show("连接服务器失败,请重试!如果继续失败,请联系系统管理员。"); // 清除界面数据 GeneralObject kbfee = (GeneralObject)(from r in loader.Res where r.Name.Equals("kbfee") select r).First(); kbfee.New(); busy.IsBusy = false; } }