Ejemplo n.º 1
0
        private void Save()
        {
            BuildingServiceClient buildingService = new BuildingServiceClient();
            Boolean  ret      = false;
            string   message  = String.Empty;
            Building building = new Building()
            {
                BuildingCode = txtBuildingCode.Text.ToString(),
                Description  = txtDescription.Text.ToString(),
                BuildingName = txtName.Text.ToString(),
                Rooms        = rooms.ToArray()
            };

            if (Op.Equals("edit"))
            {
                ret = buildingService.UpdateBuilding(ref building, ref message);
            }
            else
            {
                ret = buildingService.CreateBuilding(ref building, ref message);
            }

            if (ret)
            {
                MessageBox.Show("Saved Successfully");
            }
            else
            {
                MessageBox.Show("Error Saving");
            }

            Close();
        }
Ejemplo n.º 2
0
        private void Save()
        {
            BuildingServiceClient buildingService = new BuildingServiceClient();
            Boolean ret = false;
            string message = String.Empty;
            Building building = new Building()
            {
                BuildingCode = txtBuildingCode.Text.ToString(),
                Description = txtDescription.Text.ToString(),
                BuildingName = txtName.Text.ToString(),
                Rooms = rooms.ToArray()
                
            };
            if (Op.Equals("edit"))
                ret =buildingService.UpdateBuilding(ref building, ref message);
            else
                ret = buildingService.CreateBuilding(ref building, ref message);

            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }
Ejemplo n.º 3
0
        private void frmBuildingDetails_Load(object sender, EventArgs e)
        {
            if (Op.Equals("edit"))
            {
                SetFields();
                SetRoomGrid();
            }

            if (Op.Equals("new"))
            {
                BuildingServiceClient buildingService = new BuildingServiceClient();
                BindRoomGrid();
            }
        }
Ejemplo n.º 4
0
        private void frmBuildingDetails_Load(object sender, EventArgs e)
        {
            if (Op.Equals("edit"))
            {
                SetFields();
                SetRoomGrid();
            }

            if (Op.Equals("new"))
            {
                BuildingServiceClient buildingService = new BuildingServiceClient();
                BindRoomGrid();
            }
        }
Ejemplo n.º 5
0
        public void LoadBuildings()
        {
            BuildingServiceClient buildingService = new BuildingServiceClient();
            string message = String.Empty;
            try
            {
                var buildings = buildingService.GetAllBuildings();
                buildingList = new List<Building>(buildings);
                gvBuilding.DataSource = buildings;
                gvBuilding.Refresh();

                if (gvBuilding.RowCount != 0)
                    gvBuilding.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading Building List";
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 6
0
        public void LoadBuildings()
        {
            BuildingServiceClient buildingService = new BuildingServiceClient();
            string message = String.Empty;

            try
            {
                var buildings = buildingService.GetAllBuildings();
                buildingList          = new List <Building>(buildings);
                gvBuilding.DataSource = buildings;
                gvBuilding.Refresh();

                if (gvBuilding.RowCount != 0)
                {
                    gvBuilding.Rows[0].IsSelected = true;
                }
            }
            catch (Exception ex)
            {
                message = "Error Loading Building List";
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 7
0
        private void txtBuildingCode_Leave(object sender, EventArgs e)
        {
            Building bldg = new Building();
            string msg = string.Empty;
            BuildingServiceClient bldgService = new BuildingServiceClient();

            bldg = bldgService.GetBuilding(txtBuildingCode.Text, ref msg);
            if (bldg.BuildingCode != null)
            {
                MessageBox.Show("Building Code already exist!");
                txtBuildingCode.Text = string.Empty;
                txtBuildingCode.Focus();
                return;
            }
        }
Ejemplo n.º 8
0
        private void Save()
        {
            BuildingServiceClient buildingService = new BuildingServiceClient();
            Boolean ret = false;
            string message = String.Empty;
            Building building = new Building()
            {
                BuildingCode = txtBuildingCode.Text.ToString(),
                Description = txtDescription.Text.ToString(),
                BuildingName = txtName.Text.ToString(),
                Rooms = rooms.ToArray()

            };
            if (Op.Equals("edit"))
            {
                ret = buildingService.UpdateBuilding(ref building, ref message);

                building.Rooms = null;
                Log("U", "Buildings", building);
                if (rooms.Count > 0)
                {
                    foreach (Room r in rooms)
                        Log("C", "Rooms", r);
                }

                if (ret)
                    MessageBox.Show("Saved Successfully");
                else
                    MessageBox.Show("Error Saving");
                Close();

            }
            else
            {
                String la = txtBuildingCode.Text.ToString();
                if (la.Equals(String.Empty))
                {
                    MessageBox.Show("Provide Building Code");
                }
                else
                {
                    ret = buildingService.CreateBuilding(ref building, ref message);
                    building.Rooms = null;
                    Log("C", "Buildings", building);
                    if (rooms.Count > 0)
                    {
                        foreach (Room r in rooms)
                            Log("C", "Rooms", r);
                    }
                    if (ret)
                        MessageBox.Show("Saved Successfully");
                    else
                        MessageBox.Show("Error Saving");
                    Close();
                }
            }
        }