public void SaveLocation(DG_Location location)
        {
            if (currentfrmName == "FrmLocation")
            {
                location.LocationID = frmLocation.LocationID;
                location.DeptID     = frmLocation.DeptId;
                location.ParentID   = frmLocation.ParentId;
            }
            else
            {
                location.LocationID = frmlocationyk.LocationID;
                location.DeptID     = frmlocationyk.DeptId;
                location.ParentID   = frmlocationyk.ParentId;
            }

            var retdata = InvokeWcfService(
                "DrugProject.Service",
                "LocationController",
                "SaveLocation",
                (request) =>
            {
                request.AddData(location);
            });
            var result = retdata.GetData <bool>(0);

            frmLocationInfo.SaveComplete(result);
        }
Beispiel #2
0
 /// <summary>
 /// 获取库位详情
 /// </summary>
 /// <param name="location">库位详情</param>
 public void GetLocationInfo(DG_Location location)
 {
     LocationName.Text   = string.Empty;
     LocationRemark.Text = string.Empty;
     if (location != null)
     {
         LocationName.Text   = location.LocationName;
         LocationRemark.Text = location.Remark;
     }
 }
        public string DelLoacation(DG_Location location)
        {
            var retdata = InvokeWcfService(
                "DrugProject.Service",
                "LocationController",
                "DelLoacation",
                (request) =>
            {
                request.AddData(location);
            });
            var ret = retdata.GetData <string>(0);

            return(ret);
        }
Beispiel #4
0
 /// <summary>
 /// 事件
 /// </summary>
 /// <param name="sender">对象</param>
 /// <param name="e">参数</param>
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(LocationName.Text))
     {
         DG_Location location = new DG_Location();
         location.LocationName = LocationName.Text;
         location.Remark       = LocationRemark.Text;
         InvokeController("SaveLocation", location);
     }
     else
     {
         MessageBoxEx.Show("库存名称不能为空");
     }
 }
Beispiel #5
0
        /// <summary>
        /// 加载库位节点信息
        /// </summary>
        /// <param name="locationlist">库位节点信息</param>
        public void GetLocationList(List <DG_Location> locationlist)
        {
            LocationTree.Nodes.Clear();
            List <DG_Location> parentlist = locationlist.Where(item => item.ParentID == 0).ToList();

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

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

            foreach (DG_Location tempbd in childlist)
            {
                Node newnode = LocationTree.Nodes.Find(tempbd.ParentID.ToString(), true).FirstOrDefault();
                if (newnode == null)
                {
                    DG_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];
            }
        }
        public ServiceResponseData DelLoacation()
        {
            DG_Location location = requestData.GetData <DG_Location>(0);

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

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

            return(responseData);
        }
Beispiel #7
0
 /// <summary>
 /// 删除库位信息
 /// </summary>
 /// <param name="sender">对象</param>
 /// <param name="e">参数</param>
 private void toolMenuDel_Click(object sender, EventArgs e)
 {
     InvokeController("ChangeView", frmName);
     if (MessageBoxEx.Show("删除后无法恢复,确定删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (this.LocationTree.SelectedNode != null)
         {
             string      locaionid = this.LocationTree.SelectedNode.Name;
             DG_Location location  = new DG_Location();
             location.LocationID = Convert.ToInt32(locaionid);
             InvokeController("DelLoacation", location);
             this.LocationTree.SelectedNode.Remove();
         }
         else
         {
             MessageBoxEx.Show("请先选择一个节点");
         }
     }
 }
        public ServiceResponseData SaveLocation()
        {
            DG_Location location    = requestData.GetData <DG_Location>(0);
            DG_Location oldlocation = NewDao <IDGDao>().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);
        }