public bool SaveValuationItemsApplyToSel(string AssessedFreight, string assessedInsurance, string ValuationMethod, string TransID, string itemID, string DeclaredUnitFOB, string AssessedUnitFOB, string ValuationNotes) { Nullable<Decimal> AssFreight; Nullable<Decimal> AssInsurance; valHeader = new ValuationHeader(); //valItem = new ValuationItems(); if (AssessedFreight.Trim().Length == 0) AssFreight = null; else AssFreight = System.Convert.ToDecimal(AssessedFreight); if (assessedInsurance.Trim().Length == 0) AssInsurance = null; else AssInsurance = System.Convert.ToDecimal(assessedInsurance); if (ValuationMethod == null) { errorMessage = "Please, Select Valuation Method for Apply to Selection"; return false; } if (!((Convert.ToInt16(ValuationMethod) == 852) || (Convert.ToInt16(ValuationMethod) == 854))) { errorMessage = "Valuation Method not Allowed for Apply to Selection"; return false; } // if (MessageBox.Show("Are you sure you want to Apply to All?", "Confirm Apply to Selection", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) //{ try { valHeader.setValuationID(ValuationID); if (valHeader.ValuationID == null || valHeader.ValuationID == 0) { valHeader.ImportID = _ImportID; valHeader.PartitionDate = valHeaderPartittionDate; valHeader.FreightAssessed = AssFreight; valHeader.InsAssessed = AssInsurance; valHeader.Status = 1; valHeader.Pulled = false; valHeader.DraftUserID = GlobalFunctions.gLoginUserCode; valHeader.Create(GlobalFunctions.gLoginUserCode); } //foreach (DataGridViewRow row in dgvLineItems.SelectedRows) // { valItem = new ValuationItems(); if (string.IsNullOrEmpty(TransID.ToString().Trim())) { valItem.ValuationID = valHeader.ValuationID; valItem.ItemID = Convert.ToInt32(itemID); valItem.PartitionDate = valHeaderPartittionDate; valItem.ValMethod = System.Convert.ToInt32(ValuationMethod); valItem.AssessedUnitFOB = System.Convert.ToDecimal(DeclaredUnitFOB); valItem.DraftUserID = GlobalFunctions.gLoginUserCode; valItem.Notes = ValuationNotes; valItem.Create(GlobalFunctions.gLoginUserCode); //row.Cells["TransID"].Value = valItem.TransID; errorMessage = valItem.TransID.ToString(); } else { valItem.TransID = Convert.ToInt32(TransID); valItem.ValuationID = valHeader.ValuationID; valItem.ItemID = Convert.ToInt32(itemID); valItem.PartitionDate = valHeaderPartittionDate; valItem.ValMethod = System.Convert.ToInt32(ValuationMethod); valItem.AssessedUnitFOB = System.Convert.ToDecimal(AssessedUnitFOB); valItem.DraftUserID = GlobalFunctions.gLoginUserCode; valItem.Notes = ValuationNotes; valItem.Update(GlobalFunctions.gLoginUserCode); errorMessage = valItem.TransID.ToString(); } // Update row here //row.Cells["ValMethod"].Value = cboValMethod.SelectedValue; //row.Cells["ValuationNotes"].Value = txtValNotes.Text; //row.Cells["AssessedUnitFOB"].Value = row.Cells["DeclUnitFOB"].Value; // } // Compute Total Assessed FOB and Total Assessed Value //ComputeTotalAssessedFOBandValue(); //Move to first item //dgvLineItems.CurrentCell = dgvLineItems.Rows[0].Cells["LineNo"]; return true; } catch (Exception ex) { errorMessage = ex.ToString() + "\n Could not Accept All Declared Values"; return false; } // } return false; }
public static string AjaxSendToIU(string remarks,string submissionID, string versionNo, string importID,string valuationID) { //string returnValue = ""; ValuationHeader valHeader = new ValuationHeader(); Valuation val = new Valuation(); try { valHeader.setSubmission(Convert.ToInt32(submissionID)); valHeader.PartitionDate = valHeaderPartittionDate; valHeader.ImportID = Convert.ToInt32(importID); valHeader.VersionNo = Convert.ToInt16(versionNo); valHeader.Remarks = remarks; valHeader.setValuationID(Convert.ToInt32(valuationID)); if (valHeader.SendToIU(Convert.ToInt16(GlobalFunctions.gLoginUserCode), remarks)) { val.errorMessage = "Saved"; } else { val.errorMessage = "Error"; } } catch(Exception ex) { val.errorMessage = ex.Message.ToString(); } return val.errorMessage; }
public static string ValuationSave(string ValuationMethod,string DeclaredUnitFOB,string AssessedUnitFOB, string AssessedFreight, string itemID, string assessedInsurance, string Remarks,string importID, string VersionNo,string TransID, string DeclareQuantity) { Valuation val = new Valuation(); ValuationHeader valHeader = new ValuationHeader(); ValuationItems valItem = new ValuationItems(); // string errorMessage = ""; try { // valHeader.ValuationID = ValuationID; valHeader.setValuationID(ValuationID); //GlobalFunctions.gLoginUserCode = Convert.ToInt16(Session["genFlux_login_UCode"].ToString()); if (val.SaveValidate(ValuationMethod, AssessedUnitFOB, DeclaredUnitFOB)) { long selectedItem; int dRowIndex; Nullable<Decimal> AssFreight; Nullable<Decimal> AssInsurance; //DataGridViewRow row = dgvLineItems.CurrentRow; selectedItem = Convert.ToInt32(itemID); //dRowIndex = row.Index; if (AssessedFreight.Length == 0) AssFreight = null; else AssFreight = System.Convert.ToDecimal(AssessedFreight); if (assessedInsurance.Length == 0) AssInsurance = null; else AssInsurance = System.Convert.ToDecimal(assessedInsurance); valHeader.Pulled = Pulled; valHeader.Status = Status; valHeader.ImportID = Convert.ToInt32(importID); valHeader.VersionNo = Convert.ToInt32(VersionNo); valHeader.FreightAssessed = AssFreight; valHeader.InsAssessed = AssInsurance; if (valHeader.ValuationID == null || valHeader.ValuationID == 0) { valHeader.ImportID = Convert.ToInt32(importID); valHeader.PartitionDate = valHeaderPartittionDate; valHeader.Status = 1; valHeader.Pulled = false; valHeader.Remarks = Remarks; valHeader.DraftUserID = GlobalFunctions.gLoginUserCode; valHeader.VersionNo = Convert.ToInt16(VersionNo); valHeader.Create(GlobalFunctions.gLoginUserCode) ; } else { //if (valHeader.FreightAssessed != AssFreight || (valHeader.InsAssessed != AssInsurance)) //{ //valHeader.FreightAssessed = AssFreight; //valHeader.InsAssessed = AssInsurance; //} valHeader.Remarks = Remarks; valHeader.Update(GlobalFunctions.gLoginUserCode); } valItem.VersionNo = Convert.ToInt16(VersionNo); if (string.IsNullOrEmpty(TransID.ToString().Trim())) { valItem.ValuationID = valHeader.ValuationID; valItem.ItemID = selectedItem; valItem.PartitionDate = valHeaderPartittionDate; valItem.ValMethod = System.Convert.ToInt32(ValuationMethod); if ((Convert.ToInt16(ValuationMethod) == 852/*Val Method 1*/) || (Convert.ToInt16(ValuationMethod) == 854 /*Val Method 1D*/)) { valItem.AssessedUnitFOB = System.Convert.ToDecimal(DeclaredUnitFOB); //val.errorMessage = "ValItem Save"; } else { valItem.AssessedUnitFOB = System.Convert.ToDecimal(AssessedUnitFOB); //val.errorMessage = "ValItem Save Not"; } valItem.DraftUserID = GlobalFunctions.gLoginUserCode; //valItem.Notes = txtValNotes.Text; valItem.Create(GlobalFunctions.gLoginUserCode); //row.Cells["TransID"].Value = valItem.TransID; val.errorMessage = valItem.TransID.ToString(); } else { valItem.TransID = Convert.ToInt32(TransID); valItem.ValuationID = valHeader.ValuationID; valItem.ItemID = selectedItem; valItem.PartitionDate = valHeaderPartittionDate; valItem.ValMethod = System.Convert.ToInt16(ValuationMethod); if ((Convert.ToInt16(ValuationMethod) == 852/*Val Method 1*/) || (Convert.ToInt16(ValuationMethod) == 854)) { valItem.AssessedUnitFOB = System.Convert.ToDecimal(DeclaredUnitFOB); val.errorMessage = "ValItem Update"; } else { valItem.AssessedUnitFOB = System.Convert.ToDecimal(AssessedUnitFOB); val.errorMessage = "ValItem Update"; } valItem.DraftUserID = GlobalFunctions.gLoginUserCode; // valItem.Notes = txtValNotes.Text; valItem.Update(GlobalFunctions.gLoginUserCode); val.errorMessage = valItem.TransID.ToString(); } // Update row here Decimal AssUnitFOB = (AssessedUnitFOB.Trim().Length == 0 ? 0 : System.Convert.ToDecimal(AssessedUnitFOB)); Decimal Qty = (DeclareQuantity.Trim().Length == 0 ? 0 : System.Convert.ToDecimal(DeclareQuantity)); Decimal AssFOB = AssUnitFOB * Qty; /* row.Cells["ValMethod"].Value = cboValMethod.SelectedValue; row.Cells["ValuationNotes"].Value = txtValNotes.Text; row.Cells["AssessedUnitFOB"].Value = valItem.AssessedUnitFOB.Value; dgvLineItems.UpdateCellValue(row.Cells["AssessedUnitFOB"].ColumnIndex, row.Cells["AssessedUnitFOB"].RowIndex); // Compute Total Assessed FOB and Total Assessed Value ComputeTotalAssessedFOBandValue(); // Move to next row available if (dRowIndex < dgvLineItems.Rows.Count - 1) { //dgvLineItems.CurrentCell = dgvLineItems.Rows[dRowIndex + 1].Cells["LineNo"]; } */ //val.errorMessage = "Saved".Trim(); //Debug: val.errorMessage = "ValMethod=> " + valItem.ValMethod + " DeclUnitFOB =>" + DeclaredUnitFOB + " AssessedUnitFOB=>" + valItem.AssessedUnitFOB + " AssFriehgt=> " + valHeader.FreightAssessed + " ItemID=>" + valItem.ItemID + " AssInsurance=>" + valHeader.InsAssessed + " Remarks=>" + valHeader.Remarks + " ImportID=>" + valHeader.ImportID + " VersionNo=>" + valHeader.VersionNo + " TransID=>" + valItem.TransID + " Valitem.ValID=>" + valItem.ValuationID + " User=>" + GlobalFunctions.gLoginUserCode + "error =>" + val.errorMessage; //val.populateGrid(); } //errorMessage = "ValMethod=> " + ValuationMethod + " DeclUnitFOB =>" + DeclaredUnitFOB + " AssessedUnitFOB=>" + AssessedUnitFOB + " AssFriehgt=> " + AssessedFreight + " ItemID=>" + itemID + " AssInsurance=>" + assessedInsurance + " Remarks=>" + Remarks + " ImportID=>" + importID + " VersionNo=>" + VersionNo + " TransID=>" + TransID + " DeclQtty=>" + DeclareQuantity + " User=>" + GlobalFunctions.gLoginUserCode; return val.errorMessage; } catch (Exception ex) { val. errorMessage += ex.Message.ToString(); return Status +" "+ val.errorMessage; } }