Beispiel #1
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButtonConfirm_Click(object sender, EventArgs e)
        {
            WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);

            waitForm.Show();
            if (string.IsNullOrEmpty(textEditGroupName.Text) || string.IsNullOrEmpty(textEditGroupName.Text.Trim()))
            {
                waitForm.Close();
                XtraMessageBox.Show("请输入单位组名称!", Constants.SYSTEM_PROMPT);
                return;
            }
            stockUnitGroup.StockUnitGroupName = textEditGroupName.Text;
            stockUnitGroup.Remark             = memoRemark.Text;
            if (StockUnitGroupService.UpdateStockUnitGroup(stockUnitGroup) == ReturnType.Success)
            {
                waitForm.Close();
                XtraMessageBox.Show("更新成功!", "系统提示", MessageBoxButtons.OK);
            }
            else
            {
                waitForm.Close();
                XtraMessageBox.Show("更新失败!", "系统提示", MessageBoxButtons.OK);
            }
            this.Close();
            this.DialogResult = DialogResult.OK;
        }
Beispiel #2
0
        private void InitGroupUnit()
        {
            comboBoxGroup.Properties.Items.Clear();
            List <StockUnitGroup> groupList = StockUnitGroupService.GetAllStockUnitGroup();

            if (groupList == null)
            {
                return;
            }
            int index = 0;
            SortedList <int, SortedList <string, string> > tag = new SortedList <int, SortedList <string, string> >();

            foreach (StockUnitGroup group in groupList)
            {
                comboBoxGroup.Properties.Items.Add(group.StockUnitGroupName);
                SortedList <string, string> value = new SortedList <string, string>();
                value.Add(group.StockUnitGroupCode, group.BaseUnit);
                tag.Add(index, value);
                index++;
            }
            comboBoxGroup.Tag = tag;
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);

            waitForm.Show();
            try
            {
                #region 验证
                if (string.IsNullOrEmpty(textEditGroupName.Text) || string.IsNullOrEmpty(textEditGroupName.Text.Trim()))
                {
                    waitForm.Close();
                    XtraMessageBox.Show("请输入单位组名称!", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textEditGroupName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(textEditBaseUnitName.Text) || string.IsNullOrEmpty(textEditBaseUnitName.Text.Trim()))
                {
                    waitForm.Close();
                    XtraMessageBox.Show("请输入基本单位名称!", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textEditBaseUnitName.Focus();
                    return;
                }

                #endregion

                StockUnitGroup           sug  = new StockUnitGroup();
                Alading.Entity.StockUnit unit = new Alading.Entity.StockUnit();
                /*基本单位编码*/
                if (string.IsNullOrEmpty(textEditBaseUnitCode.Text) || string.IsNullOrEmpty(textEditBaseUnitCode.Text.Trim()))
                {
                    unit.StockUnitCode = System.Guid.NewGuid().ToString();
                }
                else
                {
                    unit.StockUnitCode = textEditBaseUnitCode.Text;
                }

                /*单位组编码*/
                if (string.IsNullOrEmpty(textEditGroupCode.Text) || string.IsNullOrEmpty(textEditGroupCode.Text.Trim()))
                {
                    sug.StockUnitGroupCode = System.Guid.NewGuid().ToString();
                }
                else
                {
                    sug.StockUnitGroupCode = textEditGroupCode.Text;
                }

                if (!StockUnitGroupService.IsCodeOnly(unit.StockUnitCode, sug.StockUnitGroupCode))
                {
                    XtraMessageBox.Show("单位或单位组编码输入与数据库中重复,请重输!", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    waitForm.Close();
                    return;
                }

                unit.Conversion         = 1;
                unit.IsBaseUnit         = true;
                unit.Remark             = memoExEdit1.Text;
                unit.StockUnitGroupCode = sug.StockUnitGroupCode;
                unit.StockUnitName      = textEditBaseUnitName.Text;
                unit.StockUnitSource    = "手动添加";

                sug.StockUnitGroupName = textEditGroupName.Text;
                sug.BaseUnit           = unit.StockUnitName;//
                sug.Remark             = memoRemark.Text;
                waitForm.Close();
                if (StockUnitGroupService.AddStockUnitGroup(sug, unit) == ReturnType.Success)
                {
                    XtraMessageBox.Show("添加单位组成功!", Constants.SYSTEM_PROMPT);
                }
                else
                {
                    XtraMessageBox.Show("添加单位组失败!", Constants.SYSTEM_PROMPT);
                }
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                waitForm.Close();
                XtraMessageBox.Show(ex.ToString(), Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }