Ejemplo n.º 1
0
        private void OnModifyMod()
        {
            DBAccess.BLL.BatteryModuleBll     modBll = new DBAccess.BLL.BatteryModuleBll();
            DBAccess.Model.BatteryModuleModel mod    = modBll.GetModel(this.textBoxMod.Text);
            if (mod == null)
            {
                MessageBox.Show(string.Format("模块{0}不存在", this.textBoxMod.Text));
                return;
            }
            int switchLineNo = int.Parse(this.cbxSwitchLine.Text);

            string[]      modExistArray = GetSwitchLineMods(switchLineNo);
            string        modSel        = this.listBoxMod.SelectedItem.ToString();
            List <string> modList       = new List <string>(modExistArray);
        }
Ejemplo n.º 2
0
        private void OnAddMod()
        {
            string strModtoAdd = this.textBoxMod.Text;

            if (string.IsNullOrWhiteSpace(strModtoAdd))
            {
                return;
            }
            DBAccess.BLL.BatteryModuleBll     modBll = new DBAccess.BLL.BatteryModuleBll();
            DBAccess.Model.BatteryModuleModel mod    = modBll.GetModel(strModtoAdd);
            if (mod == null)
            {
                MessageBox.Show(string.Format("模块{0}不存在", strModtoAdd));
                return;
            }

            int switchLineNo = int.Parse(this.cbxSwitchLine.Text);

            string[] modExistArray = GetSwitchLineMods(switchLineNo);

            List <string> modList = new List <string>(modExistArray);

            if (modList.Contains(strModtoAdd))
            {
                MessageBox.Show(string.Format("模块{0}已经在分档线{1}", strModtoAdd, switchLineNo));
                return;
            }
            int insertPos = 0;

            if (this.listBoxMod.SelectedItem != null)
            {
                insertPos = this.listBoxMod.SelectedIndex + 1;
                modList.Insert(insertPos, strModtoAdd);
            }
            else
            {
                modList.Add(strModtoAdd);
            }
            if (UpdateSwitchLineMods(switchLineNo, modList.ToArray()))
            {
                MessageBox.Show("增加模块成功");
            }
            else
            {
                MessageBox.Show("增加模块失败");
            }
        }