Ejemplo n.º 1
0
 /// <summary>
 /// 绑定库位信息
 /// </summary>
 /// <param name="location">库位信息</param>
 public void GetLocationInfo(MW_Location location)
 {
     LocationName.Text   = string.Empty;
     LocationRemark.Text = string.Empty;
     if (location != null)
     {
         LocationName.Text   = location.LocationName;
         LocationRemark.Text = location.Remark;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="sender">控件</param>
 /// <param name="e">参数</param>
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(LocationName.Text))
     {
         MW_Location location = new MW_Location();
         location.LocationName = LocationName.Text;
         location.Remark       = LocationRemark.Text;
         InvokeController("SaveLocation", location);
     }
     else
     {
         MessageBoxEx.Show("库存名称不能为空");
     }
 }
        public string DelLoacation(MW_Location location)
        {
            var retdata = InvokeWcfService(
                "DrugProject.Service",
                "MaterialLocationController",
                "DelLoacation",
                (request) =>
            {
                request.AddData(location);
            });

            var ret = retdata.GetData <string>(0);

            return(ret);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 加载库位节点信息
        /// </summary>
        /// <param name="locationlist">库位节点信息</param>
        public void GetLocationList(List <MW_Location> locationlist)
        {
            LocationTree.Nodes.Clear();
            List <MW_Location> parentlist = locationlist.Where(item => item.ParentID == 0).ToList();

            foreach (MW_Location tempbd in parentlist)
            {
                Node newnode = new Node();
                newnode.Text = tempbd.LocationName;
                newnode.Name = tempbd.LocationID.ToString();
                LocationTree.Nodes.Add(newnode);
            }

            List <MW_Location> childlist = locationlist.Where(item => item.ParentID > 0).ToList();

            foreach (MW_Location tempbd in childlist)
            {
                Node newnode = LocationTree.Nodes.Find(tempbd.ParentID.ToString(), true).FirstOrDefault();
                if (newnode == null)
                {
                    MW_Location parentlayer = childlist.Where(item => item.LocationID == tempbd.ParentID).FirstOrDefault();
                    if (parentlayer != null)
                    {
                        newnode.Name = parentlayer.LocationID.ToString();
                        newnode.Text = parentlayer.LocationName;
                        Node parentnode = LocationTree.Nodes.Find(parentlayer.ParentID.ToString(), true).FirstOrDefault();
                        LocationTree.SelectedNode = parentnode;
                        LocationTree.SelectedNode.Nodes.Add(newnode);
                        childlist.Remove(parentlayer);
                    }
                }

                Node childnode = new Node();
                childnode.Text = tempbd.LocationName;
                childnode.Name = tempbd.LocationID.ToString();
                if (newnode != null)
                {
                    LocationTree.SelectedNode = newnode;
                    LocationTree.SelectedNode.Nodes.Add(childnode);
                }
            }

            if (LocationTree.Nodes.Count > 0)
            {
                LocationTree.SelectedNode = LocationTree.Nodes[0];
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 删除节点
 /// </summary>
 /// <param name="sender">控件</param>
 /// <param name="e">参数</param>
 private void toolMenuDel_Click(object sender, EventArgs e)
 {
     if (MessageBoxEx.Show("删除后无法恢复,确定删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (this.LocationTree.SelectedNode != null)
         {
             string      locaionid = this.LocationTree.SelectedNode.Name;
             MW_Location location  = new MW_Location();
             location.LocationID = Convert.ToInt32(locaionid);
             InvokeController("DelLoacation", location);
             this.LocationTree.SelectedNode.Remove();
         }
         else
         {
             MessageBoxEx.Show("请先选择一个节点");
         }
     }
 }
        public void SaveLocation(MW_Location location)
        {
            location.LocationID = frmLocation.LocationID;
            location.DeptID     = frmLocation.DeptId;
            location.ParentID   = frmLocation.ParentId;
            var retdata = InvokeWcfService(
                "DrugProject.Service",
                "MaterialLocationController",
                "SaveLocation",
                (request) =>
            {
                request.AddData(location);
            });

            var result = retdata.GetData <bool>(0);

            frmLocationInfo.SaveComplete(result);
        }
        public ServiceResponseData DelLoacation()
        {
            MW_Location location = requestData.GetData <MW_Location>(0);

            this.BindDb(location);
            int result = location.delete();

            if (result > 0)
            {
                responseData.AddData(true);
            }
            else
            {
                responseData.AddData(false);
            }

            return(responseData);
        }
        public ServiceResponseData SaveLocation()
        {
            MW_Location location    = requestData.GetData <MW_Location>(0);
            MW_Location oldlocation = NewDao <IMWDao>().GetLocationByName(location.ParentID, location.LocationName);

            if (oldlocation == null)
            {
                this.BindDb(location);
                int result = location.save();
                if (result > 0)
                {
                    responseData.AddData(true);
                }
                else
                {
                    responseData.AddData(false);
                }
            }
            else
            {
                if (oldlocation.LocationID == location.LocationID)
                {
                    this.BindDb(location);
                    int result = location.save();
                    if (result > 0)
                    {
                        responseData.AddData(true);
                    }
                    else
                    {
                        responseData.AddData(false);
                    }
                }
                else
                {
                    responseData.AddData(false);
                }
            }

            return(responseData);
        }