隔壁司机老王

微博:i王YOU

导航

WPF 开发备忘录

运营日:

select t.*
   from (select ab.*, bs.station_cn_name, bd.device_name
           from audit_tvm_cash_detail ab
           left join basi_station_info bs
             on ab.station_id = bs.station_id
           left join basi_dev_info bd
             on ab.device_id = bd.device_id
          where bd.device_type = '02') t, report_requirement_info r
  where t.run_date = r.run_date
  order by t.station_id,
           t.device_id,
           t.run_date,
           t.audit_date,
           t.audit_time)

;f:datetime -时间日期格式

;f:fen            -表示单价分

--

在查询结果后面增加一行自定义数据

union all
select distinct ' ' as name, a from v


instr(字段,'关键字')>0

例如 like %关键字%   等同于  instr(字段,'关键字')>0 


ComboBox 静态值绑定
No.1
[数据字典方式]
-----
#>前台代码:
<ComboBox Name="name" ItemsSource="{Binding}" />

#>后台代码:
public MainWindow()
{
     InitializeComponent();
     Dictionary<int, string> mydic = new Dictionary<int, string>()
     {
         {1,"a"},
         {2,"b"},
         {3,"c"}
     };
     combobox.ItemsSource = mydic;
     combobox.SelectedValuePath = "Key";
     combobox.DisplayMemberPath = "Value";
     payId.SelectedIndex = 0;
}


No.1
[增加一项]
-----
#>VM代码:
public List<BasiStationInfo> StationInfo { get; private set; }
public void GetStationInfo()
     {
         string line_id = SysConfig.GetSysConfig().LocalParamsConfig.LineCode;
         string sql = string.Format("select * from basi_station_info where line_id='{0}'", line_id);
         StationInfo = DBCommon.Instance.GetTModelValue<BasiStationInfo>(sql);
         BasiStationInfo info = new BasiStationInfo();
         info.station_id = "0000";
         info.station_cn_name = "全部车站";
         StationInfo.Insert(0, info);
     }
    
No.2   
-----
#>VM代码:
public List<BasiStationInfo> StationInfo { get; private set; }

string sqlStation = "select * from basi_station_info t ";
         this.StationInfo = DBCommon.Instance.GetTModelValue<BasiStationInfo>(sqlStation);
         if (this.StationInfo == null)
             this.StationInfo = new List<BasiStationInfo>();
         this.StationInfo.Insert(0, new BasiStationInfo() { station_id = "全部车站", station_cn_name = "全部车站" });
         this.station_id = "全部车站";
        
No.3
[代码示例]
-----
#>VM代码:   
private List<ModeCodeInfo> modeInfo;
         /// <summary>
         /// 发起方
         /// </summary>
         public List<ModeCodeInfo> ModeInfo
         {
             get { return modeInfo; }
             set { modeInfo = value; NotifyPropertyChanged("ModeInfo"); }
         }
         public void GetModeInfo()
         {
             this.ModeInfo.Clear();
             this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "全部", set_origin = "全部" });
             this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "FAS", set_origin = "1" });
             this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "SC", set_origin = "2" });
             this.SetOriginID = "全部";
         }
        
#>Model代码:
public class ModeCodeInfo
     {
         private string _set_origin;
         /// <summary>
         /// 发起方
         /// </summary>
         public string set_origin
         {
             get { return _set_origin; }
             set { _set_origin = value; NotifyPropertyChanged("set_origin"); }
         }

        private string _set_origin_id;
         /// <summary>
         /// 发起方名称
         /// </summary>
         public string set_origin_id
         {
             get { return _set_origin_id; }
             set { _set_origin_id = value; NotifyPropertyChanged("set_origin_id"); }
         }

        public override string ToString()
         {
             return set_origin_id;
         }
     }

image



posted on 2017-10-23 13:16  隔壁司机老王  阅读(235)  评论(0编辑  收藏  举报