Example #1
0
        private void BtnItemSave_Click(object sender, RoutedEventArgs e)
        {
            //TreeListNode item = tvMain.SelectedItem as TreeListNode;
            //if ((item == null) || (item.Tag.ToString() == ""))
            //{
            //    gridItem.ItemsSource = null;
            //    return;
            //}
            //SysEnumMain m_SysEnumMain = item.Tag as SysEnumMain;

            SysEnumMain m_SysEnumMain = tvMain.SelectedItem as SysEnumMain;

            if ((m_SysEnumMain == null) || (string.IsNullOrEmpty(m_SysEnumMain.PKNO)))
            {
                return;
            }

            SysEnumItems m_SysEnumItems = gbItem.DataContext as SysEnumItems;

            if (m_SysEnumItems == null)
            {
                return;
            }

            #region  校验

            if (string.IsNullOrEmpty(m_SysEnumItems.ITEM_NAME))
            {
                Brush oldBrush = this.tbItemName.BorderBrush;
                this.tbItemName.BorderBrush = Brushes.Red;
                System.Windows.Forms.MessageBox.Show("请输入明细名称。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.tbItemName.BorderBrush = oldBrush;
                return;
            }

            #endregion

            if (string.IsNullOrEmpty(m_SysEnumItems.PKNO)) //新增
            {
                m_SysEnumItems.PKNO = Guid.NewGuid().ToString("N");

                ws.UseService(s => s.AddSysEnumItems(m_SysEnumItems));

                //重新刷新数据
                List <SysEnumItems> mSysEnumItemses =
                    ws.UseService(s => s.GetSysEnumItemss($"ENUM_IDENTIFY = {m_SysEnumMain.ENUM_IDENTIFY} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.ITEM_INDEX)
                    .ToList();
                gridItem.ItemsSource = mSysEnumItemses;
            }
            else  //修改
            {
                ws.UseService(s => s.UpdateSysEnumItems(m_SysEnumItems));
            }
            //提示保存成功

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Example #2
0
        private void BtnItemAdd_Click(object sender, RoutedEventArgs e)
        {
            //TreeListNode item = tvMain.SelectedItem as TreeListNode;
            //if ((item == null) || (item.Tag.ToString() == ""))
            //{
            //    gridItem.ItemsSource = null;
            //    return;
            //}
            //SysEnumMain m_SysEnumMain = item.Tag as SysEnumMain;

            SysEnumMain m_SysEnumMain = tvMain.SelectedItem as SysEnumMain;

            if ((m_SysEnumMain == null) || (string.IsNullOrEmpty(m_SysEnumMain.PKNO)))
            {
                return;
            }

            if (CBaseData.LoginNO != CBaseData.ADMINPKNO)
            {
                if ((m_SysEnumMain.ENUM_STATE == 2) || (m_SysEnumMain.ENUM_STATE == 3))
                {
                    System.Windows.Forms.MessageBox.Show("非管理员不能更改该基础信息明细信息", "维护明细信息", MessageBoxButtons.OK,
                                                         MessageBoxIcon.Information);
                    return;
                }
            }

            #region 动画效果

            //dictBasic.Header = "基础信息明细项  【新增】";
            //TranslateTransform tt = new TranslateTransform();
            //DoubleAnimation da = new DoubleAnimation();
            ////动画时间
            //Duration duration = new Duration(TimeSpan.FromSeconds(1));
            ////设置按钮的转换效果
            //gbItem.RenderTransform = tt;
            //tt.Y = 200;
            //da.To = 0;
            //da.SpeedRatio = 1.3;
            //da.By = 0.5;
            //// da.Duration = duration;
            //tt.BeginAnimation(TranslateTransform.YProperty, da);

            #endregion

            //添加明细
            dictBasic.Header   = "基础信息明细项  【新增】";
            gbItem.IsCollapsed = false;
            gbItem.Visibility  = Visibility.Visible;

            SysEnumItems m_SysEnumItems = new SysEnumItems()
            {
                COMPANY_CODE  = "",
                ENUM_IDENTIFY = m_SysEnumMain.ENUM_IDENTIFY,  //基础信息标识
                ITEM_INDEX    = gridItem.VisibleRowCount,
                ITEM_TYPE     = 0,
                USE_FLAG      = 1,
            };
            gbItem.DataContext = m_SysEnumItems;
        }
Example #3
0
        private void TextBoxBase_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            SysEnumItems item = cmbTypeBasic.SelectedItem as SysEnumItems;

            if (item == null)
            {
                return;
            }

            SysEnumItems item2 = cmbTypeSpecified.SelectedItem as SysEnumItems;

            if (item2 == null)
            {
                return;
            }

            TmsToolsType m_TmsToolsType = gbItem.DataContext as TmsToolsType;

            if (m_TmsToolsType == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(m_TmsToolsType.PKNO))
            {
                string typeCode = "T" + item.ITEM_CODE + item2.ITEM_CODE +
                                  m_TmsToolsType.TOOLS_TYPE_PARAM + m_TmsToolsType.TOOLS_TYPE_ASSIST;

                //tbTypeCode
                m_TmsToolsType.TOOLS_TYPE_CODE = typeCode;

                gbItem.DataContext = m_TmsToolsType;
            }
        }
Example #4
0
        /// <summary>
        /// 保存 自学习情况
        /// </summary>
        public void Save()
        {
            if (string.IsNullOrEmpty(this.Text) || string.IsNullOrEmpty(this.Value) || (EnumType != 1)) //不自学习
            {
                return;
            }
            ComboBoxItem select = SelectedItem as ComboBoxItem;

            if (select != null) //是选择的下拉框,则不需要自学习
            {
                return;
            }
            try
            {
                if (ws == null)
                {
                    ws = new WcfClient <ISDMService>();
                }

                #region   照Value自学习

                string       sValue = "";//this.Value;
                string       sName  = this.Text;
                string       sNO    = this.Text;
                SysEnumItems item   = new SysEnumItems()
                {
                    PKNO             = CBaseData.NewGuid(),
                    COMPANY_CODE     = "",
                    CREATED_BY       = CBaseData.LoginName,
                    CREATION_DATE    = DateTime.Now,
                    LAST_UPDATE_DATE = DateTime.Now,  //最后修改日期
                    ENUM_IDENTIFY    = this.EnumIdentify,
                    USE_FLAG         = 1,
                    ITEM_CODE        = "",
                    ITEM_NAME        = sName,
                    ITEM_NO          = sNO,
                    ITEM_INDEX       = this.Items.Count,
                };
                ws.UseService(s => s.AddSysEnumItems(item));

                sValue = item.ITEM_NAME;

                ComboBoxItem comboBoxItem = new ComboBoxItem()
                {
                    Content = this.Text,
                    Tag     = sValue,
                };
                this.Items.Add(comboBoxItem);
                this.SelectedIndex = this.Items.Count - 1;
                this.SelectedItem  = comboBoxItem;

                #endregion
            }
            catch (Exception ex)
            {
                // ignored
                Console.WriteLine("error:BasicItemCombox.Save " + ex.Message);
            }
        }
Example #5
0
 /// <summary>
 /// 根据关键字段的值获取记录
 /// </summary>
 /// <param name="Id">关键字段的值</param>
 /// <returns>符合查询条件的记录</returns>
 public SysEnumItems GetSysEnumItemsById(string Id)
 {
     using (ISysEnumItemsBLL SysEnumItemsBLL = BLLContainer.Resolve <ISysEnumItemsBLL>())
     {
         SysEnumItems model = SysEnumItemsBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Example #6
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="mSysEnumItems">模型</param>
 /// <returns>是否成功</returns>
 public bool UpdateSysEnumItems(SysEnumItems mSysEnumItems)
 {
     if (mSysEnumItems == null)
     {
         return(false);
     }
     using (ISysEnumItemsBLL SysEnumItemsBLL = BLLContainer.Resolve <ISysEnumItemsBLL>())
     {
         return(SysEnumItemsBLL.Update(mSysEnumItems));
     }
 }
Example #7
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Id">关键字段</param>
 /// <returns>是否成功</returns>
 public bool DelSysEnumItems(string Id)
 {
     using (ISysEnumItemsBLL SysEnumItemsBLL = BLLContainer.Resolve <ISysEnumItemsBLL>())
     {
         try
         {
             SysEnumItems item = SysEnumItemsBLL.GetFirstOrDefault(Id);
             return(SysEnumItemsBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Example #8
0
        private void BtnItemDel_Click(object sender, RoutedEventArgs e)
        {
            //TreeListNode item = tvMain.SelectedItem as TreeListNode;
            //if ((item == null) || (item.Tag.ToString() == ""))
            //{
            //    gridItem.ItemsSource = null;
            //    return;
            //}
            //SysEnumMain m_SysEnumMain = item.Tag as SysEnumMain;

            SysEnumMain m_SysEnumMain = tvMain.SelectedItem as SysEnumMain;

            if ((m_SysEnumMain == null) || (string.IsNullOrEmpty(m_SysEnumMain.PKNO)))
            {
                return;
            }
            if (CBaseData.LoginNO != CBaseData.ADMINPKNO)
            {
                if ((m_SysEnumMain.ENUM_STATE == 2) || (m_SysEnumMain.ENUM_STATE == 3))
                {
                    System.Windows.Forms.MessageBox.Show("非管理员不能更改该基础信息明细信息", "维护明细信息", MessageBoxButtons.OK,
                                                         MessageBoxIcon.Information);
                    return;
                }
            }
            //删除明细
            SysEnumItems m_SysEnumItems = gridItem.SelectedItem as SysEnumItems;

            if (m_SysEnumItems == null)
            {
                return;
            }

            if (System.Windows.Forms.MessageBox.Show($"确定删除基础信息【{m_SysEnumItems.ITEM_NAME}】吗?",
                                                     @"删除信息",
                                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                ws.UseService(s => s.DelSysEnumItems(m_SysEnumItems.PKNO));

                //删除成功.
                List <SysEnumItems> mSysEnumItemses =
                    ws.UseService(s => s.GetSysEnumItemss($"ENUM_IDENTIFY = {m_SysEnumMain.ENUM_IDENTIFY} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.ITEM_INDEX)
                    .ToList();
                gridItem.ItemsSource = mSysEnumItemses;

                BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
            }
        }
Example #9
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Ids">关键字段数组</param>
 /// <returns>是否成功</returns>
 public bool DelSysEnumItemss(string[] Ids)
 {
     using (ISysEnumItemsBLL SysEnumItemsBLL = BLLContainer.Resolve <ISysEnumItemsBLL>())
     {
         try
         {
             List <SysEnumItems> entitys = new List <SysEnumItems>();
             foreach (string id in Ids)
             {
                 SysEnumItems item = SysEnumItemsBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(SysEnumItemsBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }