protected void btnAddMission2_Click(object sender, EventArgs e) { ServiceReference1.Service1Client x = new ServiceReference1.Service1Client(); setFields(); ServiceReference1.CompositeMission mission = new ServiceReference1.CompositeMission(); mission.Description = Description; int oid = Convert.ToInt32(ddOffice.SelectedValue); ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice(); office = x.GetOffice(oid); mission.OID = office.OID; int eid = Convert.ToInt32(ddEmployee.SelectedValue); ServiceReference1.CompositeEmployee employee = new ServiceReference1.CompositeEmployee(); employee = x.GetEmployee(eid); mission.EID = employee.EID; mission.StartDate = Date; int manager = Convert.ToInt32(ddManager.SelectedValue); ServiceReference1.CompositeEmployee mana = new ServiceReference1.CompositeEmployee(); mana = x.GetEmployee(manager); mission.Manager = mana.EID; x.SaveMission(mission); buttonsAddMission2(); setFieldsEnabled(false); updateGW(); }
protected void btnAddOffice2_Click(object sender, EventArgs e) { setAttributes(); ServiceReference1.Service1Client x = new ServiceReference1.Service1Client(); ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice(); office.Adress = Address; office.City = City; int CID = Convert.ToInt32(ddlCountry.SelectedValue); //office.Country = ddlCountry.SelectedItem; int n; bool r = int.TryParse(OrgNumber, out n); office.OrgNumber = n; int n2; bool r2 = int.TryParse(ZipCode, out n2); office.ZipCode = n2; office.Name = OfficeName; office.CID = CID; x.SaveOffice(office); buttonsAddOffice2(); setFieldsEnabled(false); updateGW(); resetFields(); }
protected void gwOffices_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); int id = Convert.ToInt32(gwOffices.DataKeys[index].Value.ToString()); ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice(); ServiceReference1.Service1Client x = new ServiceReference1.Service1Client(); office = x.GetOffice(id); Tbnamn.Text = office.Name.ToString(); Tborgnummer.Text = office.OrgNumber.ToString(); Tbzipcode.Text = office.ZipCode.ToString(); Tbcity.Text = office.City.ToString(); Tbadress.Text = office.Adress.ToString(); int cid = office.CID; ddlCountry.ClearSelection(); ddlCountry.Items.FindByValue(cid.ToString()).Selected = true; }
protected void gwMissions_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); int id = Convert.ToInt32(gwMissions.DataKeys[index].Value.ToString()); ServiceReference1.CompositeMission mission = new ServiceReference1.CompositeMission(); ServiceReference1.Service1Client x = new ServiceReference1.Service1Client(); mission = x.GetMission(id); tbDate.Text = mission.StartDate.ToString(); tbDescription.Text = mission.Description; Calendar.SelectedDate = mission.StartDate; int officeid = mission.OID; int managerid = mission.Manager; int employeeid = mission.EID; ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice(); ServiceReference1.CompositeEmployee manager = new ServiceReference1.CompositeEmployee(); ServiceReference1.CompositeEmployee employee = new ServiceReference1.CompositeEmployee(); office = x.GetOffice(officeid); manager = x.GetEmployee(managerid); employee = x.GetEmployee(employeeid); ddOffice.ClearSelection(); ddOffice.Items.FindByValue(office.OID.ToString()).Selected = true; ddManager.ClearSelection(); ddManager.Items.FindByValue(manager.EID.ToString()).Selected = true; ddEmployee.ClearSelection(); ddEmployee.Items.FindByValue(employee.EID.ToString()).Selected = true; /* ListItem off = ddOffice.Items.FindByValue(office.OID.ToString()); ListItem man = ddManager.Items.FindByValue(manager.EID.ToString()); ListItem emp = ddEmployee.Items.FindByText(employee.EID.ToString()); List<ListItem> ddofficelistan = new List<ListItem>(); for (int i = 0; i < ddOffice.Items.Count; i++) { ddofficelistan.Add(ddOffice.Items[i]); } for (int i = 0; i < ddofficelistan.Count; i++) { if (ddofficelistan[i] == off) { ddOffice.SelectedIndex = i; } } List<ListItem> ddmanagerlistan = new List<ListItem>(); for (int i = 0; i < ddManager.Items.Count; i++) { ddmanagerlistan.Add(ddManager.Items[i]); } for (int i = 0; i < ddmanagerlistan.Count; i++) { if (ddmanagerlistan[i] == man) { ddManager.SelectedIndex = i; } } List<ListItem> ddemployeelistan = new List<ListItem>(); for (int i = 0; i < ddEmployee.Items.Count; i++) { ddemployeelistan.Add(ddEmployee.Items[i]); } for (int i = 0; i < ddemployeelistan.Count; i++) { if (ddemployeelistan[i] == emp) { ddEmployee.SelectedIndex = i; } } */ }