Exemplo n.º 1
0
        /// <summary>
        /// 修改库存自定义属性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bbtnModifyProp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            StockProp sp = gridViewStockProp.GetFocusedRow() as StockProp;

            if (sp != null)
            {
                string cid         = textCatCode.Text;
                string catName     = textCatName.Text;
                string fParentPid  = sp.ParentPid;
                string fParentName = string.Empty;
                if (fParentPid != "0")
                {
                    fParentName = StockPropService.GetStockProp(sp.ParentPid).Name;
                }
                string fParentVid       = sp.ParentVid;
                string fParentValueName = string.Empty;
                if (fParentVid != "0")
                {
                    fParentValueName = StockPropValueService.GetStockPropValue(sp.ParentVid).Name;
                }
                StockPropAdd spa = new StockPropAdd(cid, catName, fParentName, fParentPid, fParentValueName, fParentVid, sp.StockPid, sp.Name);
                spa.ShowDialog();
                WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
                waitForm.Show();
                gridCtrlStockProp.DataSource = StockPropService.GetStockProp(c => c.StockCid == cid);
                waitForm.Close();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 点击属性显示其属性值列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridViewStockProp_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            StockProp sp = gridViewStockProp.GetFocusedRow() as StockProp;

            if (sp != null)
            {
                gridCtrlStockPropValue.DataSource = StockPropValueService.GetStockPropValue(c => c.StockPid == sp.StockPid);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 初始化/刷新
 /// </summary>
 private void Init(TreeListNode fnode)
 {
     if (flag)
     {
         treeListStockCat.Nodes.Clear();
         //只加载最顶级的类目
         List <Alading.Entity.StockCat> stockCatList = StockCatService.GetStockCat(i => i.ParentCid == "0");
         treeListStockCat.BeginUnboundLoad();
         foreach (Alading.Entity.StockCat stockCat in stockCatList)
         {
             TreeListNode node = treeListStockCat.AppendNode(new object[] { stockCat.StockCatName }, null, new TreeListNodeTag(stockCat.StockCid));
             //设置是否有子节点,有则会显示一个+号
             node.HasChildren = stockCat.IsParent;
         }
         treeListStockCat.EndUnboundLoad();
         //不可编辑
         treeListStockCat.OptionsBehavior.Editable = false;
         treeListStockCat.FocusedNodeChanged      += treeListStockCat_FocusedNodeChanged;
         flag = false;
         if (treeListStockCat.FocusedNode != null)
         {
             TreeListNodeTag tag = treeListStockCat.FocusedNode.Tag as TreeListNodeTag;
             textCatCode.Text             = tag.Cid;
             textCatName.Text             = treeListStockCat.FocusedNode.GetDisplayText(0);
             gridCtrlStockProp.DataSource = StockPropService.GetStockProp(c => c.StockCid == tag.Cid);
             Alading.Entity.StockProp stockProp = gridViewStockProp.GetFocusedRow() as Alading.Entity.StockProp;
             if (stockProp != null)
             {
                 gridCtrlStockPropValue.DataSource = StockPropValueService.GetStockPropValue(c => c.StockPid == stockProp.StockPid);
             }
             else
             {
                 gridCtrlStockPropValue.DataSource = null;
             }
         }
     }
     else if (fnode != null)
     {
         TreeListNodeTag tag = fnode.Tag as TreeListNodeTag;
         textCatCode.Text             = tag.Cid;
         textCatName.Text             = fnode.GetDisplayText(0);
         gridCtrlStockProp.DataSource = StockPropService.GetStockProp(c => c.StockCid == tag.Cid);
         Alading.Entity.StockProp stockProp = gridViewStockProp.GetFocusedRow() as Alading.Entity.StockProp;
         if (stockProp != null)
         {
             gridCtrlStockPropValue.DataSource = StockPropValueService.GetStockPropValue(c => c.StockPid == stockProp.StockPid);
         }
         else
         {
             gridCtrlStockPropValue.DataSource = null;
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 增加新的PropValue
        /// </summary>
        /// <returns></returns>
        bool AddNewStockProp()
        {
            if (textEditValueName.Text == null || string.IsNullOrEmpty(textEditValueName.Text.Trim()))
            {
                XtraMessageBox.Show("请输入属性值名!", Constants.SYSTEM_PROMPT);
                textEditValueName.Focus();
                return(false);
            }
            WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);

            waitForm.Show();
            try
            {
                string stockVid = textEditVid.Text;
                if (StockPropService.GetStockProp(s => s.StockPid == stockVid).Count > 0)
                {
                    waitForm.Close();
                    XtraMessageBox.Show("属性值编码与数据库中已有属性值编码相同,请重输!", Constants.SYSTEM_PROMPT);
                    textEditVid.Focus();
                    return(false);
                }
                StockPropValue spv = new StockPropValue();
                spv.IsParent  = false;
                spv.Name      = textEditValueName.Text;
                spv.StockPid  = PropPid;
                spv.PropName  = PropName;
                spv.SortOrder = 0;
                spv.Status    = string.Empty;
                spv.StockCid  = stockCid;//
                spv.StockVid  = stockVid;
                if (StockPropValueService.AddStockPropValue(spv) == ReturnType.Success)
                {
                    waitForm.Close();
                    XtraMessageBox.Show("添加属性值成功!", Constants.SYSTEM_PROMPT);
                    return(true);
                }
                else
                {
                    waitForm.Close();
                    XtraMessageBox.Show("添加属性值失败!", Constants.SYSTEM_PROMPT);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                waitForm.Close();
                XtraMessageBox.Show("添加属性值失败!", Constants.SYSTEM_PROMPT);
                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 增加属性值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bbtnAddStockPropValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            StockProp sp = gridViewStockProp.GetFocusedRow() as StockProp;

            if (sp != null)
            {
                string            cid     = textCatCode.Text;
                string            catName = textCatName.Text;
                StockPropValueAdd spva    = new StockPropValueAdd(cid, catName, sp.Name, sp.StockPid);
                spva.ShowDialog();
                WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
                waitForm.Show();
                gridCtrlStockPropValue.DataSource = StockPropValueService.GetStockPropValue(c => c.StockPid == sp.StockPid);
                waitForm.Close();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 增加子属性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bbtnAddSonStockProp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            StockProp      sp  = gridViewStockProp.GetFocusedRow() as StockProp;
            StockPropValue spv = gridViewStockPropValue.GetFocusedRow() as StockPropValue;

            if (sp != null && spv != null)
            {
                string       cid              = sp.StockCid;
                string       catName          = textCatName.Text;
                string       fParentPid       = sp.StockPid;
                string       fParentName      = sp.Name;
                string       fParentVid       = spv.StockVid;
                string       fParentValueName = spv.Name;
                StockPropAdd spa              = new StockPropAdd(cid, catName, fParentName, fParentPid, fParentValueName, fParentVid, true);
                spa.ShowDialog();
                WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
                waitForm.Show();
                gridCtrlStockProp.DataSource      = StockPropService.GetStockProp(c => c.StockCid == cid);
                gridCtrlStockPropValue.DataSource = StockPropValueService.GetStockPropValue(c => c.StockPid == sp.StockPid);
                waitForm.Close();
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 删除属性值
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bbtnDeletePropValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Alading.Entity.StockPropValue propValue = gridViewStockPropValue.GetFocusedRow() as Alading.Entity.StockPropValue;
     if (propValue != null)
     {
         DialogResult result = XtraMessageBox.Show("确定要删除该属性值及该属性值下的所有属性吗?", Constants.SYSTEM_PROMPT, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         if (result == DialogResult.OK)
         {
             WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
             waitForm.Show();
             try
             {
                 if (StockPropValueService.RemoveStockPropValue(propValue) == ReturnType.Success)
                 {
                     waitForm.Close();
                     XtraMessageBox.Show("删除属性值成功!", Constants.SYSTEM_PROMPT);
                     waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
                     waitForm.Show();
                     Init(treeListStockCat.FocusedNode);
                     waitForm.Close();
                 }
                 else
                 {
                     waitForm.Close();
                     XtraMessageBox.Show("删除属性值失败!", Constants.SYSTEM_PROMPT);
                     return;
                 }
             }
             catch (Exception ex)
             {
                 waitForm.Close();
                 XtraMessageBox.Show("删除属性值失败!", Constants.SYSTEM_PROMPT);
                 return;
             }
         }
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 增加并关闭,或是修改保存关闭
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddStockProp_Click(object sender, EventArgs e)
 {
     if (flag)
     {
         if (AddNewStockProp())
         {
             this.Close();
         }
         else
         {
         }
     }
     else
     {
         WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);
         waitForm.Show();
         try
         {
             List <StockPropValue> list = StockPropValueService.GetStockPropValue(s => s.StockPid == PropPid && s.StockVid == Vid);
             if (list.Count > 0)
             {
                 StockPropValue spv = list.First();
                 spv.Name = textEditValueName.Text;
                 StockPropValueService.UpdateStockPropValue(spv);
                 waitForm.Close();
                 XtraMessageBox.Show("修改属性值失败!", Constants.SYSTEM_PROMPT);
                 this.Close();
             }
         }
         catch (Exception ex)
         {
             waitForm.Close();
             XtraMessageBox.Show("修改属性值失败!", Constants.SYSTEM_PROMPT);
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 添加StockProp
        /// </summary>
        /// <returns></returns>
        bool AddNewStockProp()
        {
            if (textEditPropName.Text == null || string.IsNullOrEmpty(textEditPropName.Text.Trim()))
            {
                XtraMessageBox.Show("请输入属性名称!", Constants.SYSTEM_PROMPT);
                textEditPropName.Focus();
                return(false);
            }
            if (textEditCatCode.Text == null || string.IsNullOrEmpty(textEditCatCode.Text.Trim()))
            {
                XtraMessageBox.Show("请输入属性编码!", Constants.SYSTEM_PROMPT);
                textEditCatCode.Focus();
                return(false);
            }
            WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA);

            waitForm.Show();
            try
            {
                string stockPid = textEditPropPid.Text;
                if (StockPropService.GetStockProp(s => s.StockPid == stockPid).Count > 0)
                {
                    waitForm.Close();
                    XtraMessageBox.Show("属性编码与数据库中已有编码重复,请重输!", Constants.SYSTEM_PROMPT);
                    textEditCatCode.Focus();
                    return(false);
                }
                StockProp sp = new StockProp();
                sp.Name       = textEditPropName.Text;
                sp.StockPid   = stockPid;
                sp.ParentPid  = fPropPid;
                sp.ParentVid  = fVid;
                sp.PropValues = string.Empty;
                sp.Status     = string.Empty;//
                sp.StockCid   = stockCid;
                if (StockPropService.AddStockProp(sp) == ReturnType.Success)
                {
                    if (sonFlag)
                    {
                        List <StockPropValue> list = StockPropValueService.GetStockPropValue(s => s.StockPid == fPropPid && s.StockVid == fVid);
                        if (list.Count > 0)
                        {
                            StockPropValue spv = list.First();
                            spv.IsParent = sonFlag;
                            StockPropValueService.UpdateStockPropValue(spv);
                        }
                    }
                    waitForm.Close();
                    XtraMessageBox.Show("添加属性成功!", Constants.SYSTEM_PROMPT);
                    return(true);
                }
                else
                {
                    waitForm.Close();
                    XtraMessageBox.Show("添加属性失败!", Constants.SYSTEM_PROMPT);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                waitForm.Close();
                XtraMessageBox.Show("添加属性失败!", Constants.SYSTEM_PROMPT);
                return(false);
            }
        }