protected override async Task OnInitializedAsync() { if (!string.IsNullOrEmpty(Product_Class) && Product_Class != "0") { ProductMasterDO = await productMasterDataService.GetProductMasterRecordByNumber(Product_Class); } }
public ProductMasterDO UpdateProductMaster(ProductMasterDO prodObj) { string site_op = string.Empty; try { using (SqlConnection connection = new SqlConnection(FMEADBConnectionstring)) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "FMEA_SP_UpdateProduct"; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandTimeout = FMEADBTimeout; command.Parameters.AddWithValue("@Product_Class", prodObj.Product_Class); command.Parameters.AddWithValue("@Essex_Specification", prodObj.Essex_Specification); connection.Open(); command.ExecuteNonQuery(); } } } catch (SqlException ex) { throw ex; } return(prodObj); }
protected async void HandleValidSubmit() { try { if (string.IsNullOrEmpty(Product_Class) || Product_Class == "0") { //Add Site ProductMasterDO = await productMasterDataService.CreateProductMasterRecord(ProductMasterDO).ContinueWith(t => { toastService.ShowSuccess("Record created successfully!"); return(t.Result); }); } else { //Update Site ProductMasterDO = await productMasterDataService.UpdateProductMasterRecord(ProductMasterDO).ContinueWith(t => { toastService.ShowSuccess("Record updated successfullly!"); return(t.Result); }); } navigationManager.NavigateTo("/ProductMaster"); } catch (System.Exception ex) { throw ex; } }
public IEnumerable <ProductMasterDO> GetAll() { List <ProductMasterDO> ProductMaster = new List <ProductMasterDO>(); try { using (SqlConnection connection = new SqlConnection(FMEADBConnectionstring)) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "FMEA_SP_GetAllProductRecords"; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandTimeout = FMEADBTimeout; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { ProductMasterDO pMaster = new ProductMasterDO() { Product_Class = reader.IsDBNull(reader.GetOrdinal(FMEAConstants.Product_Class)) ? null : reader.GetString(reader.GetOrdinal(FMEAConstants.Product_Class)), Essex_Specification = reader.IsDBNull(reader.GetOrdinal(FMEAConstants.Essex_Specification)) ? null : reader.GetString(reader.GetOrdinal(FMEAConstants.Essex_Specification)), }; ProductMaster.Add(pMaster); } } } } catch (Exception) { throw; } return(ProductMaster); }
public IActionResult CreateProductMasterRecord(ProductMasterDO ProductMasterDO) { return(Ok(_productMasterRepository.CreateProductMaster(ProductMasterDO))); }
public async Task <ProductMasterDO> CreateProductMasterRecord(ProductMasterDO ProductMasterDO) { return(await _httpClient.PostJsonAsync <ProductMasterDO>($"/api/ProductMaster", ProductMasterDO)); }