private bool Save() { if (CheckAllRequired() && radioSunglasses.Checked) { decimal price = Convert.ToDecimal(txtPrice.Text.Substring(3)); bool stopO = false; if (chkStopOrder.GetItemChecked(0)) { stopO = true; } string s = ""; Sunglasses sunglasses = new Sunglasses(txtName.Text, price, (int)numQuantity.Value, (int)numDiscount.Value, txtFrameColor.Text, txtDescription.Text, stopO, txtLensColor.Text); foreach (FileInfo item in fileNames) { s = UploadImageToFTP(item, sunglasses.ProductId); sunglasses.AddImage(s); } sunglasses.SetPrimaryImage(s); return(true); } else if (CheckAllRequired() && radioPrescriptionGlasses.Checked) { decimal price = Convert.ToDecimal(txtPrice.Text.Substring(3)); bool stopO = false; if (chkStopOrder.GetItemChecked(0)) { stopO = true; } string s = ""; PrescriptionGlasses prescrptionGlasses = new PrescriptionGlasses(txtName.Text, price, (int)numDiscount.Value, (int)numQuantity.Value, txtFrameColor.Text, txtDescription.Text, stopO, new Lens((int)comboLens.SelectedValue), new Frame((int)comboFrames.SelectedValue)); foreach (FileInfo item in fileNames) { s = UploadImageToFTP(item, prescrptionGlasses.ProductId); prescrptionGlasses.AddImage(s); } prescrptionGlasses.SetPrimaryImage(s); return(true); } return(false); }
public void SetPrimaryImage() { string imageName = (string)imageGridView.SelectedRows[0].Cells[0].Value; prescriptionGlasses.SetPrimaryImage(imageName); }