void dansearch_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     //有错误
     if (e.Error != null)
     {
         MessageBox.Show(e.Error.Message);
     }
     else
     {
         //把数据转换成JSON
         JsonObject obj = JsonValue.Parse(e.Result) as JsonObject;
         JsonArray items = obj["rows"] as JsonArray;
         daninfos.ItemsSource = list;
         if (list.Size != 0)
             list.Clear();
         foreach (JsonObject json in items)
         {
             GeneralObject go = new GeneralObject();
             try
             {
                 go.EntityType = "t_";
                 go.SetPropertyValue("id", json["id"], false);//用户编号
                 go.SetPropertyValue("remote_key", json["remote_key"], false);//用户编号
                 go.SetPropertyValue("terminal_code", json["terminal_code"], false);//用户编号
                 go.SetPropertyValue("meter_code", json["meter_code"], false);//用户编号
                 go.SetPropertyValue("operate_type", json["operate_type"], false);//用户编号
                 go.SetPropertyValue("send_data", json["send_data"], false);//用户编号
                 go.SetPropertyValue("receive_data", json["receive_data"], false);//用户编号
                 go.SetPropertyValue("state", json["state"], false);//用户编号
                 go.SetPropertyValue("result", json["result"], false);//用户编号
                 go.SetPropertyValue("operator1",json["operator"], false);//用户编号
                 go.SetPropertyValue("des", json["des"], false);//用户编号
                 go.SetPropertyValue("create_date", json["create_date"], false);//用户编号
                 go.SetPropertyValue("company_code", json["company_code"], false);//用户编号
                 go.SetPropertyValue("telecomm_address", json["telecomm_address"], false);//用户编号
                 go.SetPropertyValue("customer_code",json["customer_code"], false);//用户编号
                 list.Add(go);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
                 return;
             }
         }
     }
 }
 //创建发票对象
 public GeneralObject CreateObj(GeneralObject source,double no)
 {
     GeneralObject go = new GeneralObject();
     go.EntityType = EntityType;
     string value = no.ToString();
     if (value.Length != BeginNo.ToString().Length)
     {
         for (int i = 0; i <= BeginNo.ToString().Length-value.Length; i++)
         {
             value = "0" + value;
         }
     }
     //发票号
     go.SetPropertyValue("f_invoicenum", value, true);
     //所属公司
     go.SetPropertyValue("f_filiale", source.GetPropertyValue("f_filiale"), true);
     //发票状态
     go.SetPropertyValue("f_fapiaostatue", "未用", true);
     //使用人
     go.SetPropertyValue("f_sgoperator", source.GetPropertyValue("f_sgoperator"), true);
     //分配人
     go.SetPropertyValue("f_operator", source.GetPropertyValue("f_operator"), true);
     //分配日期
     go.SetPropertyValue("f_date", source.GetPropertyValue("f_date"), true);
     return go;
 }
 private void PathListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     PathListBox pathListBox = sender as PathListBox;
     if (selectObj != null)
     {
         selectObj.SetPropertyValue("childsShow", "Collapsed", false);
     }
     selectObj = pathListBox.SelectedItem as GeneralObject;
     if (selectObj != null)
     {
         selectObj.SetPropertyValue("childsShow", "Visible", false);
     }
 }
        void userfiles_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            kbsellgasbusy.IsBusy = false;
            busy.IsBusy = false;
            if (e.Error != null)
            {
                MessageBox.Show("未找到用户的表具信息,请去表具建档!");
                return;
            }
            //把数据转换成JSON
            JsonObject item = JsonValue.Parse(e.Result) as JsonObject;
            //把用户数据写到交费界面上
            ui_username.Text = (string)item["f_username"];
            ui_usertype.Text = (String)item["f_usertype"];
            ui_districtname.Text = (String)item["f_districtname"];
            ui_gasproperties.Text = (String)item["f_gasproperties"];
            ui_stairpricetype.Text = (String)item["f_stairtype"];
               // zhye.Text = item["f_zhye"].ToString();
            ui_address.Text = (String)item["f_address"];
            //ui_gaspricetype.Text = (String)item["f_gaspricetype"];
            ui_userid.Text = item["infoid"].ToString();
            //zhe.Text=item["f_zherownum"].ToString();
            //ui_dibaohu.IsChecked = item["f_dibaohu"].ToString().Equals("1");
            //ui_userstate.Text = (String)item["f_userstate"];
               // ui_paytype.Text = (String)item["f_payment"];
            // ui_gasprice.Text = item["f_gasprice"].ToString();

            //把欠费数据插入到欠费表中
            BaseObjectList list = dataGrid1.ItemsSource as BaseObjectList;
            if (list != null)
            {
                list.Clear();
            }

            // 当前正在处理的表号
            String currentId = "";
            // 总的上期指数
            decimal lastnum = 0;
            // 总气量
            decimal gasSum = 0;
            // 总气费
            decimal feeSum = 0;
            //总的滞纳金
            decimal zhinajinAll = 0;
            //余额
            decimal f_zhye = decimal.Parse(item["f_zhye"].ToString());
            JsonArray bills = item["f_hands"] as JsonArray;
            foreach (JsonObject json in bills)
            {
                GeneralObject go = new GeneralObject();
                go.EntityType = "t_handplan";

                //默认选中
                go.IsChecked=true;

                //上期指数
                decimal lastinputgasnum = (decimal)json["lastinputgasnum"];
                go.SetPropertyValue("lastinputgasnum", lastinputgasnum, false);
                string f_userid = (string)json["f_userid"];
                go.SetPropertyValue("f_userid", f_userid, false);
                // 如果表号变了
                if (!f_userid.Equals(currentId))
                {
                    currentId = f_userid;
                    lastnum += lastinputgasnum;
                }

                //计算总金额
                decimal oughtfee = (decimal)json["oughtfee"];
                go.SetPropertyValue("oughtfee", oughtfee, false);
                feeSum += oughtfee;
                // 计算总气量
                decimal oughtamount = (decimal)json["oughtamount"];
                gasSum += oughtamount;
                go.SetPropertyValue("oughtamount", oughtamount, false);
                //计算总滞纳金
                decimal f_zhinajin = (decimal)json["f_zhinajin"];
                zhinajinAll += f_zhinajin;
                go.SetPropertyValue("f_zhinajin", f_zhinajin, false);
                int id = Int32.Parse(json["id"] + "");
                go.SetPropertyValue("id", id, false);

                go.SetPropertyValue("lastinputdate", DateTime.Parse(json["lastinputdate"]), false);
                go.SetPropertyValue("lastrecord", (decimal)json["lastrecord"], false);
                go.SetPropertyValue("f_endjfdate", DateTime.Parse(json["f_endjfdate"]), false);
                go.SetPropertyValue("f_zhinajintianshu", (int)json["days"], false);
                go.SetPropertyValue("f_network", (string)json["f_network"], false);
                go.SetPropertyValue("f_operator", (string)json["f_operator"], false);
                go.SetPropertyValue("f_inputdate", DateTime.Parse(json["f_inputdate"]), false);
                go.SetPropertyValue("f_userid", (string)json["f_userid"], false);

                go.SetPropertyValue("f_stair1amount", (decimal)json["f_stair1amount"], false);
                go.SetPropertyValue("f_stair1price", (decimal)json["f_stair1price"], false);
                go.SetPropertyValue("f_stair1fee", (decimal)json["f_stair1fee"], false);

                go.SetPropertyValue("f_stair2amount", (decimal)json["f_stair2amount"], false);
                go.SetPropertyValue("f_stair2price", (decimal)json["f_stair2price"], false);
                go.SetPropertyValue("f_stair2fee", (decimal)json["f_stair2fee"], false);

                go.SetPropertyValue("f_stair3amount", (decimal)json["f_stair3amount"], false);
                go.SetPropertyValue("f_stair3price", (decimal)json["f_stair3price"], false);
                go.SetPropertyValue("f_stair3fee", (decimal)json["f_stair3fee"], false);

                list.Add(go);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = OtherUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = OtherUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();
            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType = "t_updateotherfee";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("f_sellid", go.GetPropertyValue("id").ToString(), false);


                obj.SetPropertyValue("f_feetype", go.GetPropertyValue("f_feetype").ToString(), false);
                obj.SetPropertyValue("f_newfeetype", ui_f_feetype.Text, false);
                obj.SetPropertyValue("f_fee", decimal.Parse(go.GetPropertyValue("f_fee").ToString()), false);
                obj.SetPropertyValue("f_newfee", decimal.Parse(ui_f_fee.Text), false);
                obj.SetPropertyValue("f_payfeevalid", go.GetPropertyValue("f_payfeevalid").ToString(), false);
                obj.SetPropertyValue("f_newpayfeevalid", ui_payfeevalid.SelectedValue, false);

                obj.SetPropertyValue("f_sellinggasoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_sellinggasdate", ui_handplandate.SelectedDate, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.Name = "t_updateotherfee";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
            //MessageBox.Show(go.GetPropertyValue("id").ToString());
           //  MessageBox.Show(ui_handplandate.SelectedDate.ToString());
            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
            string sql = "update t_otherfee set f_feetype= '" + ui_f_feetype.Text +
              "',f_fee=" + decimal.Parse(ui_f_fee.Text) + ",f_payfeevalid='" + ui_payfeevalid.SelectedValue +
                 "' where id = " + go.GetPropertyValue("id");
           HQLAction action = new HQLAction();
           action.HQL = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name = "abc";
           action.Invoke();
            
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            save.State = State.End;
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;
            save1.IsOld = true;
            updatehandplan.New();
            
        }
 private void action_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     if (CoboxStair.SelectedValue.ToString() != "")
     {
         GeneralObject go = new GeneralObject();
         go.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
         go.EntityType = "t_changestairprice";
         go.SetPropertyValue("f_stairtype", CoboxStair.SelectedValue, false);
         go.SetPropertyValue("f_stair1amount", ui_stair1amount.Text, false);
         go.SetPropertyValue("f_stair2amount", ui_stair2amount.Text, false);
         go.SetPropertyValue("f_stair3amount", ui_stair3amount.Text, false);
         go.SetPropertyValue("f_stair1price", ui_stair1price.Text, false);
         go.SetPropertyValue("f_stair2price", ui_stair2price.Text, false);
         go.SetPropertyValue("f_stair3price", ui_stair3price.Text, false);
         go.SetPropertyValue("f_stair4price", ui_stair4price.Text, false);
         go.SetPropertyValue("f_stairmonths", ui_stairmonths.Text, false);
         go.SetPropertyValue("f_operator", ui_operator.Text, false);
         go.SetPropertyValue("f_operdate", ui_operdate.SelectedDate, false);
         go.SetPropertyValue("f_counts", ui_counts.Text, false);
         if (ui_usertype.SelectedValue != null)
         {
             go.SetPropertyValue("f_usertype", ui_usertype.SelectedValue, false);
         }
         if (ui_gasmeterstyle.SelectedValue != null)
         {
             go.SetPropertyValue("f_gasmeterstyle", ui_gasmeterstyle.SelectedValue, false);
         }
         if (ui_gaspricetype.SelectedValue != null)
         {
             go.SetPropertyValue("f_gasmeterstyle", ui_gaspricetype.SelectedValue, false);
         }
         go.Name = "t_changestairprice";
         go.Completed += obj_Completed;
         go.Save();
     }
     else
     {
         MessageBox.Show("请输入阶梯气价类型!");
         ui_searchBusy.IsBusy = false;
         return;
     }
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = handUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = handUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();
            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType = "t_updatehandplan";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("oughtfee", decimal.Parse(go.GetPropertyValue("oughtfee").ToString()), false);
                obj.SetPropertyValue("newoughtfee", decimal.Parse(ui_oughtfee.Text), false);
                if (go.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("lastinputgasnum", decimal.Parse(go.GetPropertyValue("lastinputgasnum").ToString()), false);
                }
                //修改后上期指数
                if (updatehandplan.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("newlastinputgasnum", decimal.Parse(updatehandplan.GetPropertyValue("lastinputgasnum").ToString()), false);
                }

                obj.SetPropertyValue("lastrecord", decimal.Parse(go.GetPropertyValue("lastrecord").ToString()), false);
                obj.SetPropertyValue("newlastrecord", decimal.Parse(ui_lastrecord.Text), false);
                obj.SetPropertyValue("shifoujiaofei", go.GetPropertyValue("shifoujiaofei").ToString(), false);
                obj.SetPropertyValue("f_newzhinajindate", ui_zhinajindate.SelectedDate.Value, false);
                //obj.SetPropertyValue("f_zhinajindate", go.GetPropertyValue("f_zhinajindate").ToString(), false);
                obj.SetPropertyValue("newshifoujiaofei", ui_shifoujiaofei.Text, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.SetPropertyValue("lastinputdate", go.GetPropertyValue("lastinputdate"), false);
                obj.SetPropertyValue("newlastinputdate", ui_lastinputdate.SelectedDate, false);
                if (go.GetPropertyValue("f_inputtor") == null)
                {
                    go.SetPropertyValue("f_inputtor", "无", false);
                }
                obj.SetPropertyValue("f_inputtor", go.GetPropertyValue("f_inputtor").ToString(), false);
                obj.SetPropertyValue("f_newinputtor", ui_inputtor.Text, false);
                obj.SetPropertyValue("oughtamount", decimal.Parse(go.GetPropertyValue("oughtamount").ToString()), false);
                obj.SetPropertyValue("newoughtamount", decimal.Parse(ui_oughtamount.Text), false);
                obj.SetPropertyValue("f_handplanoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_updatehandplan";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }

            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
            //拼接更新sql
            
            string sql = "update t_handplan set lastrecord= " + decimal.Parse(ui_lastrecord.Text) +
                ",oughtfee=" + decimal.Parse(ui_oughtfee.Text) +
                ",shifoujiaofei='" + ui_shifoujiaofei.Text +
                "',f_operator='" + ui_operator.Text +
                "',f_inputtor='" + ui_inputtor.Text +
                "',f_zhinajindate='" + ui_zhinajindate.SelectedDate.ToString().Substring(0, 10) +
                "',f_meterstate='" + meterstate.SelectedValue.ToString() +
                "',oughtamount=" + decimal.Parse(ui_oughtamount.Text);
            if (updatehandplan.GetPropertyValue("lastinputgasnum") != null)
            {
                sql += ",lastinputgasnum=" + updatehandplan.GetPropertyValue("lastinputgasnum").ToString();
            }
            sql += "  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();
            action.HQL = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name = "abc";
            action.Invoke();
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            //BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            // save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;
            save1.IsOld = true;
            updatehandplan.New();
        }
 //生成用气地址列表
 public void Invoke()
 {
     State = State.StartLoad;
     this.isBusy = true;
     //楼号
     string startbuild = this.GetPropertyValue("f_startbuild") + "";
     string endbuild = startbuild;
     //结束楼号不为空
     if (this.GetPropertyValue("f_endbuild") + "" != "")
     {
         endbuild = this.GetPropertyValue("f_endbuild") + "";
     }
     //单元
     string startunit = this.GetPropertyValue("f_startunit") + "";
     string endunit = startunit;
     if (this.GetPropertyValue("f_endunit") + "" != "")
     {
         endunit = this.GetPropertyValue("f_endunit") + "";
     }
     //楼层
     string startlayer = this.GetPropertyValue("f_startlayer") + "";
     string endlayer = startlayer;
     if (this.GetPropertyValue("f_endlayer") + "" != "")
     {
         endlayer = this.GetPropertyValue("f_endlayer") + "";
     }
     //房间号
     string startroom = this.GetPropertyValue("f_startroom") + "";
     string endroom = startroom;
     if (this.GetPropertyValue("f_endroom") + "" != "")
     {
         endroom = this.GetPropertyValue("f_endroom") + "";
     }
     //楼号列表
     List<string> builds = GetList(startbuild, endbuild);
     List<string> units = GetList(startunit, endunit);
     List<string> layers = GetList(startlayer, endlayer);
     List<string> rooms = GetList(startroom, endroom);
     ObjectList plans = new ObjectList();
     plans.WebClientInfo = this.WebClientInfo;
     plans.Name = Guid.NewGuid().ToString();
     foreach (string build in builds)
     {
         foreach (string unit in units)
         {
             foreach (string layer in layers)
             {
                 //每层多少室
                 foreach (string room in rooms)
                 {
                     //设置楼号
                     //SetPropertyValue("f_startbuild", build, true);
                     //设置单元
                     //SetPropertyValue("f_startunit", unit, true);
                     //设置层
                     //SetPropertyValue("f_startlayer", layer, true);
                     //设置每层室
                     //SetPropertyValue("f_room", room, true);
                     GeneralObject go = new GeneralObject();
                     go.EntityType = this.EntityType;
                     go.WebClientInfo = this.WebClientInfo;
                     go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                     go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                     //设置楼号,有模式,按模式设置
                     string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                     string str = MatchPattern(build, buildpattern);
                     go.SetPropertyValue("f_cusDom", str, true);
                     //设置单元
                     string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                     str = MatchPattern(unit, unitpattern);
                     go.SetPropertyValue("f_cusDy", str, true);
                     //设置层
                     string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                     str = MatchPattern(layer, layerpattern);
                     go.SetPropertyValue("f_cusFloor", str, true);
                     //设置每层室
                     string roompattern = this.GetPropertyValue("f_roompattern") + "";
                     str = MatchPattern(room, roompattern);
                     go.SetPropertyValue("f_apartment", str, true);
                     //Change();
                     //string ad = this.GetPropertyValue("f_gasaddress") + "";
                     go.Name = "test";
                     plans.Add(go);
                 }
             }
         }
     }
     plans.Completed += plans_Completed;
     plans.Save();
 }
        private void PostUITask(GeneralObject go)
        {
            if (go.GetPropertyValue("CONDITION").ToString().Equals("正常"))
            {
                //供暖方式
                ObjectCollection oc = this.Resources["WARM"] as ObjectCollection;
                bool found = false;
                foreach (Pair pair in oc)
                {
                    if (pair.CName.Equals(go.GetPropertyValue("WARM").ToString()))
                    {
                        found = true;
                        WARM.SelectedItem = pair;
                    }
                }
                if (!found)
                {
                    WARM_OTHER.Text = go.GetPropertyValue("WARM").ToString();
                    WARM.SelectedIndex = oc.Count - 1;
                }

                //基表厂家型号
                oc = this.Resources["JB_METER_NAME"] as ObjectCollection;
                found = false;
                foreach (Pair pair in oc)
                {
                    if (pair.CName.Equals(go.GetPropertyValue("JB_METER_NAME").ToString()))
                    {
                        JB_METER_NAME.SelectedItem = pair;
                        found = true;
                    }
                }
                if (!found)
                {
                    JB_METER_NAME_OTHER.Text = go.GetPropertyValue("JB_METER_NAME").ToString();
                    JB_METER_NAME.SelectedIndex = oc.Count - 1;
                }

                //IC卡表厂家型号
                oc = this.Resources["IC_METER_NAME"] as ObjectCollection;
                found = false;
                foreach (Pair pair in oc)
                {
                    if (pair.CName.Equals(go.GetPropertyValue("IC_METER_NAME").ToString()))
                    {
                        found = true;
                        IC_METER_NAME.SelectedItem = pair;
                    }
                }
                if (!found)
                {
                    IC_METER_NAME_OTHER.Text = go.GetPropertyValue("IC_METER_NAME").ToString();
                    go.SetPropertyValue("IC_METER_NAME", (oc.ElementAt(oc.Count - 1) as Pair).Code, true, true);
                    IC_METER_NAME.SelectedIndex = oc.Count - 1;
                }

                ObjectList lines = go.GetPropertyValue("LINES") as ObjectList;
                //不存在隐患
                if (lines == null)
                    return;

                foreach (GeneralObject line in lines)
                {
                    String EQUIPMENT = line.GetPropertyValue("EQUIPMENT") as string;
                    String CONTENT = line.GetPropertyValue("CONTENT") as string;
                    if (EQUIPMENT.Equals("安全隐患"))
                        CheckCheckBox(CONTENT, precautionCheckPane);
                    else if (EQUIPMENT.Equals("燃气表"))
                        CheckCheckBox(CONTENT, MeterDefectsPane);
                    else if (EQUIPMENT.Equals("立管"))
                        CheckPlumbingBox(CONTENT, PlumbingDefectsPane);
                    else if (EQUIPMENT.Equals("阀门表前阀"))
                        CheckCheckBox(CONTENT, PlumbingMeterValvePane);
                    else if (EQUIPMENT.Equals("阀门灶前阀"))
                        CheckCheckBox(CONTENT, PlumbingCookerValvePane);
                    else if (EQUIPMENT.Equals("阀门自闭阀"))
                        CheckCheckBox(CONTENT, PlumbingAutomaticValvePane);
                    else if (EQUIPMENT.Equals("户内管"))
                        CheckCheckBox(CONTENT, PlumbingPipePane);
                    else if (EQUIPMENT.Equals("灶具软管"))
                        CheckCheckBox(CONTENT, CookerPipePane);
                    else if (EQUIPMENT.Equals("热水器软管"))
                        CheckCheckBox(CONTENT, BoilerPipePane);
                    else if (EQUIPMENT.Equals("热水器安全隐患"))
                        CheckCheckBox(CONTENT, BoilerDefectsPane);
                    else if (EQUIPMENT.Equals("壁挂锅炉安全隐患"))
                        CheckCheckBox(CONTENT, WHEDefectsPane);
                }

                //提取用户档案地址
                String card_id = go.GetPropertyValue("CARD_ID") as string;
                if (IsNullOrEmpty(card_id))
                    return;
                WebClient wc = new WebClient();
                wc.DownloadStringCompleted += wc_GetUserProfileCompleted;
                wc.DownloadStringAsync(new Uri(go.WebClientInfo.BaseAddress + "/one/from T_IC_USERFILE where CARD_ID='" + card_id + "'"));
            }

        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go =SellUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = SellUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();
            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType = "t_updatesellinggas";

                obj.SetPropertyValue("f_userid", go.GetPropertyValue("f_userid")+"", false);
                obj.SetPropertyValue("f_newuserid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", go.GetPropertyValue("f_username")+"", false);
                obj.SetPropertyValue("f_newusername", ui_username.Text, false);
                obj.SetPropertyValue("f_address", go.GetPropertyValue("f_address")+"", false);
                obj.SetPropertyValue("f_newaddress", ui_address.Text, false);
                obj.SetPropertyValue("f_districtname", go.GetPropertyValue("f_districtname")+"", false);
                obj.SetPropertyValue("f_newdistrictname", ui_f_districtname.Text, false);

                obj.SetPropertyValue("f_sellid",go.GetPropertyValue("id").ToString(), false);
                obj.SetPropertyValue("f_usertype", ui_usertype.Text, false);
               if (go.GetPropertyValue("f_zhinajin") == null)
                {
                    go.SetPropertyValue("f_zhinajin", 0.0m, false);
                }
                 obj.SetPropertyValue("f_zhinajin", decimal.Parse(go.GetPropertyValue("f_zhinajin").ToString()), false);
                 if (ui_f_zhinajin.Text.ToString().Equals("")) {
                     ui_f_zhinajin.Text = "0";
                 }
                
                 obj.SetPropertyValue("f_newzhinajin", decimal.Parse(ui_f_zhinajin.Text), false);
                 if (go.GetPropertyValue("f_amountmaintenance") == null) 
                 {
                     go.SetPropertyValue("f_amountmaintenance", 0.0m, false);
                 }
                obj.SetPropertyValue("f_weihufei", decimal.Parse(go.GetPropertyValue("f_amountmaintenance").ToString()), false);
                if (ui_f_amountmaintenance.Text.ToString().Equals(""))
                {
                    ui_f_amountmaintenance.Text = "0";
                }
                
                obj.SetPropertyValue("f_newweihufei", decimal.Parse(ui_f_amountmaintenance.Text), false);
                obj.SetPropertyValue("f_shifouyouxiao", go.GetPropertyValue("f_payfeevalid").ToString(), false);
                obj.SetPropertyValue("f_newshifouyouxiao", ui_f_payfeevalid.Text, false);
                obj.SetPropertyValue("f_pregas", decimal.Parse(go.GetPropertyValue("f_pregas").ToString()), false);
                obj.SetPropertyValue("f_newpregas", decimal.Parse(ui_f_pregas.Text), false);
                obj.SetPropertyValue("f_preamount", decimal.Parse(go.GetPropertyValue("f_preamount").ToString()), false);
                obj.SetPropertyValue("f_newpreamount", decimal.Parse(ui_f_preamount.Text), false);
                obj.SetPropertyValue("f_shoukuan", decimal.Parse(go.GetPropertyValue("f_grossproceeds").ToString()), false);
                obj.SetPropertyValue("f_newshoukuan", decimal.Parse(ui_f_grossproceeds.Text), false);
                if (go.GetPropertyValue("f_benqizhye") == null)
                {
                    go.SetPropertyValue("f_benqizhye", 0.0m, false);
                }
                obj.SetPropertyValue("f_zhye", decimal.Parse(go.GetPropertyValue("f_benqizhye").ToString()), false);
                if (ui_f_benqizhye.Text.ToString().Equals(""))
                {
                    ui_f_benqizhye.Text = "0";
                }
                
                obj.SetPropertyValue("f_newzhye", decimal.Parse(ui_f_benqizhye.Text), false);

                if (go.GetPropertyValue("f_zhye") == null)
                {
                    go.SetPropertyValue("f_zhye", 0.0m, false);
                }
                obj.SetPropertyValue("f_shangqizhye", decimal.Parse(go.GetPropertyValue("f_zhye").ToString()), false);
                if (ui_f_zhye.Text.ToString().Equals(""))
                {
                    ui_f_zhye.Text = "0";
                }

                obj.SetPropertyValue("f_newshangqizhye", decimal.Parse(ui_f_zhye.Text), false);

                if (go.GetPropertyValue("lastinputgasnum") == null)
                {
                    go.SetPropertyValue("lastinputgasnum", 0.0m, false);
                }
                obj.SetPropertyValue("f_lastinputgasnums", decimal.Parse(go.GetPropertyValue("lastinputgasnum").ToString()), false);
                if (ui_f_zhye.Text.ToString().Equals(""))
                {
                    ui_f_zhye.Text = "0";
                }

                obj.SetPropertyValue("f_newlastinputgasnums", decimal.Parse(ui_f_lastinputgasnums.Text), false);

                if (go.GetPropertyValue("lastrecord") == null)
                {
                    go.SetPropertyValue("lastrecord", 0.0m, false);
                }
                obj.SetPropertyValue("f_lastrecord", decimal.Parse(go.GetPropertyValue("lastrecord").ToString()), false);
                if (ui_f_lastrecord.Text.ToString().Equals(""))
                {
                    ui_f_lastrecord.Text = "0";
                }

                obj.SetPropertyValue("f_newlastrecord", decimal.Parse(ui_f_lastrecord.Text), false);


                obj.SetPropertyValue("f_sellinggasoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_sellinggasdate", ui_handplandate.SelectedDate, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.Name = "t_updatesellinggas";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
           // BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
           // save.Invoke();

            string sql = "update t_sellinggas set f_zhinajin= " + decimal.Parse(ui_f_zhinajin.Text) +
                ",f_amountmaintenance=" + decimal.Parse(ui_f_amountmaintenance.Text) +
                ",f_payfeevalid='" + ui_f_payfeevalid.Text +
                "',f_pregas=" + decimal.Parse(ui_f_pregas.Text) +
                ",f_preamount=" +  decimal.Parse(ui_f_preamount.Text) +
                 ",f_grossproceeds=" +  decimal.Parse(ui_f_grossproceeds.Text) +
                  ",f_benqizhye=" +  decimal.Parse(ui_f_benqizhye.Text) +
                 ",f_zhye=" +  decimal.Parse(ui_f_zhye.Text)+
                 ",lastinputgasnum=" + decimal.Parse(ui_f_lastinputgasnums.Text) +
                 ",lastrecord=" + decimal.Parse(ui_f_lastrecord.Text) +
                 ",f_userid='" + ui_userid.Text +
                 "',f_username='******',f_address='" + ui_address.Text +
                 "',f_districtname='" + ui_f_districtname.Text +
                 "'  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();
            action.HQL = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name = "abc";
            action.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;
            save1.IsOld = true;
            updatehandplan.New();
        }
 private void menus_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     PathListBox pathListBox = sender as PathListBox;
     if (selectObj != null)
     {
         selectObj.SetPropertyValue("childsShow", "Collapsed", false);
     }
     selectObj = pathListBox.SelectedItem as GeneralObject;
     if (selectObj != null)
     {
         selectObj.SetPropertyValue("childsShow", "Visible", false);
     }
 }
Example #12
0
        /// <summary>
        /// 添加子节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddChild_Click(object sender, RoutedEventArgs e)
        {
            if ((EditGrid.DataContext as SearchObject).HasErrors)
            {
                MessageBox.Show("请填写名称。");
                return;
            }
            Indicator.IsBusy = true;
            //查找是否重复
            String newName = (EditGrid.DataContext as SearchObject).GetPropertyValue("AName").ToString();
            object remark = (EditGrid.DataContext as SearchObject).GetPropertyValue("Remark");
            if (remark == null)
                remark = "";

            bool duplicated = false;
            GeneralObject curGo = curItem.Tag as GeneralObject;
            int level = 0;
            if(String.IsNullOrEmpty(curGo.EntityType))
                level = int.Parse(curGo.GetPropertyValue("col3").ToString()) + 1;
            if(level==4)
            {
                Indicator.IsBusy = false;
                MessageBox.Show("房间下不能再添加节点!");
                return;
            }
            String iid = "";
            if (String.IsNullOrEmpty(curGo.EntityType))
                iid = curGo.GetPropertyValue("col0") + "000000";
            else
                iid = curGo.GetPropertyValue("id").ToString().PadLeft(6,'0') + "000000";
            ItemCollection ic = curItem.Items;
            for (int i = 0; i < ic.Count; i++)
            {
                GeneralObject item = (ic[i] as TreeViewItem).Tag as GeneralObject;
                if (item.GetPropertyValue("col1").ToString().Equals(newName))
                    duplicated = true;
                String tiid = item.GetPropertyValue("col0").ToString();
                if(tiid.CompareTo(iid) > 0)
                {
                    iid = tiid;
                }
            }

            //判断重复
            if (duplicated)
            {
                Indicator.IsBusy = false;
                MessageBox.Show("该名称已经存在。");
                return;
            }

            iid = iid.Substring(0, iid.Length - 6) + (int.Parse(iid.Substring(iid.Length-6))+1).ToString().PadLeft(6,'0');
            int rank = 1;
            object pid = curGo.GetPropertyValue("col0");
            if(!String.IsNullOrEmpty(curGo.EntityType))
                pid = curGo.GetPropertyValue("id").ToString();
            if (curItem.Items.Count != 0)
            {
                //计算排序号
                GeneralObject go = (curItem.Items[curItem.Items.Count - 1] as TreeViewItem).Tag as GeneralObject;
                rank = int.Parse(go.GetPropertyValue("col6").ToString()) + 1;
                level = int.Parse(go.GetPropertyValue("col3").ToString());
            }
            arguments = new object[] { iid, newName, remark, rank, level, pid };

            //如果是叶子,插入t_gasaddress 并保存到t_design_address
            if (level == 3)
            {
                GeneralObject goAddress = new GeneralObject();
                goAddress.EntityType = "t_gasaddress";
                goAddress.WebClientInfo = App.Current.Resources["dbclient"] as WebClientInfo;
                goAddress.SetPropertyValue("f_apartment", newName, false);
                goAddress.SetPropertyValue("f_cusFloor", curItem.Header, false);
                goAddress.SetPropertyValue("f_cusDy", curItem.GetParentTreeViewItem().Header, false);
                goAddress.SetPropertyValue("f_cusDom", curItem.GetParentTreeViewItem().GetParentTreeViewItem().Header, false);
                TreeViewItem residentialArea = curItem.GetParentTreeViewItem().GetParentTreeViewItem().GetParentTreeViewItem();
                goAddress.SetPropertyValue("f_districtname", residentialArea.Header, false);
                goAddress.SetPropertyValue("f_road", (residentialArea.Tag as GeneralObject).GetPropertyValue("f_road"), false);
                goAddress.Completed += goAddress_Completed;
                goAddress.Name = "asd";
                goAddress.Save();
            }

            //只保存入t_design_address
            else
            {
                GeneralObject address = new GeneralObject();
                address.Name = "address";
                address.EntityType = "t_design_address";
                address.WebClientInfo = App.Current.Resources["dbclient"] as WebClientInfo;
                address.SetPropertyValue("iid", arguments[0], false);
                address.SetPropertyValue("name", arguments[1], false);
                address.SetPropertyValue("remark", arguments[2], false);
                address.SetPropertyValue("rank", arguments[3], false);
                address.SetPropertyValue("level", arguments[4], false);
                address.SetPropertyValue("pid", arguments[5], false);
                address.SetPropertyValue("col0", arguments[0], false);
                address.SetPropertyValue("col1", arguments[1], false);
                address.SetPropertyValue("col2", arguments[2], false);
                address.SetPropertyValue("col6", arguments[3].ToString(), false);
                address.SetPropertyValue("col3", arguments[4].ToString(), false);
                address.SetPropertyValue("col4", arguments[5], false);
                address.Completed += address_Completed;
                address.Save();
            }
        }
Example #13
0
        /// <summary>
        /// 保存t_gasaddress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void goAddress_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            if(e.Error != null)
            {
                Indicator.IsBusy = false;
                MessageBox.Show("操作失败!");
                return;
            }

            object addressId = (sender as GeneralObject).GetPropertyValue("ID").ToString();
             //IID, Name, Remark, Level, PID, ResidentialAreaName, rank, ID, addressId
             //arguments = new object[] { iid, newName, remark, rank, level, pid };
            GeneralObject address = new GeneralObject();
            address.Name = "address";
            address.EntityType = "t_design_address";
            address.WebClientInfo = App.Current.Resources["dbclient"] as WebClientInfo;
            address.SetPropertyValue("iid", arguments[0], false);
            address.SetPropertyValue("name", arguments[1], false);
            address.SetPropertyValue("remark", arguments[2], false);
            address.SetPropertyValue("rank", arguments[3], false);
            address.SetPropertyValue("level", arguments[4], false);
            address.SetPropertyValue("pid", arguments[5], false);
            address.SetPropertyValue("addressId", addressId, false);
            address.SetPropertyValue("col0", arguments[0], false);
            address.SetPropertyValue("col1", arguments[1], false);
            address.SetPropertyValue("col2", arguments[2], false);
            address.SetPropertyValue("col6", arguments[3].ToString(), false);
            address.SetPropertyValue("col3", arguments[4].ToString(), false);
            address.SetPropertyValue("col4", arguments[5], false);
            address.SetPropertyValue("col8", addressId, false);
            address.Completed += address_Completed;
            address.Save();
        }
Example #14
0
        // private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#";

        //生成用水地址列表
        public void Invoke()
        {
            State       = State.StartLoad;
            this.isBusy = true;
            //楼号
            string startbuild = this.GetPropertyValue("f_startbuild") + "";
            string endbuild   = startbuild;

            //结束楼号不为空
            if (this.GetPropertyValue("f_endbuild") + "" != "")
            {
                endbuild = this.GetPropertyValue("f_endbuild") + "";
            }
            //单元
            string startunit = this.GetPropertyValue("f_startunit") + "";
            string endunit   = startunit;

            if (this.GetPropertyValue("f_endunit") + "" != "")
            {
                endunit = this.GetPropertyValue("f_endunit") + "";
            }
            //楼层
            string startlayer = this.GetPropertyValue("f_startlayer") + "";
            string endlayer   = startlayer;

            if (this.GetPropertyValue("f_endlayer") + "" != "")
            {
                endlayer = this.GetPropertyValue("f_endlayer") + "";
            }
            //房间号
            string startroom = this.GetPropertyValue("f_startroom") + "";
            string endroom   = startroom;

            if (this.GetPropertyValue("f_endroom") + "" != "")
            {
                endroom = this.GetPropertyValue("f_endroom") + "";
            }
            //楼号列表
            List <string> builds = GetList(startbuild, endbuild);
            List <string> units  = GetList(startunit, endunit);
            List <string> layers = GetList(startlayer, endlayer);
            List <string> rooms  = GetList(startroom, endroom);
            ObjectList    plans  = new ObjectList();

            plans.WebClientInfo = this.WebClientInfo;
            plans.Name          = Guid.NewGuid().ToString();
            try
            {
                foreach (string build in builds)
                {
                    foreach (string unit in units)
                    {
                        foreach (string layer in layers)
                        {
                            //每层多少室
                            foreach (string room in rooms)
                            {
                                GeneralObject go = new GeneralObject();
                                go.EntityType    = this.EntityType;
                                go.WebClientInfo = this.WebClientInfo;
                                go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                                go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                                //设置楼号,有模式,按模式设置
                                string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                                string str          = MatchPattern(build, buildpattern);
                                go.SetPropertyValue("f_cusDom", str, true);
                                //设置单元
                                string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                                str = MatchPattern(unit, unitpattern);
                                go.SetPropertyValue("f_cusDy", str, true);
                                //设置层
                                string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                                str = MatchPattern(layer, layerpattern);
                                go.SetPropertyValue("f_cusFloor", str, true);
                                //设置每层室
                                string roompattern = this.GetPropertyValue("f_roompattern") + "";
                                str = MatchPattern(room, roompattern);
                                go.SetPropertyValue("f_apartment", str, true);
                                //Change();
                                //string ad = this.GetPropertyValue("f_gasaddress") + "";
                                go.Name = "test";
                                plans.Add(go);
                            }
                        }
                    }
                }
            }catch (NullReferenceException e)
            {
                MessageBox.Show("输入的内容不符合要求");
            }
            finally
            {
                plans.Completed += plans_Completed;
                plans.Save();
            }
        }
        private void SumFee()
        {
            ui_myjb.Text = (myjbzhye - myjbqf).ToString();
            ui_mykb.Text = mykbzhye.ToString();
            ui_fmykb.Text = fmykbzhye.ToString();
            ui_fmyjb.Text = (fmyjbzhye - fmyjbqf).ToString();
            ui_sumfee.Text = ((myjbzhye - myjbqf) + mykbzhye + fmykbzhye + (fmyjbzhye - fmyjbqf)).ToString();
            ui_tjdate.Text = date;

            GeneralObject obj = new GeneralObject();
            obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            obj.EntityType = "t_qianfeijieyu";
            obj.SetPropertyValue("f_tjdate", date, false);
            obj.SetPropertyValue("f_civiljb", myjbzhye - myjbqf, false);
            obj.SetPropertyValue("f_unciviljb", fmyjbzhye - fmyjbqf, false);
            obj.SetPropertyValue("f_civilkb", mykbzhye, false);
            obj.SetPropertyValue("f_uncivilkb", fmykbzhye, false);
            obj.SetPropertyValue("f_sumfee", (myjbzhye - myjbqf) + mykbzhye + fmykbzhye + (fmyjbzhye - fmyjbqf), false);
            obj.Name = "t_qianfeijieyu";
            obj.Completed += obj_Completed;
            obj.Save();
        }
        private void action_Completed(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            ui_searchBusy.IsBusy = false;
            HQLAction action = sender as HQLAction;
            action.Completed -= action_Completed;

            if (CoboxStair.SelectedValue.ToString() != "")
            {
                GeneralObject go = new GeneralObject();
                go.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                go.EntityType = "t_changestairprice";
                go.SetPropertyValue("f_stairtype", CoboxStair.SelectedValue, false);
                go.SetPropertyValue("f_stair1amount", ui_stair1amount.Text, false);
                go.SetPropertyValue("f_stair2amount", ui_stair2amount.Text, false);
                go.SetPropertyValue("f_stair3amount", ui_stair3amount.Text, false);
                go.SetPropertyValue("f_stair1price", ui_stair1price.Text, false);
                go.SetPropertyValue("f_stair2price", ui_stair2price.Text, false);
                go.SetPropertyValue("f_stair3price", ui_stair3price.Text, false);
                go.SetPropertyValue("f_stair4price", ui_stair4price.Text, false);
                go.SetPropertyValue("f_stairmonths", ui_stairmonths.Text, false);
                go.SetPropertyValue("f_operator", ui_operator.Text, false);
                go.SetPropertyValue("f_operdate", ui_operdate.SelectedDate, false);
                go.SetPropertyValue("f_counts", ui_counts.Text, false);
                if (ui_usertype.SelectedValue != null)
                {
                    go.SetPropertyValue("f_usertype", ui_usertype.SelectedValue, false);
                }
                if (ui_gasmeterstyle.SelectedValue != null)
                {
                    go.SetPropertyValue("f_gasmeterstyle", ui_gasmeterstyle.SelectedValue, false);
                }
                go.Name = "t_changestairprice";
                go.Completed += obj_Completed;
                go.Save();

                string json = "[";
                if (ui_stairmonths.Text != "" || ui_stair1amount.Text != "" || ui_stair1price.Text != "" || ui_stair2amount.Text != "" || ui_stair2price.Text != "" || ui_stair3amount.Text != "" || ui_stair3price.Text != "" || CoboxStair.SelectedValue != null)
                {
                    //产生要发送后台的JSON串
                    json += ("{type:\"1\",price_type:\"" + CoboxStair.SelectedValue +
                                      "\",money1:\"" + ui_stair1price.Text +
                                      "\",limit1:\"" + ui_stair1amount.Text +
                                      "\",money2:\"" + ui_stair2price.Text +
                                      "\",limit2:\"" + ui_stair2amount.Text +
                                      "\",money3:\"" + ui_stair3price.Text +
                                      "\",limit3:\"" + ui_stair3amount.Text +
                                      "\",money4:\"" + ui_stair4price.Text +
                                      "\",limit4:\"999999999" +
                                      "\",money5:\"" + ui_stair4price.Text +
                                      "\",limit5:\"999999999" +
                                      "\",cycle:\"" + ui_stairmonths.Text +
                                      "\",idlist:[{search:\"" + search.Condition + "\"}]}");
                    json += "]";
                    //将产生的json串送后台服务进行处理
                    WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo;
                    string uri = wci.BaseAddress + "/iesgas/gasdj/comand";
                    WebClient client = new WebClient();
                    client.UploadStringCompleted += client_UploadStringCompleted;
                    client.UploadStringAsync(new Uri(uri), json);
                }
                MessageBox.Show("阶梯变更完成!");

            }
            else
            {
                MessageBox.Show("请输入阶梯气价类型!");
                return;
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = FaKaUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = FaKaUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();
            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType = "t_updatemyfaka";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("f_usertype", ui_usertype.Text, false);
                obj.SetPropertyValue("f_qibiaochangjia", ui_gasmetermanufacturers.Text, false);
                obj.SetPropertyValue("f_qibiaopinpai", ui_gaswatchbrand.Text, false);
                obj.SetPropertyValue("f_gaspricetype", ui_f_gaspricetype.Text, false);
                obj.SetPropertyValue("f_newpregas", decimal.Parse(ui_f_pregas.Text), false);
                obj.SetPropertyValue("f_pregas", decimal.Parse(go.GetPropertyValue("f_pregas").ToString()), false);
                obj.SetPropertyValue("f_cardfees", decimal.Parse(go.GetPropertyValue("f_cardfees").ToString()), false);
                obj.SetPropertyValue("f_newcardfees", decimal.Parse(ui_f_cardfees.Text), false);
                obj.SetPropertyValue("f_preamount", decimal.Parse(go.GetPropertyValue("f_preamount").ToString()), false);
                obj.SetPropertyValue("f_newpreamount", decimal.Parse(ui_f_preamount.Text), false);
                obj.SetPropertyValue("f_totalcost", decimal.Parse(go.GetPropertyValue("f_totalcost").ToString()), false);
                obj.SetPropertyValue("f_newtotalcost", decimal.Parse(ui_f_totalcost.Text), false);
                obj.SetPropertyValue("f_whethergivecard", go.GetPropertyValue("f_whethergivecard").ToString(), false);
                obj.SetPropertyValue("f_newwhethergivecard", ui_f_whethergivecard.Text, false);
                obj.SetPropertyValue("f_cardid", ui_f_cardid.Text, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);           
                obj.SetPropertyValue("f_handplanoperator", ui_operator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_updatemyfaka";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
 
           
            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
             string sql = "update t_myfaka set f_pregas= " + decimal.Parse(ui_f_pregas.Text) +
                 ",f_cardfees=" + decimal.Parse(ui_f_cardfees.Text) +
                 ",f_preamount=" + decimal.Parse(ui_f_preamount.Text) +
                 ",f_totalcost=" + decimal.Parse(ui_f_totalcost.Text) +
                 ",f_whethergivecard='" + ui_f_whethergivecard.Text +
                
                 "'  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();
            action.HQL = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name = "abc";
            action.Invoke();
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            //BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
           // save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;
            save1.IsOld = true;
            updatehandplan.New();
        }
        private void save2_Click(object sender, RoutedEventArgs e)
        {
            changebusy.IsBusy = true;
            GeneralObject go = userfiles.SelectedItem as GeneralObject;
            GeneralObject kbfe = new GeneralObject();
            kbfe.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            kbfe.EntityType = "t_upkeep";
            if (go.GetPropertyValue("f_userid")!= null)
            {
                kbfe.SetPropertyValue("f_userid", go.GetPropertyValue("f_userid").ToString(), false);
            }
            if (go.GetPropertyValue("f_username") != null)
            {
                kbfe.SetPropertyValue("f_username", go.GetPropertyValue("f_username").ToString(), false);
            }
            if (f_username.Text != null && f_username.Text != "")
            {
                kbfe.SetPropertyValue("f_newusername", f_username.Text, false);
            }
            if (go.GetPropertyValue("f_cardid") != null)
            {
                kbfe.SetPropertyValue("f_cardid", go.GetPropertyValue("f_cardid").ToString(), false);
            }
            if (go.GetPropertyValue("f_districtname") != null)
            {
                kbfe.SetPropertyValue("f_districtname", go.GetPropertyValue("f_districtname").ToString(), false);
            }
            if (f_districtname.Text != null && f_districtname.Text != "")
            {
                kbfe.SetPropertyValue("f_newdistrictname", f_districtname.Text, false);
            }
            if (go.GetPropertyValue("f_gaswatchbrand") != null)
            {
                kbfe.SetPropertyValue("f_gaswatchbrand", go.GetPropertyValue("f_gaswatchbrand").ToString(), false);
            }
            if (f_gasproperties.Text != null && f_gasproperties.Text != "")
            {
                kbfe.SetPropertyValue("f_gasproperties", f_gasproperties.Text, false);
            }
            if (go.GetPropertyValue("f_beginfee") != null)
            {
                kbfe.SetPropertyValue("f_beginfee", go.GetPropertyValue("f_beginfee").ToString(), false);
            }
            if (f_beginfee.Text != null && f_beginfee.Text != "")
            {
                kbfe.SetPropertyValue("f_newbeginfee", f_beginfee.Text, false);
            }
            if (go.GetPropertyValue("f_upbuynum") != null)
            {
                kbfe.SetPropertyValue("f_upbuynum", go.GetPropertyValue("f_upbuynum").ToString(), false);
            }
            if (go.GetPropertyValue("f_pregas") != null )
            {
                kbfe.SetPropertyValue("f_pregas", go.GetPropertyValue("f_pregas").ToString(), false);
            }
            if (f_pregas.Text != null && f_pregas.Text != "")
            {
                kbfe.SetPropertyValue("f_newpregas", f_pregas.Text, false);
            }
            if (go.GetPropertyValue("f_payment") != null)
            {
                kbfe.SetPropertyValue("f_payment", go.GetPropertyValue("f_payment").ToString(), false);
            }
            if (f_payment.SelectedValue != null)
            {
                kbfe.SetPropertyValue("f_newpayment", f_payment.SelectedValue, false);
            }
            if (go.GetPropertyValue("f_sgnetwork") != null )
            {
                kbfe.SetPropertyValue("f_sgnetwork", go.GetPropertyValue("f_sgnetwork").ToString(), false);
            }
            if (f_reason.Text != null && f_reason.Text != "")
            {
                kbfe.SetPropertyValue("f_reason", f_reason.Text, false);
            }
            if (go.GetPropertyValue("f_usertype") != null )
            {
                kbfe.SetPropertyValue("f_usertype", go.GetPropertyValue("f_usertype").ToString(), false);
            }
            if (go.GetPropertyValue("f_address") != null)
            {
                kbfe.SetPropertyValue("f_address", go.GetPropertyValue("f_address").ToString(), false);
            }
            if (f_address.Text != null && f_address.Text != "")
            {
                kbfe.SetPropertyValue("f_newaddress", f_address.Text, false);
            }
            if (go.GetPropertyValue("f_metertype") != null )
            {
                kbfe.SetPropertyValue("f_metertype", go.GetPropertyValue("f_metertype").ToString(), false);
            }
            if (go.GetPropertyValue("f_gaspricetype") != null)
            {
                kbfe.SetPropertyValue("f_gaspricetype", go.GetPropertyValue("f_gaspricetype").ToString(), false);
            }
            if (go.GetPropertyValue("f_endfee") != null)
            {
                kbfe.SetPropertyValue("f_endfee", go.GetPropertyValue("f_endfee").ToString(), false);
            }
            if (f_endfee.SelectedDate != null)
            {
                kbfe.SetPropertyValue("f_newendfee", f_endfee.SelectedDate, false);
            }
            if (go.GetPropertyValue("f_premetergasnums") != null)
            {
                kbfe.SetPropertyValue("f_premetergasnums", go.GetPropertyValue("f_premetergasnums").ToString(), false);
            }
            if ( go.GetPropertyValue("f_preamount") != null)
            {
                kbfe.SetPropertyValue("f_preamount", go.GetPropertyValue("f_preamount").ToString(), false);
            }
            if (f_preamount.Text != null && f_preamount.Text != "")
            {
                kbfe.SetPropertyValue("f_newpreamount", f_preamount.Text, false);
            }
            if (go.GetPropertyValue("f_grossproceeds") != null)
            {
                kbfe.SetPropertyValue("f_grossproceeds", go.GetPropertyValue("f_grossproceeds").ToString(), false);
            }
            if (f_grossproceeds.Text != null)
            {
                kbfe.SetPropertyValue("f_newgrossproceeds", f_grossproceeds.Text, false);
            }
            if (go.GetPropertyValue("f_sgoperator") != null)
            {
                kbfe.SetPropertyValue("f_sgoperator", go.GetPropertyValue("f_sgoperator").ToString(), false);
            }
            if (go.GetPropertyValue("f_oldtype") != null)
            {
                kbfe.SetPropertyValue("f_oldtype", go.GetPropertyValue("f_oldtype").ToString(), false);
            }
            if (go.GetPropertyValue("f_payfeevalid") != null)
            {
                kbfe.SetPropertyValue("f_payfeevalid", go.GetPropertyValue("f_payfeevalid").ToString(), false);
            }
            if (f_payfeevalid.SelectedValue != null)
            {
                kbfe.SetPropertyValue("f_newpayfeevalid", f_payfeevalid.SelectedValue, false);
            }
            if (go.GetPropertyValue("f_limitbuygas") != null)
            {
                kbfe.SetPropertyValue("f_limitbuygas", go.GetPropertyValue("f_limitbuygas").ToString(), false);
            }
            if (go.GetPropertyValue("f_gasprice") !=null)
            {
                kbfe.SetPropertyValue("f_gasprice", go.GetPropertyValue("f_gasprice").ToString(), false);
            }
            if(f_gasprice.Text != null && f_gasprice.Text != "")
            {
                kbfe.SetPropertyValue("f_newgasprice", f_gasprice.Text, false);
            }
            if(go.GetPropertyValue("f_repairnum")!=null)
            {
                kbfe.SetPropertyValue("f_repairnum", go.GetPropertyValue("f_repairnum").ToString(), false);
            }
            if (f_repairnum.Text != "" && f_repairnum.Text != null)
            {
                kbfe.SetPropertyValue("f_newrepairnum", f_repairnum.Text, false);
            }
            if (go.GetPropertyValue("f_amountmaintenance") != null)
            {
                kbfe.SetPropertyValue("f_amountmaintenance", go.GetPropertyValue("f_amountmaintenance").ToString(), false);
            }
            if (go.GetPropertyValue("f_totalcost") != null)
            {
                kbfe.SetPropertyValue("f_totalcost", go.GetPropertyValue("f_totalcost").ToString(), false);
            }
            if (f_totalcost.Text != "" && f_totalcost.Text != null)
            {
                kbfe.SetPropertyValue("f_newtotalcost", f_totalcost.Text, false);
            }
            if (go.GetPropertyValue("f_benqizhye") != null)
            {
                kbfe.SetPropertyValue("f_benqizhye", go.GetPropertyValue("f_benqizhye").ToString(), false);
            }
            if (f_benqizhye.Text != "" && f_benqizhye.Text != null)
            {
                kbfe.SetPropertyValue("f_newbenqizhye", f_benqizhye.Text, false);
            }
            if (go.GetPropertyValue("f_zhye")!= null)
            {
                kbfe.SetPropertyValue("f_zhye", go.GetPropertyValue("f_zhye").ToString(), false);
            }
            if (go.GetPropertyValue("f_deliverydate") != null)
            {
                kbfe.SetPropertyValue("f_deliverydate", Convert.ToDateTime( go.GetPropertyValue("f_deliverydate")), false);
            }
            if (f_deliverydate.SelectedDate != null)
            {
                kbfe.SetPropertyValue("f_newdeliverydate", Convert.ToDateTime( f_deliverydate.SelectedDate), false);
            }
            if (go.GetPropertyValue("f_deliverytime") != null)
            {
                kbfe.SetPropertyValue("f_deliverytime", Convert.ToDateTime(go.GetPropertyValue("f_deliverytime")), false);
            }
            if (f_deliverytime.GetSelectedValue() != null)
            {
                kbfe.SetPropertyValue("f_newdeliverytime", f_deliverytime.GetSelectedValue(), false);
            }
            if (f_changedate.SelectedDate != null)
            {
                kbfe.SetPropertyValue("f_changedate", f_changedate.SelectedDate, false);
            }
                kbfe.Name = "t_upkeep";
          kbfe.Completed += kbfe_Completed;

            kbfe.Save();

          
          
        }
 private void ui_SaveStairButton_Click(object sender, RoutedEventArgs e)
 {
     if (count == 1)
     {
         if (ui_stairtype.Text != "" || ui_stair1amount.Text != "" || ui_stair1price.Text != "" || ui_stair2amount.Text != "" || ui_stair2price.Text != "" || ui_stair3amount.Text != "" || ui_stair3price.Text != "" || ui_stairmonths.SelectedValue != null)
         {
             ui_searchBusy.IsBusy = true;
             // 通过执行sql语句进行设置
             string sql = "update t_stairprice set f_stairtype='" + ui_stairtype.Text + "', f_stair1amount=" + ui_stair1amount.Text + " , "+
                 "f_stair1price=" + ui_stair1price.Text + " , f_stair2amount='" + ui_stair2amount.Text + "', f_stair2price=" + ui_stair2price.Text + ",f_stair3amount='" + ui_stair3amount.Text + "', f_stair3price=" + ui_stair3price.Text + ", f_stair4price=" + ui_stair4price.Text + " ,f_stairmonths=" + ui_stairmonths.SelectedValue + " where id=" + ui_id.Text;
             HQLAction action = new HQLAction();
             action.HQL = sql;
             action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
             action.Name = "t_stairprice";
             action.Completed += action_Completed;
             action.Invoke();
         }
         else
         {
             MessageBox.Show("请输入完整信息!");
             return;
         }
     }
     else
     {
         if (ui_stairtype.Text != "" || ui_stair1amount.Text != "" || ui_stair1price.Text != "" || ui_stair2amount.Text != "" || ui_stair2price.Text != "" || ui_stair3amount.Text != "" || ui_stair3price.Text != "" || ui_stairmonths.SelectedValue != null)
         {
             ui_searchBusy.IsBusy = true;
             GeneralObject obj = new GeneralObject();
             obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
             obj.EntityType = "t_stairprice";
             obj.SetPropertyValue("f_stairtype", ui_stairtype.Text, false);
             obj.SetPropertyValue("f_stair1amount", ui_stair1amount.Text, false);
             obj.SetPropertyValue("f_stair1price", ui_stair1price.Text, false);
             obj.SetPropertyValue("f_stair2amount", ui_stair2amount.Text, false);
             obj.SetPropertyValue("f_stair2price", ui_stair2price.Text, false);
             obj.SetPropertyValue("f_stair3amount", ui_stair3amount.Text, false);
             obj.SetPropertyValue("f_stair3price", ui_stair3price.Text, false);
             obj.SetPropertyValue("f_stair4price", ui_stair4price.Text, false);
             obj.SetPropertyValue("f_stairmonths", ui_stairmonths.SelectedValue, false);
             obj.Name = "t_stairprice";
             obj.Completed += obj_Completed;
             obj.Save();
         }
         else
         {
             MessageBox.Show("请输入完整信息!");
             return;
         }
     }
 }
Example #20
0
        // private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#";
        //生成用气地址列表
        public void Invoke()
        {
            State = State.StartLoad;
            this.isBusy = true;
            //楼号
            string startbuild = this.GetPropertyValue("f_startbuild") + "";
            string endbuild = startbuild;
            //结束楼号不为空
            if (this.GetPropertyValue("f_endbuild") + "" != "")
            {
                endbuild = this.GetPropertyValue("f_endbuild") + "";
            }
            //单元
            string startunit = this.GetPropertyValue("f_startunit") + "";
            string endunit = startunit;
            if (this.GetPropertyValue("f_endunit") + "" != "")
            {
                endunit = this.GetPropertyValue("f_endunit") + "";
            }
            //楼层
            string startlayer = this.GetPropertyValue("f_startlayer") + "";
            string endlayer = startlayer;
            if (this.GetPropertyValue("f_endlayer") + "" != "")
            {
                endlayer = this.GetPropertyValue("f_endlayer") + "";
            }
            //房间号
            string startroom = this.GetPropertyValue("f_startroom") + "";
            string endroom = startroom;
            if (this.GetPropertyValue("f_endroom") + "" != "")
            {
                endroom = this.GetPropertyValue("f_endroom") + "";
            }
            //楼号列表
            List<string> builds = GetList(startbuild, endbuild);
            List<string> units = GetList(startunit, endunit);
            List<string> layers = GetList(startlayer, endlayer);
            List<string> rooms = GetList(startroom, endroom);
            ObjectList plans = new ObjectList();
            plans.WebClientInfo = this.WebClientInfo;
            plans.Name = Guid.NewGuid().ToString();

            try
            {
                for (int a = 0; a < builds.Count; a++)
                {
                    for (int b = 0; b < units.Count; b++)
                    {
                        for (int c = 0; c < layers.Count; c++)
                        {

                            for (int d = 0; d < rooms.Count; d++)
                            {
                                    GeneralObject go = new GeneralObject();
                                    go.EntityType = this.EntityType;
                                    go.WebClientInfo = this.WebClientInfo;
                                    go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                                    go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                                    //设置楼号,有模式,按模式设置
                                    string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                                    string str = MatchPattern(builds[a], buildpattern);
                                    go.SetPropertyValue("f_cusDom", str, true);
                                    //设置单元
                                    string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                                    str = MatchPattern(units[b], unitpattern);
                                    go.SetPropertyValue("f_cusDy", str, true);
                                    //设置层
                                    string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                                    str = MatchPattern(layers[c], layerpattern);
                                    go.SetPropertyValue("f_cusFloor", str, true);
                                    //设置每层室
                                    string roompattern = this.GetPropertyValue("f_roompattern") + "";
                                    int  roomInt,endroomInt;
                                    int.TryParse(rooms[d], out roomInt);
                                    int.TryParse(endroom, out endroomInt);
                                    str = MatchPattern((roomInt + endroomInt * c).ToString(), roompattern);
                                    go.SetPropertyValue("f_apartment", str, true);
                                    go.Name = "test";
                                    plans.Add(go);
                            }

                        }

                    }
                }
            }catch(NullReferenceException)
            {
                MessageBox.Show("error");
            }
            finally
            {
                plans.Completed += plans_Completed;
                plans.Save();
            }
        }
        private bool TransformBeforeSave(GeneralObject go)
        {
            if (!go.GetPropertyValue("CONDITION").Equals("正常"))
                return true;
            //必须输入字段
            if (go.GetPropertyValue("CARD_ID").ToString().Length == 0)
            {
                MessageBox.Show("卡号不能为空!");
                return false;
            }
            if (go.GetPropertyValue("USER_NAME").ToString().Length == 0)
            {
                MessageBox.Show("用户名不能为空!");
                return false;
            }
            if (go.GetPropertyValue("TELPHONE").ToString().Length == 0)
            {
                MessageBox.Show("电话号码不能为空!");
                return false;
            }
            if (go.GetPropertyValue("JB_NUMBER").ToString().Length == 0)
            {
                MessageBox.Show("基表读数不能为空!");
                return false;
            }
            //供暖方式
            if (!CheckCombo(go, WARM, WARM_OTHER, "WARM", "请检查供暖方式!"))
                return false;
            //基表厂家型号
            if (!CheckCombo(go, JB_METER_NAME, JB_METER_NAME_OTHER, "JB_METER_NAME", "请检查基表厂家型号!"))
                return false;
            //IC卡表厂家型号
            if (!CheckCombo(go, IC_METER_NAME, IC_METER_NAME_OTHER, "IC_METER_NAME", "请检查IC卡表厂家型号!"))
                return false;
            if (NEEDS_REPAIR.IsChecked.Value && cmbRepair.SelectedItem == null)
            {
                MessageBox.Show("请选择维修人!");
                return false;
            }
            if (NEEDS_REPAIR.IsChecked.Value)
            {
                go.SetPropertyValue("NEEDS_REPAIR", "是", true);
                GeneralObject mechanic = cmbRepair.SelectedItem as GeneralObject;
                go.SetPropertyValue("REPAIRMAN", mechanic.GetPropertyValue("REPAIRMAN"), true);
                go.SetPropertyValue("REPAIRMAN_ID", mechanic.GetPropertyValue("REPAIRMAN_ID"), true);
            }
            else
            {
                go.SetPropertyValue("NEEDS_REPAIR", "否", true);
                go.SetPropertyValue("REPAIRMAN", null, true);
                go.SetPropertyValue("REPAIRMAN_ID", null, true);
            }

            ObjectList lines = new ObjectList();
            //燃气表隐患,必选一个,也可多选
            if (!FillPrecautionsAccordingToChoices(MeterDefectsPane, go, lines, true, false, "燃气表"))
                return false;
            go.SetPropertyValue("RQB", RQB.IsChecked.Value?"正常":"不正常", true);
            //立管隐患
            if (!FillPrecautionsAccordingToChoices2(PlumbingDefectsPane, go, lines, true, false, "立管"))
                return false;
            go.SetPropertyValue("STANDPIPE", STANDPIPE.IsChecked.Value ? "正常" : "不正常", true);
            //严密性测试
            if (cbRIGIDITYNormal.IsChecked.Value)
                go.SetPropertyValue("RIGIDITY", "正常", true);
            else
                go.SetPropertyValue("RIGIDITY", "不正常", true);
            if (cbRIGIDITYLeakage.IsChecked.Value)
                go.SetPropertyValue("RIGIDITY", "漏气", true);
            //静止压力
            if (cbPressureAbnormal.IsChecked.Value && cbPressureNormal.IsChecked.Value)
            {
                MessageBox.Show("请检查静止选项!");
                return false;
            }
            if(cbPressureNormal.IsChecked.Value)
                go.SetPropertyValue("STATIC", "正常", true);
            else if (cbPressureAbnormal.IsChecked.Value)
                go.SetPropertyValue("STATIC", "不正常", true);
            else
                go.SetPropertyValue("STATIC", "", true);
            //表前阀
            if (!FillPrecautionsAccordingToChoices(PlumbingMeterValvePane, go, lines, true, false, "阀门表前阀"))
                return false;
            go.SetPropertyValue("TABLE_TAP", TABLE_TAP.IsChecked.Value ? "正常" : "不正常", true);
            //灶前阀
            if (!FillPrecautionsAccordingToChoices(PlumbingCookerValvePane, go, lines, true, true, "阀门灶前阀"))
                return false;
            go.SetPropertyValue("COOK_TAP", COOK_TAP.IsChecked.Value ? "正常" : "不正常", true);
            //自闭阀
            if (!FillPrecautionsAccordingToChoices(PlumbingAutomaticValvePane, go, lines, true, true, "阀门自闭阀"))
                return false;
            go.SetPropertyValue("CLOSE_TAP", CLOSE_TAP.IsChecked.Value ? "正常" : "不正常", true);
            //户内管
            if (!FillPrecautionsAccordingToChoices(PlumbingPipePane, go, lines, true, true, "户内管"))
                return false;
            go.SetPropertyValue("INDOOR", INDOOR.IsChecked.Value ? "正常" : "不正常", true);
            //漏气
            if (cbLEAKAGE_COOKER.IsChecked.Value)
                go.SetPropertyValue("LEAKAGE_COOKER", "灶具漏气", true);
            else
                go.SetPropertyValue("LEAKAGE_COOKER", "", true);
            if (cbLEAKAGE_HEATER.IsChecked.Value)
                go.SetPropertyValue("LEAKAGE_HEATER", "热水器漏气", true);
            else
                go.SetPropertyValue("LEAKAGE_HEATER", "", true);
            if (cbLEAKAGE_BOILER.IsChecked.Value)
                go.SetPropertyValue("LEAKAGE_BOILER", "壁挂炉漏气", true);
            else
                go.SetPropertyValue("LEAKAGE_BOILER", "", true);
            if (cbLEAKAGE_NOTIFIED.IsChecked.Value)
                go.SetPropertyValue("LEAKAGE_NOTIFIED", "安检告知", true);
            else
                go.SetPropertyValue("LEAKAGE_NOTIFIED", "", true);
            //灶具软管
            if (!FillPrecautionsAccordingToChoices(CookerPipePane, go, lines, false, true, "灶具软管"))
                return false;
            go.SetPropertyValue("COOKPIPE_NORMAL", COOKPIPE_NORMAL.IsChecked.Value ? "正常" : "不正常", true);
            //热水器软管
            if (!FillPrecautionsAccordingToChoices(BoilerPipePane, go, lines, false, true, "热水器软管"))
                return false;
            go.SetPropertyValue("WATER_PIPE", WATER_PIPE.IsChecked.Value ? "正常" : "不正常", true);
            //热水器隐患
            if (!FillPrecautionsAccordingToChoices(BoilerDefectsPane, go, lines, false, true, "热水器安全隐患"))
                return false;
            go.SetPropertyValue("WATER_HIDDEN", WATER_HIDDEN.IsChecked.Value ? "正常" : "不正常", true);
            //壁挂锅炉安全隐患
            if (!FillPrecautionsAccordingToChoices(WHEDefectsPane, go, lines, false, true, "壁挂锅炉安全隐患"))
                return false;
            go.SetPropertyValue("WHE_HIDDEN", WHE_HIDDEN.IsChecked.Value ? "正常" : "不正常", true);
            //安全隐患
            if (!FillPrecautionsAccordingToChoices(precautionCheckPane, go, lines, false, false, "安全隐患"))
                return false;

            go.SetPropertyValue("LINES", lines, true);
            return true;
        }
 private bool CheckCombo(GeneralObject go, ComboBox cbox, TextBox other, string key, string msg)
 {
     ObjectCollection oc = Resources[key] as ObjectCollection;
     if (cbox.SelectedValue.Equals((oc.ElementAt(oc.Count - 1) as Pair).CName))
     {
         if (other.Text.Trim().Length == 0)
         {
             MessageBox.Show(msg);
             return false;
         }
         else
         {
             go.SetPropertyValue(key, other.Text.Trim(), true);
         }
     }
     else
         go.SetPropertyValue(key, cbox.SelectedValue, true);
     return true;
 }
 void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         JsonArray items = JsonValue.Parse(e.Result) as JsonArray;
         ObjectList list = new ObjectList();
         list.EntityType = "T_INSPECTION_LINE";
         foreach(JsonObject row in items)
         {
             GeneralObject go = new GeneralObject();
             go.EntityType = "T_INSPECTION_LINE";
             go.SetPropertyValue("precaution", row["precaution"], true);
             go.SetPropertyValue("road", row["road"], true);
             go.SetPropertyValue("unit_name", row["unit_name"], true);
             go.SetPropertyValue("cus_dom", row["cus_dom"], true);
             go.SetPropertyValue("cus_dy", row["cus_dy"], true);
             go.SetPropertyValue("cus_floor", row["cus_floor"], true);
             go.SetPropertyValue("cus_room", row["cus_room"], true);
             go.SetPropertyValue("user_name", row["user_name"], true);
             go.SetPropertyValue("telphone", row["telphone"], true);
             go.SetPropertyValue("departure_time", row["departure_time"], true);
             go.SetPropertyValue("precaution_notified", row["precaution_notified"], true);
             go.SetPropertyValue("sn", row["sn"], true);
             list.Add(go);
         }
         paperGrid.ItemsSource = list;
     }
 }
 private GeneralObject CreateALine(GeneralObject go)
 {
     GeneralObject me = new GeneralObject();
     me.EntityType = "T_INSPECTION_LINE";
     me.SetPropertyValue("CARD_ID", go.GetPropertyValue("CARD_ID"), true);
     me.SetPropertyValue("USER_NAME", go.GetPropertyValue("USER_NAME"), true);
     me.SetPropertyValue("ROAD", go.GetPropertyValue("ROAD"), true);
     me.SetPropertyValue("UNIT_NAME", go.GetPropertyValue("UNIT_NAME"), true);
     me.SetPropertyValue("CUS_DOM", go.GetPropertyValue("CUS_DOM"), true);
     me.SetPropertyValue("CUS_DY", go.GetPropertyValue("CUS_DY"), true);
     me.SetPropertyValue("CUS_FLOOR", go.GetPropertyValue("CUS_FLOOR"), true);
     me.SetPropertyValue("CUS_ROOM", go.GetPropertyValue("CUS_ROOM"), true);
     me.SetPropertyValue("TELPHONE", go.GetPropertyValue("TELPHONE"), true);
     me.SetPropertyValue("SAVE_PEOPLE", go.GetPropertyValue("SAVE_PEOPLE"), true);
     me.SetPropertyValue("SAVE_DATE", go.GetPropertyValue("SAVE_DATE"), true);
     me.SetPropertyValue("IC_METER_NAME", go.GetPropertyValue("IC_METER_NAME"), true);
     me.SetPropertyValue("JB_METER_NAME", go.GetPropertyValue("JB_METER_NAME"), true);
     me.SetPropertyValue("JB_NUMBER", go.GetPropertyValue("JB_NUMBER"), true);
     me.SetPropertyValue("SURPLUS_GAS", go.GetPropertyValue("SURPLUS_GAS"), true);
     return me;
 }
        void dansearch_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            //有错误
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
            }
            else
            {

                //把数据转换成JSON
                JsonArray items = JsonValue.Parse(e.Result) as JsonArray;

                daninfos.ItemsSource = list;
                if(list.Size!=0)
                {
                    list.Clear();
                }
                foreach (JsonObject json in items)
                {
                    GeneralObject go = new GeneralObject();
                    try
                    {
                        go.EntityType = "t_handplan";



                        string f_userid = (string)json["f_userid"];//用户编号
                        go.SetPropertyValue("f_userid", f_userid, false);
                        string f_username = (string)json["f_username"];//用户名
                        go.SetPropertyValue("f_username", f_username, false);
                        string f_address = (string)json["f_address"];//地址
                        go.SetPropertyValue("f_address", f_address, false);
                        decimal lastinputgasnum = (decimal)json["lastinputgasnum"];//上期指数
                        go.SetPropertyValue("lastinputgasnum", lastinputgasnum, false);
                        list.Add(go);
                    }
                    catch (Exception ex)
                    {
                        ui_handBusy.IsBusy = false;
                        MessageBox.Show("用户:"+go.GetPropertyValue("f_userid")+"抄表数据有问题,请核查!");
                        MessageBox.Show(ex.ToString() + "" + go.GetPropertyValue("f_userid"));
                        return;
                    }
                }
            }
            ui_handBusy.IsBusy = false;
        }
        void userfiles_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            kbsellgasbusy.IsBusy = false;
            busy.IsBusy = false;

            if (e.Error != null)
            {
                MessageBox.Show("查询失败,链接错误!");
                return;
            }

            //把数据转换成JSON
            JsonObject item = JsonValue.Parse(e.Result) as JsonObject;
            if (item.ContainsKey("error"))
            {
                string error = item["error"];
                MessageBox.Show("查询失败:" + error);
                busy.IsBusy = false;
                return;
            }
            //把用户数据写到交费界面上
            ui_username.Text = (string)item["f_username"];
            ui_usertype.Text = (string)item["f_usertype"];
            ui_districtname.Text = (string)item["f_districtname"];
            ui_gasproperties.Text = (string)item["f_gasproperties"];
            ui_stairpricetype.Text = (string)item["f_stairtype"];
            zhye.Text = item["f_zhye"].ToString();
            ui_address.Text = (string)item["f_address"];
            //ui_gaspricetype.Text = (String)item["f_gaspricetype"];
            ui_userid.Text = (string)item["infoid"];
            zhe.Text=item["f_zherownum"].ToString();
            //ui_dibaohu.IsChecked = item["f_dibaohu"].ToString().Equals("1");
            ui_userstate.Text = (string)item["f_userstate"];
            ui_paytype.Text = (string)item["f_payment"];
            // ui_gasprice.Text = item["f_gasprice"].ToString();

            //把欠费数据插入到欠费表中
            ObjectList list = new ObjectList();

            // 当前正在处理的表号
            String currentId = "";
            // 总的上期指数
            decimal lastnum = 0;
            // 总气量
            decimal gasSum = 0;
            // 总气费
            decimal feeSum = 0;
            //总的滞纳金
            decimal zhinajinAll = 0;
            //余额
            decimal f_zhye = decimal.Parse(item["f_zhye"].ToString());

            JsonArray bills = item["f_hands"] as JsonArray;
            foreach (JsonObject json in bills)
            {
                GeneralObject go = new GeneralObject();
                go.EntityType = "t_handplan";

                //默认选中
                go.IsChecked = true;

                //上期指数
                decimal lastinputgasnum = (decimal)json["lastinputgasnum"];
                go.SetPropertyValue("lastinputgasnum", lastinputgasnum, false);
                string f_userid = (string)json["f_userid"];
                go.SetPropertyValue("f_userid", f_userid, false);
                // 如果表号变了
                if (!f_userid.Equals(currentId))
                {
                    currentId = f_userid;
                    lastnum += lastinputgasnum;
                }

                //计算总金额
                decimal oughtfee = (decimal)json["oughtfee"];
                go.SetPropertyValue("oughtfee", oughtfee, false);
                feeSum += oughtfee;
                // 计算总气量
                decimal oughtamount = (decimal)json["oughtamount"];
                gasSum += oughtamount;
                go.SetPropertyValue("oughtamount", oughtamount, false);
                int id = (int)json["id"];
                go.SetPropertyValue("id", id, false);
                //计算总滞纳金
                decimal f_zhinajin = (decimal)json["f_zhinajin"];
                zhinajinAll += f_zhinajin;
                go.SetPropertyValue("f_zhinajin", f_zhinajin, true);
                go.SetPropertyValue("lastinputdate", DateTime.Parse(json["lastinputdate"]), false);
                go.SetPropertyValue("lastrecord", (decimal)json["lastrecord"], false);
                go.SetPropertyValue("f_endjfdate", DateTime.Parse(json["f_endjfdate"]), false);
                go.SetPropertyValue("f_zhinajintianshu", (int)json["days"], false);
                go.SetPropertyValue("f_network", (string)json["f_network"], false);
                go.SetPropertyValue("f_operator", (string)json["f_operator"], false);
                go.SetPropertyValue("f_inputdate", DateTime.Parse(json["f_inputdate"]), false);
                go.SetPropertyValue("f_userid", (string)json["f_userid"], false);

                go.SetPropertyValue("f_stair1amount", (decimal)json["f_stair1amount"], false);
                go.SetPropertyValue("f_stair1price", (decimal)json["f_stair1price"], false);
                go.SetPropertyValue("f_stair1fee", (decimal)json["f_stair1fee"], false);

                go.SetPropertyValue("f_stair2amount", (decimal)json["f_stair2amount"], false);
                go.SetPropertyValue("f_stair2price", (decimal)json["f_stair2price"], false);
                go.SetPropertyValue("f_stair2fee", (decimal)json["f_stair2fee"], false);

                go.SetPropertyValue("f_stair3amount", (decimal)json["f_stair3amount"], false);
                go.SetPropertyValue("f_stair3price", (decimal)json["f_stair3price"], false);
                go.SetPropertyValue("f_stair3fee", (decimal)json["f_stair3fee"], false);
                go.SetPropertyValue("number", (decimal)json["number"], false);

                list.Add(go);
            }
            dataGrid1.ItemsSource = list;
            // 计算出来的总气量等放到用户界面上
            ui_pregas.Text = gasSum.ToString("0.#");//总气量
            ui_lastinputgasnum.Text = lastnum.ToString("0.#");//总上期底数
            ui_lastrecord.Text = (lastnum + gasSum).ToString("0.#");//总本期底数
            ui_zhinajin.Text = zhinajinAll.ToString("0.##");//总滞纳金
            ui_linshizhinajin.Text = zhinajinAll.ToString("0.##");//滞纳金
            ui_preamount.Text = feeSum.ToString("0.##");//气费金额
            decimal f_totalcost = feeSum - f_zhye + zhinajinAll > 0 ? feeSum - f_zhye + zhinajinAll : 0;
            ui_totalcost.Text = f_totalcost.ToString("0.##");//应缴金额
            decimal f_benqizhye = (decimal)(f_zhye - feeSum - zhinajinAll > 0 ? f_zhye - feeSum - zhinajinAll : 0);
            ui_benqizhye.Text = f_benqizhye.ToString("0.##");//本期结余
            shoukuan.Text = f_totalcost.ToString("0.##");
        }