private string createSIF() { GatewayResponse response = new GatewayResponse(); String s = new StreamReader(Request.InputStream).ReadToEnd(); SIF sif = JsonConvert.DeserializeObject <SIF>(s); String authUser = HttpContext.Current.User.Identity.Name; sif.AssignedTo = authUser; /*Begin Transaction*/ ConnectionManager CM = new ConnectionManager(); Data_Base_MNG.SQL DM = CM.getDataManager(); DM.Open_Connection("SIF Create"); string idGenerated = sif_CRUD.createAndReturnIdGenerated(sif, ref DM); if (sif_CRUD.ErrorOccur) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + sif_CRUD.ErrorMessage; return(JsonConvert.SerializeObject(response)); } else { sif.Id = long.Parse(idGenerated); foreach (SIFDetail sifVolume in sif.SifDetail) { sifVolume.SifHeaderKey = sif.Id; if (!sifDetail_CRUD.create(sifVolume, ref DM)) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage; return(JsonConvert.SerializeObject(response)); } } } DM.CommitTransaction(); DM.Close_Open_Connection(); if (DM.ErrorOccur) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + DM.Error_Mjs; return(JsonConvert.SerializeObject(response)); } response.ErrorThrown = false; response.ResponseDescription = "SIF created successfully."; response.Result = sif; return(JsonConvert.SerializeObject(response)); }
public SCROLLINFO() { cbSize = Marshal.SizeOf(this); nPage = 0; nMin = 0; nMax = 0; nPos = 0; nTrackPos = 0; fMask = 0; }
internal SCROLLINFO(SIF mask, int min, int max, uint page, int pos, int trackPos) { cbSize = 28; fMask = mask; nMin = min; nMax = max; nPage = page; nPos = pos; nTrackPos = trackPos; }
private string saveSIF() { GatewayResponse response = new GatewayResponse(); String s = new StreamReader(Request.InputStream).ReadToEnd(); SIF sif = JsonConvert.DeserializeObject <SIF>(s); /*Begin Transaction*/ ConnectionManager CM = new ConnectionManager(); Data_Base_MNG.SQL DM = CM.getDataManager(); DM.Open_Connection("SIF Update"); if (!sif_CRUD.update(sif, ref DM)) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + sif_CRUD.ErrorMessage; return(JsonConvert.SerializeObject(response)); } if (!sifDetail_CRUD.deleteByParentID(sif.Id, ref DM)) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage; return(JsonConvert.SerializeObject(response)); } foreach (SIFDetail sifVolume in sif.SifDetail) { sifVolume.SifHeaderKey = sif.Id; if (!sifDetail_CRUD.create(sifVolume, ref DM)) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage; return(JsonConvert.SerializeObject(response)); } } DM.CommitTransaction(); DM.Close_Open_Connection(); if (DM.ErrorOccur) { response.ErrorThrown = true; response.ResponseDescription = "ERROR:" + DM.Error_Mjs; return(JsonConvert.SerializeObject(response)); } response.ErrorThrown = false; response.ResponseDescription = "SIF updated successfully."; response.Result = getSIFbyID(sif.Id); return(JsonConvert.SerializeObject(response)); }
private SIF getSIFbyID(long sifID) { SIF SIFHeader = sif_CRUD.readById(sifID); if (SIFHeader == null) { SIFHeader = new SIF(); } SIFHeader.SifDetail = sifDetail_CRUD.readByParentID(sifID); return(SIFHeader); }
public BOMHeaderAccess readBySIF(SIF sif) { BOMHeaderAccess bom = new BOMHeaderAccess(); try { DataRow[] table = sifAccessCRUD.readAll().Select("[Inquiry Number] = '" + sif.InquiryNumber + "' and Revision = '" + sif.Revision + "'"); if (table.Count() > 0) { bom.PartDescription = table[0]["Product"].ToString(); //bom.Revision = table.Rows[0][0].ToString(); //bom.TopPartNumber = table.Rows[0][0].ToString(); return(bom); } }catch { } return(null); }
static public List <BOMAccess> readBySIF(SIF sif) { List <BOMAccess> recordset = new List <BOMAccess>(); DataRow[] table = readAll().Select("[Inquiry Number] = '" + sif.InquiryNumber + "' and Revision = '" + sif.Revision + "'"); for (int i = 0; i < table.Count(); i++) { BOMAccess bom = new BOMAccess(); bom.MaterialPosition = table[i]["Material Position"].ToString(); bom.PartNumber = table[i]["Part Number/Code ID"].ToString(); bom.Material = table[i]["Material/Assembly Description"].ToString(); bom.AssemblyDescription = table[i]["Assembly Description"].ToString(); bom.Status = table[i]["Status"].ToString(); bom.VendorQuoteEst = table[i]["Vendor Quote Est"].ToString(); bom.SalesComments = table[i]["Comments"].ToString(); bom.CapComAssm = table[i]["Cap Com Assm"].ToString(); bom.CommCode = table[i]["Component Lead Time"].ToString(); bom.Um = table[i]["UM"].ToString(); try { bom.PartCost = float.Parse(table[i]["Part Cost ($)"].ToString()); } catch (Exception ex) { bom.PartCost = 0; } try { bom.NoRequired = float.Parse(table[i]["No Required"].ToString()); } catch (Exception ex) { bom.NoRequired = 0; //bom.ImportComment = "BOM Line with incorrect field formatted: 'No Required', " // + "please review it and export it agian if necessary. Error: " + ex.Message; } recordset.Add(bom); } return(recordset); }
private void btnExportSelected_Click(object sender, EventArgs e) { if (gridSIF.SelectedRows.Count > 0) { List <SIF> recordset = new List <SIF>(); foreach (DataGridViewRow row in gridSIF.SelectedRows) { SIF sif = new SIF(); sif.InquiryNumber = row.Cells["Inquiry Number"].Value.ToString(); sif.Revision = row.Cells["Revision"].Value.ToString(); sif.SalesPerson = row.Cells["Sales Person"].Value.ToString(); sif.CustomerName = row.Cells["Customer"].Value.ToString(); sif.Priority = row.Cells["Priority"].Value.ToString(); sif.CostModelLoc = row.Cells["Cost Model Location"].Value.ToString(); sif.DivLoc = row.Cells["Division/Location"].Value.ToString(); sif.Contact = row.Cells["Contact"].Value.ToString(); sif.Department = row.Cells["Department"].Value.ToString(); sif.BussinesClass = row.Cells["Business Class"].Value.ToString(); sif.Reason4Quote = row.Cells["Reason For Quote"].Value.ToString(); sif.Product = row.Cells["Product"].Value.ToString(); sif.Application = row.Cells["Application/Program"].Value.ToString(); sif.Specification = row.Cells["Specification"].Value.ToString(); sif.PartPrint = row.Cells["Part Print (Rev)"].Value.ToString(); sif.Sample = row.Cells["Samples"].Value.ToString(); sif.TaskDescription = row.Cells["Task Description"].Value.ToString(); sif.ToolingTarget = row.Cells["Tooling Target (Incl Prototypes)"].Value.ToString(); sif.PrimaryCompetitors = row.Cells["Primary Competitors"].Value.ToString(); sif.SpecificResourceRequirements = row.Cells["Specific Response Requirements"].Value.ToString(); sif.Technical = row.Cells["Technical/subsource Constraints"].Value.ToString(); sif.SalesStatus = row.Cells["Status"].Value.ToString(); sif.MarketSector = row.Cells["Market Sector"].Value.ToString(); sif.SalesDBID = long.Parse(row.Cells["ID"].Value.ToString()); try { sif.QuoteDue = DateTime.Parse(row.Cells["Quote Due"].Value.ToString()); } catch { } try { sif.Sop = DateTime.Parse(row.Cells["SOP"].Value.ToString()); } catch { } sif.DrawingLevel = row.Cells["DWG Level"].Value.ToString(); //SIF Detail: for (int i = 1; i <= 7; i++) { SIFDetail sifDetail = new SIFDetail(); sifDetail.ProgramYear = row.Cells["Year " + i].Value.ToString(); try { sifDetail.ProjectedAnnualVolume = long.Parse(row.Cells["Projected Annual Volume Yr " + i].Value.ToString()); sifDetail.ProjectedTargetPrice = float.Parse(row.Cells["Projected/Target Price Yr " + i].Value.ToString()); sifDetail.AnnualRevenue = float.Parse(row.Cells["Annual Revenue Yr " + i].Value.ToString()); if (i == 2 || i == 4) { sifDetail.PercentVolumePerAward = float.Parse(row.Cells["% of Volume Yr " + i].Value.ToString()); } else if (i == 6 || i == 7) { sifDetail.PercentVolumePerAward = float.Parse(row.Cells["% Volume per Award Yr " + i].Value.ToString()); } else { sifDetail.PercentVolumePerAward = float.Parse(row.Cells["% of Volume per Award Yr " + i].Value.ToString()); } if (sifDetail.ProjectedAnnualVolume > 0) { sif.SifDetail.Add(sifDetail); } } catch { }//If there is a null value on numeric fields the record is not imported. } recordset.Add(sif); } frmExport frmExportDialog = new frmExport(); frmExportDialog.SifsInAccessToExport = recordset; frmExportDialog.ShowDialog(this); } else { MessageBox.Show("No SIFs selected.", "Error."); } }