public List<UnitGroup> GetAllUnitGroup()
        {
            var UG = new BindingList<UnitGroup>();
            UnitGroup ug1 = new UnitGroup();
            UnitGroup ug2 = new UnitGroup();

            ug1.name = "652";
            ug1.number = "1";
            ug1.description = "挤爆了";
            ug1.create_date = new DateTime();
            ug1.create_user_id = 1;
            ug1.Id = 1;
            ug1.is_delete = "是";
            ug1.modify_date = new DateTime();
            ug1.modify_user_id = 1;
            ug1.Parent_Id = 0;

            ug2.name = "158";
            ug2.number = "2";
            ug2.description = "挤上天";
            ug2.create_date = new DateTime();
            ug2.create_user_id = 2;
            ug2.Id = 2;
            ug2.is_delete = "否";
            ug2.modify_date = new DateTime();
            ug2.modify_user_id = 2;
            ug2.Parent_Id = 0;

            UG.Add(ug1);
            UG.Add(ug2);
            return UG.ToList();
        }
Beispiel #2
0
        private void PartsMange_MeasurementUnitBuild_MeasurementUnitBuild_Confirm_SimpleButton_Click(object sender, EventArgs e)
        {
            if (this.Tag == "Edit")
                group = WcfServiceLocator.Create<IMeasurementUnitBuild>().GetUnitGroupById(groupId);
            else
                group = new UnitGroup();
            group.name = PartsMange_MeasurementUnitBuild_MeasurementUnitBuild_UnitGroupName_TextEdit.Text;
            group.number = PartsMange_MeasurementUnitBuild_MeasurementUnitBuild_UnitGroupNumber_TextEdit.Text;
            group.description = PartsMange_MeasurementUnitBuild_MeasurementUnitBuild_Description_TextEdit.Text;

            WcfServiceLocator.Create<IMeasurementUnitBuild>().AddORUpdateUnitGroup(group);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 public bool AddORUpdateUnitGroup(UnitGroup group)
 {
     return group.Id == 0 ? AddUnitGroup(group) : UpdateUnitGroup(group);
 }
 private bool UpdateUnitGroup(UnitGroup group)
 {
     return true;
 }
 private bool AddUnitGroup(UnitGroup group)
 {
     return false;
 }
 private void UnitGroupItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     var id = treeList1.FocusedNode.GetValue("Id");
     switch (e.Item.Name)
     {
         case "TreeList_Add_barButtonItem":
             var addUnitGroup = new AddUnitGroup();
             var group = new UnitGroup();
             group.Id = groupList[groupList.Count - 1].Id;
             group.Parent_Id = 1;
             addUnitGroup.group = group;
             addUnitGroup.ShowDialog();
             if (addUnitGroup.DialogResult == DialogResult.OK)
             {
                 groupList.Add(addUnitGroup.group);
                 TreeDataBind(groupList);
             }
             break;
         case "TreeList_Modify_barButtonItem":
             var modifyUnitGroup = new AddUnitGroup();
             modifyUnitGroup.Text = "修改单位组";
             modifyUnitGroup.Tag = "Edit";
             modifyUnitGroup.groupId = Convert.ToInt32(id);
             modifyUnitGroup.ShowDialog();
             break;
         case "TreeList_Delete_barButtonItem":
             break;
         case "btnAddUnit":
             var addUnit = new AddUnit();
             var unit = new Unit();
             //var id = treeList1.FocusedNode.GetValue("Id");
             unit.unit_group_id = Convert.ToInt32(id);
             addUnit.unit = unit;
             addUnit.ShowDialog();
             if (addUnit.DialogResult == DialogResult.OK)
             {
                 unitList.Add(addUnit.unit);
                 TreeDataBind(groupList);
             }
             break;
         case "btnModifyUnit":
             var modifyUnit = new AddUnit();
             modifyUnit.Text = "修改单位";
             var group_id = treeList1.FocusedNode.GetValue("Id");
             //unit.unit_group_id = Convert.ToInt32(group_id);
             //unit = new Unit { id = 1, name = "Test", scale = "1.1", number = "1", unit_group_id = Convert.ToInt32(group_id) };
             modifyUnit.unitId = Convert.ToInt32(group_id);
             modifyUnit.ShowDialog();
             if (modifyUnit.DialogResult == DialogResult.OK)
             {
                 unitList.RemoveAt(modifyUnit.unit.id);
                 unitList.Add(modifyUnit.unit);
                 TreeDataBind(groupList);
             }
             break;
         case "btnDeleteUnit":
             break;
     }
 }
Beispiel #7
0
        public bool SaveUnitGroup(UnitGroup S)
        {
            IList<UnitGroup> List = new BindingList<UnitGroup>();

            return false;
        }