private void BindBarcodeDataToForm(BarcodeData data) { txtName.Text = data.Name; txtAddress.Text = data.Address; txtPost.Text = data.Post; txtAmount.Text = data.Amount.ToString(); txtReceiving.Text = data.Receiving.ToString(); txtNotes.Text = data.Notes.IndexOf('|') >= 0? data.Notes.Remove(0, data.Notes.IndexOf('|') + 1):data.Notes; txtDepartment.Text = data.Department; IList <AdditionItem> additionsItems = AddidtionsList.GetAll(data.Additions); int zone = (data.Additions >> 16); if (zone > 0) { ddlZone.Enabled = true; ddlZone.SelectedValue = (zone & 3).ToString(); } cbAdditions.DataSource = additionsItems; cbAdditions.DataTextField = "Label"; cbAdditions.DataValueField = "FlagValue"; cbAdditions.DataBind(); foreach (AdditionItem item in additionsItems) { ListItem li = cbAdditions.Items.FindByValue(item.FlagValue.ToString()); if (li != null) { li.Selected = item.Checked; } } }
protected void registerDocument(object sender, EventArgs e) { RegistryDAO dao = new RegistryDAO(); int additionFlags = 0; foreach (ListItem item in cbAdditions.Items) { if (item.Selected) { additionFlags |= (int)Enum.Parse(typeof(Additions), item.Value); if ((Additions)Enum.Parse(typeof(Additions), item.Value) == Additions.DOD_ZAGRANICZNY) { int zone = int.Parse(ddlZone.SelectedValue) << 16; additionFlags += zone; } } } if (dao.RegisterDocumentInRKW(docID, AddidtionsList.GetConcatenatedLabels(additionFlags), additionFlags, tbUwagi.Text)) { Response.Redirect("~/Aplikacje/RKW/Przegladanie.aspx"); } }
private void bindBarcodeValue(int codeValue) { IList <AdditionItem> additionsItems = AddidtionsList.GetAll(codeValue); int zone = (codeValue >> 16); if (zone > 0) { ddlZone.Enabled = true; ddlZone.SelectedValue = (zone & 3).ToString(); } cbAdditions.DataSource = additionsItems; cbAdditions.DataTextField = "Label"; cbAdditions.DataValueField = "FlagValue"; cbAdditions.DataBind(); foreach (AdditionItem item in additionsItems) { ListItem li = cbAdditions.Items.FindByValue(item.FlagValue.ToString()); if (li != null) { li.Selected = item.Checked; } } }