private DS.SAI.Data.QuoteCompositeType HeaderReq() { try { var qct = new DS.SAI.Data.QuoteCompositeType(); Util.isRequired(txtDateIn.Text.Trim(), "Fecha Entrada"); Util.validateDatesHomeEnd(txtDateIn.Text.Trim(), "Fecha Entrada"); Util.isRequired(txtDateProm.Text.Trim(), "Fecha Promesa"); Util.validateDatesHomeEnd(txtDateIn.Text.Trim(), "Fecha Promesa"); Util.isRequired(txtDateIn.Text.Trim(), "Fecha Entrega"); Util.validateDatesHomeEnd(txtDateOut.Text.Trim(), "Fecha Entrega"); Util.isRequired(txtSOPClientC.Text.Trim(), "SOP Cliente"); qct.dIn = DateTime.Parse(txtDateIn.Text.Trim()); qct.dProm = DateTime.Parse(txtDateProm.Text.Trim()); qct.dOut = DateTime.Parse(txtDateOut.Text.Trim()); qct.SOPCliente = txtSOPClientC.Text.Trim(); qct.iExchange = int.Parse(lblIdExchange.Text.Trim()); qct.iPartList = int.Parse(ddlPartListC.SelectedValue.ToString()); return(qct); } catch (ArgumentException ae) { throw new Exception(ae.Message); } }
public int getCountQuoteByIdExchangeIdPartList(QuoteCompositeType qct) { param = new SqlParameter[2]; param[0] = new SqlParameter("@fiid_exchange", SqlDbType.Int) { Value = qct.iExchange }; param[1] = new SqlParameter("@fiid_part_list", SqlDbType.Int) { Value = qct.iPartList }; return(int.Parse(objDB.ExecStore("sp_selectCountQuoteByIdExchangeIdPartList", param).Rows[0].ItemArray[0].ToString())); }
private void Quote() { if (ddlPartListC.Items.Count > 0) { pnQuoteA.Visible = true; pnQuoteNon.Visible = false; var plct = new DS.SAI.Data.PartListCompositeType(); var plm = new PartListManager(); var ect = new DS.SAI.Data.ExchangeCompositeType(); var em = new ExchangeManager(); var qct = new DS.SAI.Data.QuoteCompositeType(); var qm = new QuoteManager(); qct.iExchange = int.Parse(lblIdExchange.Text.ToString()); qct.iPartList = int.Parse(ddlPartListC.SelectedValue.ToString()); plct = plm.getPartListById(int.Parse(ddlPartListC.SelectedValue.ToString())); ect = em.getExchangeById(int.Parse(lblIdExchange.Text)); lblNoParC.Text = plct.iNumber.ToString(); lblClientC.Text = ect.sClient.ToString(); lblProyectC.Text = ect.sProyect.ToString(); lblDescriptionC.Text = ect.sDescription.ToString(); if (qm.ExistQuoteDuplicate(qct)) { qct = qm.getQuoteById(qct); txtDateIn.Text = qct.dIn.ToShortDateString(); txtDateProm.Text = qct.dProm.ToShortDateString(); txtDateOut.Text = qct.dOut.ToShortDateString(); txtSOPClientC.Text = qct.SOPCliente; txtMoldC.Text = qct.iMoldProt.ToString(); txtMoldSC.Text = qct.iMoldSerie.ToString(); txtCFC.Text = qct.iCF.ToString(); txtDeviceC.Text = qct.iDevice.ToString(); txtObsoletC.Text = qct.iObsolet.ToString(); txtManEngC.Text = qct.iEngMan.ToString(); txtDesignC.Text = qct.iDesign.ToString(); txtComponentsC.Text = qct.iComponents.ToString(); txtOthersTitleWC.Text = qct.sOthers.ToString(); txtOthersWC.Text = qct.iOthers.ToString(); txtPaintC.Text = qct.iPaint.ToString(); txtEmpC.Text = qct.iEmp.ToString(); txtBankC.Text = qct.iBank.ToString(); txtPrue.Text = qct.iOthersC.ToString(); txtPoundC.Text = qct.iPound.ToString(); txtDelta1.Text = qct.iDelta1.ToString(); txtDelta2.Text = qct.iDelta2.ToString(); txtCost.Text = qct.iCost.ToString(); txtR1.Text = qct.iFR1.ToString(); txtR2.Text = qct.iFR2.ToString(); txtMoldPlazoC.Text = qct.iMoldP.ToString(); txtMoldProtC.Text = qct.iMoldProtP.ToString(); txtDateStart.Text = qct.iStart.ToString(); txtObsC.Text = qct.sDescription.ToString(); lblINVTotal.Text = qct.iTotalInv.ToString(); lblTotalPieceTotal.Text = qct.iTotalP.ToString(); chkMoldC.Checked = qct.bMoldProt; chkMoldSC.Checked = qct.bMoldSerie; chkCFC.Checked = qct.bCF; chkDeviceC.Checked = qct.bDevice; chkObsoletC.Checked = qct.bObsolet; chkManEngC.Checked = qct.bEngMan; chkDesingC.Checked = qct.bDesign; chkComponetsC.Checked = qct.bComponents; chkOthersWC.Checked = qct.bOthers; chkPaintC.Checked = qct.bPaint; chkEmpC.Checked = qct.bEmp; chkBankC.Checked = qct.bBank; setVisibleChecked(); BlockQuote(); btnUpdateQuote.Visible = true; btnUpdateQuoteGuardar.Visible = false; btnAddQuote.Visible = false; } else { clearControlsQuote(); UnblockQuote(); } } else { pnQuoteA.Visible = false; pnQuoteNon.Visible = true; } }
private DS.SAI.Data.QuoteCompositeType calculate(DS.SAI.Data.QuoteCompositeType qct) { decimal iSum = 0; decimal iSum2 = 0; if (chkMoldC.Checked) { Util.isRequired(txtMoldC.Text.Trim(), "Molde Prototipo"); Util.isNumeric(txtMoldC.Text.Trim(), "Molde Prototipo"); qct.iMoldProt = decimal.Parse(txtMoldC.Text.Trim()); qct.bMoldProt = true; iSum += decimal.Parse(txtMoldC.Text.Trim()); } else { qct.iMoldProt = 0; qct.bMoldProt = false; } if (chkMoldSC.Checked) { Util.isRequired(txtMoldSC.Text.Trim(), "Molde Serie"); Util.isNumeric(txtMoldSC.Text.Trim(), "Molde Serie"); qct.iMoldSerie = decimal.Parse(txtMoldSC.Text.Trim()); qct.bMoldSerie = true; iSum = iSum + decimal.Parse(txtMoldSC.Text.Trim()); } else { qct.iMoldSerie = 0; qct.bMoldSerie = false; } if (chkCFC.Checked) { Util.isRequired(txtCFC.Text.Trim(), "C/F"); Util.isNumeric(txtCFC.Text.Trim(), "C/F"); qct.iCF = decimal.Parse(txtCFC.Text.Trim()); qct.bCF = true; iSum = iSum + decimal.Parse(txtCFC.Text.Trim()); } else { qct.iCF = 0; qct.bCF = false; } if (chkDeviceC.Checked) { Util.isRequired(txtDeviceC.Text.Trim(), "Dispositivo ensamble"); Util.isNumeric(txtDeviceC.Text.Trim(), "Dispositivo ensamble"); qct.iDevice = decimal.Parse(txtDeviceC.Text.Trim()); qct.bDevice = true; iSum = iSum + decimal.Parse(txtDeviceC.Text.Trim()); } else { qct.iDevice = 0; qct.bDevice = false; } if (chkObsoletC.Checked) { Util.isRequired(txtObsoletC.Text.Trim(), "Obsoletos"); Util.isNumeric(txtObsoletC.Text.Trim(), "Obsoletos"); qct.iObsolet = decimal.Parse(txtObsoletC.Text.Trim()); qct.bObsolet = true; iSum = iSum + decimal.Parse(txtObsoletC.Text.Trim()); } else { qct.iObsolet = 0; qct.bObsolet = false; } if (chkManEngC.Checked) { Util.isRequired(txtManEngC.Text.Trim(), "Admon. Ingeniería"); Util.isNumeric(txtManEngC.Text.Trim(), "Admon. Ingeniería"); qct.iEngMan = decimal.Parse(txtManEngC.Text.Trim()); qct.bEngMan = true; iSum = iSum + decimal.Parse(txtManEngC.Text.Trim()); } else { qct.iEngMan = 0; qct.bEngMan = false; } if (chkDesingC.Checked) { Util.isRequired(txtDesignC.Text.Trim(), "Diseño"); Util.isNumeric(txtDesignC.Text.Trim(), "Diseño"); qct.iDesign = decimal.Parse(txtDesignC.Text.Trim()); qct.bDesign = true; iSum = iSum + decimal.Parse(txtDesignC.Text.Trim()); } else { qct.iDesign = 0; qct.bDesign = false; } if (chkComponetsC.Checked) { Util.isRequired(txtComponentsC.Text.Trim(), "Componentes"); Util.isNumeric(txtComponentsC.Text.Trim(), "Componentes"); qct.iComponents = decimal.Parse(txtComponentsC.Text.Trim()); qct.bComponents = true; //iSum = iSum +int.Parse(txtComponentsC.Text.Trim()); iSum2 = iSum2 + decimal.Parse(txtComponentsC.Text.Trim()); } else { qct.iComponents = 0; qct.bComponents = false; } if (chkOthersWC.Checked) { Util.isRequired(txtOthersTitleWC.Text.Trim(), "Descripcion Otros"); Util.isRequired(txtOthersWC.Text.Trim(), "Otros"); Util.isNumeric(txtOthersWC.Text.Trim(), "Otros"); qct.sOthers = txtOthersTitleWC.Text.Trim(); qct.iOthers = decimal.Parse(txtOthersWC.Text.Trim()); qct.bOthers = true; //iSum = iSum + decimal.Parse(txtOthersWC.Text.Trim()); } else { qct.bOthers = false; qct.iOthers = 0; qct.sOthers = ""; } if (chkPaintC.Checked) { Util.isRequired(txtPaintC.Text.Trim(), "Pintura"); Util.isNumeric(txtPaintC.Text.Trim(), "Pintura"); qct.iPaint = decimal.Parse(txtPaintC.Text.Trim()); qct.bPaint = true; iSum = iSum + decimal.Parse(txtPaintC.Text.Trim()); } else { qct.bPaint = false; qct.iPaint = 0; } if (chkEmpC.Checked) { Util.isRequired(txtEmpC.Text.Trim(), "Empaque"); Util.isNumeric(txtEmpC.Text.Trim(), "Empaque"); qct.iEmp = decimal.Parse(txtEmpC.Text.Trim()); qct.bEmp = true; iSum = iSum + decimal.Parse(txtEmpC.Text.Trim()); } else { qct.iEmp = 0; qct.bEmp = false; } if (chkBankC.Checked) { Util.isRequired(txtBankC.Text.Trim(), "Banco"); Util.isNumeric(txtBankC.Text.Trim(), "Banco"); qct.iBank = decimal.Parse(txtBankC.Text.Trim()); qct.bBank = true; iSum = iSum + decimal.Parse(txtBankC.Text.Trim()); } else { qct.iBank = 0; qct.bBank = false; } Util.isRequired(txtPoundC.Text.Trim(), "Peso Actual"); Util.isNumeric(txtPoundC.Text.Trim(), "Peso Actual"); qct.iPound = decimal.Parse(txtPoundC.Text.Trim()); Util.isRequired(txtDelta1.Text.Trim(), "Delta 1"); Util.isNumeric(txtDelta1.Text.Trim(), "Delta 1"); qct.iDelta1 = int.Parse(txtDelta1.Text.Trim()); Util.isNumeric(txtDelta2.Text.Trim(), "Delta 2"); qct.iDelta2 = int.Parse(txtDelta2.Text.Trim()); Util.isRequired(txtPrue.Text.Trim(), "Otros"); Util.isNumeric(txtPrue.Text.Trim(), "Otros"); qct.iOthersC = int.Parse(txtDelta1.Text.Trim()); iSum = iSum + decimal.Parse(txtPrue.Text.Trim()); Util.isRequired(txtMoldPlazoC.Text.Trim(), "Molde"); Util.isNumeric(txtMoldPlazoC.Text.Trim(), "Molde"); qct.iMoldP = int.Parse(txtMoldPlazoC.Text.Trim()); Util.isRequired(txtMoldProtC.Text.Trim(), "Molde"); Util.isNumeric(txtMoldProtC.Text.Trim(), "Molde"); qct.iMoldProt = int.Parse(txtMoldProtC.Text.Trim()); Util.isRequired(txtDateStart.Text.Trim(), "Fecha inicio de cambio"); Util.isNumeric(txtDateStart.Text.Trim(), "Fecha inicio de cambio"); qct.iStart = int.Parse(txtDateStart.Text.Trim()); Util.isRequired(txtObsC.Text.Trim(), "observaciones"); qct.sObservations = txtObsC.Text.Trim(); Util.isRequired(txtR1.Text.Trim(), "R1"); Util.isNumeric(txtR1.Text.Trim(), "R1"); qct.iFR1 = decimal.Parse(txtR1.Text.Trim()); Util.isRequired(txtR2.Text.Trim(), "R2"); Util.isNumeric(txtR2.Text.Trim(), "R2"); qct.iFR2 = decimal.Parse(txtR2.Text.Trim()); lblINVTotal.Text = iSum.ToString(); qct.iTotalInv = iSum / 1000; //txtCost.Text = ((qct.iDelta1 * qct.iFR1) + (qct.iDelta2 * qct.iFR2)).ToString(); qct.iCost = decimal.Parse(txtCost.Text.Trim()); lblTotalPieceTotal.Text = (qct.iCost + iSum2).ToString(); qct.iTotalP = decimal.Parse(lblTotalPieceTotal.Text.Trim()); return(qct); }
public QuoteCompositeType getQuoteByIdExchangeIdPartList(QuoteCompositeType ect) { param = new SqlParameter[2]; param[0] = new SqlParameter("@fiid_exchange", SqlDbType.Int) { Value = ect.iExchange }; param[1] = new SqlParameter("@fiid_part_list", SqlDbType.Int) { Value = ect.iPartList }; DataTable dt = objDB.ExecStore("sp_selectQuoteByIdExchangeIdPartList", param); var qct = new QuoteCompositeType { iIdQuote = int.Parse(dt.Rows[0].ItemArray[0].ToString()), iExchange = int.Parse(dt.Rows[0].ItemArray[1].ToString()), iPartList = int.Parse(dt.Rows[0].ItemArray[2].ToString()), sParte = dt.Rows[0].ItemArray[3].ToString(), sNoPart = dt.Rows[0].ItemArray[4].ToString(), sClient = dt.Rows[0].ItemArray[5].ToString(), sDescription = dt.Rows[0].ItemArray[6].ToString(), sProyect = dt.Rows[0].ItemArray[7].ToString(), SOPCliente = dt.Rows[0].ItemArray[8].ToString(), dIn = DateTime.Parse(dt.Rows[0].ItemArray[9].ToString()), dOut = DateTime.Parse(dt.Rows[0].ItemArray[11].ToString()), dProm = DateTime.Parse(dt.Rows[0].ItemArray[10].ToString()), bMoldProt = bool.Parse(dt.Rows[0].ItemArray[12].ToString()), iMoldProt = decimal.Parse(dt.Rows[0].ItemArray[13].ToString()), bMoldSerie = bool.Parse(dt.Rows[0].ItemArray[14].ToString()), iMoldSerie = decimal.Parse(dt.Rows[0].ItemArray[15].ToString()), bCF = bool.Parse(dt.Rows[0].ItemArray[16].ToString()), iCF = decimal.Parse(dt.Rows[0].ItemArray[17].ToString()), bDevice = bool.Parse(dt.Rows[0].ItemArray[18].ToString()), iDevice = decimal.Parse(dt.Rows[0].ItemArray[19].ToString()), bObsolet = bool.Parse(dt.Rows[0].ItemArray[20].ToString()), iObsolet = decimal.Parse(dt.Rows[0].ItemArray[21].ToString()), bEngMan = bool.Parse(dt.Rows[0].ItemArray[22].ToString()), iEngMan = decimal.Parse(dt.Rows[0].ItemArray[23].ToString()), bDesign = bool.Parse(dt.Rows[0].ItemArray[24].ToString()), iDesign = decimal.Parse(dt.Rows[0].ItemArray[25].ToString()), bComponents = bool.Parse(dt.Rows[0].ItemArray[26].ToString()), iComponents = decimal.Parse(dt.Rows[0].ItemArray[27].ToString()), bOthers = bool.Parse(dt.Rows[0].ItemArray[28].ToString()), sOthers = dt.Rows[0].ItemArray[29].ToString(), iOthers = decimal.Parse(dt.Rows[0].ItemArray[30].ToString()), bPaint = bool.Parse(dt.Rows[0].ItemArray[31].ToString()), iPaint = decimal.Parse(dt.Rows[0].ItemArray[32].ToString()), bEmp = bool.Parse(dt.Rows[0].ItemArray[33].ToString()), iEmp = decimal.Parse(dt.Rows[0].ItemArray[34].ToString()), bBank = bool.Parse(dt.Rows[0].ItemArray[35].ToString()), iBank = decimal.Parse(dt.Rows[0].ItemArray[36].ToString()), bOthersC = bool.Parse(dt.Rows[0].ItemArray[37].ToString()), iOthersC = decimal.Parse(dt.Rows[0].ItemArray[38].ToString()), iPound = decimal.Parse(dt.Rows[0].ItemArray[39].ToString()), iDelta1 = int.Parse(dt.Rows[0].ItemArray[40].ToString()), iDelta2 = int.Parse(dt.Rows[0].ItemArray[41].ToString()), iCost = decimal.Parse(dt.Rows[0].ItemArray[42].ToString()), iMoldP = int.Parse(dt.Rows[0].ItemArray[43].ToString()), iMoldProtP = int.Parse(dt.Rows[0].ItemArray[44].ToString()), sObservations = dt.Rows[0].ItemArray[45].ToString(), iStart = int.Parse(dt.Rows[0].ItemArray[46].ToString()), iFR1 = decimal.Parse(dt.Rows[0].ItemArray[47].ToString()), iFR2 = decimal.Parse(dt.Rows[0].ItemArray[48].ToString()), iTotalInv = decimal.Parse(dt.Rows[0].ItemArray[49].ToString()), iTotalP = decimal.Parse(dt.Rows[0].ItemArray[50].ToString()) }; return(qct); }
public errorCompositeType UpdateQuote(QuoteCompositeType ect) { var lstError = new errorCompositeType(); try { bool bStatus = true; param = new SqlParameter[45]; param[0] = new SqlParameter("@fiid_exchange", SqlDbType.Int) { Value = ect.iExchange }; param[1] = new SqlParameter("@fiid_part_list", SqlDbType.Int) { Value = ect.iPartList }; param[2] = new SqlParameter("@fvSOP", SqlDbType.VarChar) { Value = ect.SOPCliente }; param[3] = new SqlParameter("@fdIn", SqlDbType.DateTime) { Value = ect.dIn }; param[4] = new SqlParameter("@fdprom", SqlDbType.DateTime) { Value = ect.dProm }; param[5] = new SqlParameter("@fdout", SqlDbType.DateTime) { Value = ect.dOut }; param[6] = new SqlParameter("@fbmold_prot", SqlDbType.Bit) { Value = ect.bMoldProt }; param[7] = new SqlParameter("@fimold_prot", SqlDbType.Decimal) { Value = ect.iMoldProt }; param[8] = new SqlParameter("@fbmold_serie", SqlDbType.Bit) { Value = ect.bMoldSerie }; param[9] = new SqlParameter("@fimold_serie", SqlDbType.Decimal) { Value = ect.iMoldSerie }; param[10] = new SqlParameter("@fbCF", SqlDbType.Bit) { Value = ect.bCF }; param[11] = new SqlParameter("@fiCF", SqlDbType.Decimal) { Value = ect.iCF }; param[12] = new SqlParameter("@fbdevice", SqlDbType.Bit) { Value = ect.bDevice }; param[13] = new SqlParameter("@fidevice", SqlDbType.Decimal) { Value = ect.iDevice }; param[14] = new SqlParameter("@fbobsolet", SqlDbType.Bit) { Value = ect.bObsolet }; param[15] = new SqlParameter("@fiobsolet", SqlDbType.Decimal) { Value = ect.iObsolet }; param[16] = new SqlParameter("@fbeng_man", SqlDbType.Bit) { Value = ect.bEngMan }; param[17] = new SqlParameter("@fieng_man", SqlDbType.Decimal) { Value = ect.iEngMan }; param[18] = new SqlParameter("@fbdesign", SqlDbType.Bit) { Value = ect.bDesign }; param[19] = new SqlParameter("@fidesign", SqlDbType.Decimal) { Value = ect.iDesign }; param[20] = new SqlParameter("@fbcomponents", SqlDbType.Bit) { Value = ect.bComponents }; param[21] = new SqlParameter("@ficomponets", SqlDbType.Decimal) { Value = ect.iComponents }; param[22] = new SqlParameter("@fbothers", SqlDbType.Decimal) { Value = ect.bOthers }; param[23] = new SqlParameter("@fvothers", SqlDbType.VarChar) { Value = ect.sOthers }; param[24] = new SqlParameter("@fiothers", SqlDbType.Decimal) { Value = ect.iOthers }; param[25] = new SqlParameter("@fbpaint", SqlDbType.Bit) { Value = ect.bPaint }; param[26] = new SqlParameter("@fipaint", SqlDbType.Decimal) { Value = ect.iPaint }; param[27] = new SqlParameter("@fbemp", SqlDbType.Bit) { Value = ect.bEmp }; param[28] = new SqlParameter("@fiemp", SqlDbType.Decimal) { Value = ect.iEmp }; param[29] = new SqlParameter("@fbbank", SqlDbType.Bit) { Value = ect.bBank }; param[30] = new SqlParameter("@fibank", SqlDbType.Decimal) { Value = ect.iBank }; param[31] = new SqlParameter("@fbothersC", SqlDbType.Bit) { Value = ect.bOthersC }; param[32] = new SqlParameter("@fiothersC", SqlDbType.Decimal) { Value = ect.iOthersC }; param[33] = new SqlParameter("@fipound", SqlDbType.Decimal) { Value = ect.iPound }; param[34] = new SqlParameter("@fidelta1", SqlDbType.Int) { Value = ect.iDelta1 }; param[35] = new SqlParameter("@fidelta2", SqlDbType.Int) { Value = ect.iDelta2 }; param[36] = new SqlParameter("@ficost", SqlDbType.Decimal) { Value = ect.iCost }; param[37] = new SqlParameter("@fimold_p", SqlDbType.Int) { Value = ect.iMoldP }; param[38] = new SqlParameter("@fimold_prot_p", SqlDbType.Int) { Value = ect.iMoldProtP }; param[39] = new SqlParameter("@fvobs", SqlDbType.VarChar) { Value = ect.sObservations }; param[40] = new SqlParameter("@fistart", SqlDbType.Int) { Value = ect.iStart }; param[41] = new SqlParameter("@fir1", SqlDbType.Decimal) { Value = ect.iFR1 }; param[42] = new SqlParameter("@fir2", SqlDbType.Decimal) { Value = ect.iFR2 }; param[43] = new SqlParameter("@fitotal_inv", SqlDbType.Decimal) { Value = ect.iTotalInv }; param[44] = new SqlParameter("@fitotal_piece", SqlDbType.Decimal) { Value = ect.iTotalP }; objDB.ExecStoredIUD("sp_updateQuote", param); lstError.bError = true; return(lstError); } catch (Exception ex) { lstError.bError = false; lstError.sError = ex.Message; return(lstError); } }