コード例 #1
0
        private void btn_save_Click(object sender, RoutedEventArgs e)
        {
            string trcode  = tb_code.Text;
            string rackid  = cb_rack.SelectedValue.ToString();
            string trcount = cb_layercount.Text;

            if (layerId == 0)
            {
                RackLayerInfo trInfo = new RackLayerInfo()
                {
                    Createtime = DateTime.Now,
                    IsValid    = 1,
                    Updatetime = DateTime.Now
                };
                trInfo.RackLayerCode = trcode;
                trInfo.RackLayerNum  = Convert.ToInt32(trcount);
                trInfo.RackId        = Convert.ToInt32(rackid);
                x_rkService.Insert(trInfo);
            }
            else
            {
                x_rkService.Update(() => new RackLayerInfo()
                {
                    RackLayerCode = trcode, RackLayerNum = Convert.ToInt32(trcount), RackId = Convert.ToInt32(rackid)
                }, a => a.ID == layerId);
            }
            tb_code.Text = "";
            MsgBox.Show("保存成功");
            if (win_rklIndex != null && win_rklIndex.IsVisible)
            {
                win_rklIndex.InitData();
            }
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button btn = e.Source as Button;
            int    id  =  Convert.ToInt32(btn.Tag);

            if (rlIndex != null && rlIndex.IsVisible)
            {
                rlIndex.Show();
                rlIndex.Activate();
                rlIndex.WindowState = System.Windows.WindowState.Normal;
                rlIndex.RackId      = id;
                rlIndex.InitData();
            }
            else
            {
                rlIndex        = new RackLayerIndex();
                rlIndex.RackId = id;
                rlIndex.Show();
            }
        }