private void UpdateRecord() { dbo_DimProductClass oclsdbo_DimProduct = new dbo_DimProductClass(); dbo_DimProductClass clsdbo_DimProduct = new dbo_DimProductClass(); oclsdbo_DimProduct.ProductKey = System.Convert.ToInt32(Session["ProductKey"]); oclsdbo_DimProduct = dbo_DimProductDataClass.Select_Record(oclsdbo_DimProduct); if (VerifyData() == true) { SetData(clsdbo_DimProduct); bool bSucess = false; bSucess = dbo_DimProductDataClass.Update(oclsdbo_DimProduct, clsdbo_DimProduct); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_DimProduct"); LoadGriddbo_DimProduct(); } else { ec.ShowMessage(" Update failed. ", " Dbo. Dim Product "); } } }
private void InsertRecord() { dbo_DimProductClass clsdbo_DimProduct = new dbo_DimProductClass(); if (VerifyData() == true) { SetData(clsdbo_DimProduct); bool bSucess = false; bSucess = dbo_DimProductDataClass.Add(clsdbo_DimProduct); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_DimProduct"); LoadGriddbo_DimProduct(); } else { ec.ShowMessage(" Insert failed. ", " Dbo. Dim Product "); } } }
private void SetData(dbo_DimProductClass clsdbo_DimProduct) { if (string.IsNullOrEmpty(txtProductAlternateKey.Text)) { clsdbo_DimProduct.ProductAlternateKey = null; } else { clsdbo_DimProduct.ProductAlternateKey = txtProductAlternateKey.Text; } if (string.IsNullOrEmpty(txtProductSubcategoryKey.SelectedValue)) { clsdbo_DimProduct.ProductSubcategoryKey = null; } else { clsdbo_DimProduct.ProductSubcategoryKey = System.Convert.ToInt32(txtProductSubcategoryKey.SelectedValue); } if (string.IsNullOrEmpty(txtWeightUnitMeasureCode.Text)) { clsdbo_DimProduct.WeightUnitMeasureCode = null; } else { clsdbo_DimProduct.WeightUnitMeasureCode = txtWeightUnitMeasureCode.Text; } if (string.IsNullOrEmpty(txtSizeUnitMeasureCode.Text)) { clsdbo_DimProduct.SizeUnitMeasureCode = null; } else { clsdbo_DimProduct.SizeUnitMeasureCode = txtSizeUnitMeasureCode.Text; } clsdbo_DimProduct.EnglishProductName = System.Convert.ToString(txtEnglishProductName.Text); clsdbo_DimProduct.SpanishProductName = System.Convert.ToString(txtSpanishProductName.Text); clsdbo_DimProduct.FrenchProductName = System.Convert.ToString(txtFrenchProductName.Text); if (string.IsNullOrEmpty(txtStandardCost.Text)) { clsdbo_DimProduct.StandardCost = null; } else { clsdbo_DimProduct.StandardCost = System.Convert.ToDecimal(txtStandardCost.Text); } clsdbo_DimProduct.FinishedGoodsFlag = System.Convert.ToBoolean(txtFinishedGoodsFlag.Checked ? true : false); clsdbo_DimProduct.Color = System.Convert.ToString(txtColor.Text); if (string.IsNullOrEmpty(txtSafetyStockLevel.Text)) { clsdbo_DimProduct.SafetyStockLevel = null; } else { clsdbo_DimProduct.SafetyStockLevel = System.Convert.ToInt16(txtSafetyStockLevel.Text); } if (string.IsNullOrEmpty(txtReorderPoint.Text)) { clsdbo_DimProduct.ReorderPoint = null; } else { clsdbo_DimProduct.ReorderPoint = System.Convert.ToInt16(txtReorderPoint.Text); } if (string.IsNullOrEmpty(txtListPrice.Text)) { clsdbo_DimProduct.ListPrice = null; } else { clsdbo_DimProduct.ListPrice = System.Convert.ToDecimal(txtListPrice.Text); } if (string.IsNullOrEmpty(txtSize.Text)) { clsdbo_DimProduct.Size = null; } else { clsdbo_DimProduct.Size = txtSize.Text; } if (string.IsNullOrEmpty(txtSizeRange.Text)) { clsdbo_DimProduct.SizeRange = null; } else { clsdbo_DimProduct.SizeRange = txtSizeRange.Text; } if (string.IsNullOrEmpty(txtWeight.Text)) { clsdbo_DimProduct.Weight = null; } else { clsdbo_DimProduct.Weight = System.Convert.ToDecimal(txtWeight.Text); } if (string.IsNullOrEmpty(txtDaysToManufacture.Text)) { clsdbo_DimProduct.DaysToManufacture = null; } else { clsdbo_DimProduct.DaysToManufacture = System.Convert.ToInt32(txtDaysToManufacture.Text); } if (string.IsNullOrEmpty(txtProductLine.Text)) { clsdbo_DimProduct.ProductLine = null; } else { clsdbo_DimProduct.ProductLine = txtProductLine.Text; } if (string.IsNullOrEmpty(txtDealerPrice.Text)) { clsdbo_DimProduct.DealerPrice = null; } else { clsdbo_DimProduct.DealerPrice = System.Convert.ToDecimal(txtDealerPrice.Text); } if (string.IsNullOrEmpty(txtClass.Text)) { clsdbo_DimProduct.Class = null; } else { clsdbo_DimProduct.Class = txtClass.Text; } if (string.IsNullOrEmpty(txtStyle.Text)) { clsdbo_DimProduct.Style = null; } else { clsdbo_DimProduct.Style = txtStyle.Text; } if (string.IsNullOrEmpty(txtModelName.Text)) { clsdbo_DimProduct.ModelName = null; } else { clsdbo_DimProduct.ModelName = txtModelName.Text; } if (string.IsNullOrEmpty(txtEnglishDescription.Text)) { clsdbo_DimProduct.EnglishDescription = null; } else { clsdbo_DimProduct.EnglishDescription = txtEnglishDescription.Text; } if (string.IsNullOrEmpty(txtFrenchDescription.Text)) { clsdbo_DimProduct.FrenchDescription = null; } else { clsdbo_DimProduct.FrenchDescription = txtFrenchDescription.Text; } if (string.IsNullOrEmpty(txtChineseDescription.Text)) { clsdbo_DimProduct.ChineseDescription = null; } else { clsdbo_DimProduct.ChineseDescription = txtChineseDescription.Text; } if (string.IsNullOrEmpty(txtArabicDescription.Text)) { clsdbo_DimProduct.ArabicDescription = null; } else { clsdbo_DimProduct.ArabicDescription = txtArabicDescription.Text; } if (string.IsNullOrEmpty(txtHebrewDescription.Text)) { clsdbo_DimProduct.HebrewDescription = null; } else { clsdbo_DimProduct.HebrewDescription = txtHebrewDescription.Text; } if (string.IsNullOrEmpty(txtThaiDescription.Text)) { clsdbo_DimProduct.ThaiDescription = null; } else { clsdbo_DimProduct.ThaiDescription = txtThaiDescription.Text; } if (string.IsNullOrEmpty(txtGermanDescription.Text)) { clsdbo_DimProduct.GermanDescription = null; } else { clsdbo_DimProduct.GermanDescription = txtGermanDescription.Text; } if (string.IsNullOrEmpty(txtJapaneseDescription.Text)) { clsdbo_DimProduct.JapaneseDescription = null; } else { clsdbo_DimProduct.JapaneseDescription = txtJapaneseDescription.Text; } if (string.IsNullOrEmpty(txtTurkishDescription.Text)) { clsdbo_DimProduct.TurkishDescription = null; } else { clsdbo_DimProduct.TurkishDescription = txtTurkishDescription.Text; } if (string.IsNullOrEmpty(txtStartDate.Text)) { clsdbo_DimProduct.StartDate = null; } else { clsdbo_DimProduct.StartDate = System.Convert.ToDateTime(txtStartDate.Text); } if (string.IsNullOrEmpty(txtEndDate.Text)) { clsdbo_DimProduct.EndDate = null; } else { clsdbo_DimProduct.EndDate = System.Convert.ToDateTime(txtEndDate.Text); } if (string.IsNullOrEmpty(txtStatus.Text)) { clsdbo_DimProduct.Status = null; } else { clsdbo_DimProduct.Status = txtStatus.Text; } }
private void GetData() { ClearRecord(); dbo_DimProductClass clsdbo_DimProduct = new dbo_DimProductClass(); clsdbo_DimProduct.ProductKey = System.Convert.ToInt32(Session["ProductKey"]); clsdbo_DimProduct = dbo_DimProductDataClass.Select_Record(clsdbo_DimProduct); if ((clsdbo_DimProduct != null)) { try { txtProductKey.Text = System.Convert.ToString(clsdbo_DimProduct.ProductKey); if (clsdbo_DimProduct.ProductAlternateKey == null) { txtProductAlternateKey.Text = default(string); } else { txtProductAlternateKey.Text = System.Convert.ToString(clsdbo_DimProduct.ProductAlternateKey); } if (clsdbo_DimProduct.ProductSubcategoryKey == null) { txtProductSubcategoryKey.SelectedValue = default(string); } else { txtProductSubcategoryKey.SelectedValue = System.Convert.ToString(clsdbo_DimProduct.ProductSubcategoryKey); } if (clsdbo_DimProduct.WeightUnitMeasureCode == null) { txtWeightUnitMeasureCode.Text = default(string); } else { txtWeightUnitMeasureCode.Text = System.Convert.ToString(clsdbo_DimProduct.WeightUnitMeasureCode); } if (clsdbo_DimProduct.SizeUnitMeasureCode == null) { txtSizeUnitMeasureCode.Text = default(string); } else { txtSizeUnitMeasureCode.Text = System.Convert.ToString(clsdbo_DimProduct.SizeUnitMeasureCode); } txtEnglishProductName.Text = System.Convert.ToString(clsdbo_DimProduct.EnglishProductName); txtSpanishProductName.Text = System.Convert.ToString(clsdbo_DimProduct.SpanishProductName); txtFrenchProductName.Text = System.Convert.ToString(clsdbo_DimProduct.FrenchProductName); if (clsdbo_DimProduct.StandardCost == null) { txtStandardCost.Text = default(string); } else { txtStandardCost.Text = System.Convert.ToString(clsdbo_DimProduct.StandardCost); } txtFinishedGoodsFlag.Checked = System.Convert.ToBoolean(clsdbo_DimProduct.FinishedGoodsFlag); txtColor.Text = System.Convert.ToString(clsdbo_DimProduct.Color); if (clsdbo_DimProduct.SafetyStockLevel == null) { txtSafetyStockLevel.Text = default(string); } else { txtSafetyStockLevel.Text = System.Convert.ToString(clsdbo_DimProduct.SafetyStockLevel); } if (clsdbo_DimProduct.ReorderPoint == null) { txtReorderPoint.Text = default(string); } else { txtReorderPoint.Text = System.Convert.ToString(clsdbo_DimProduct.ReorderPoint); } if (clsdbo_DimProduct.ListPrice == null) { txtListPrice.Text = default(string); } else { txtListPrice.Text = System.Convert.ToString(clsdbo_DimProduct.ListPrice); } if (clsdbo_DimProduct.Size == null) { txtSize.Text = default(string); } else { txtSize.Text = System.Convert.ToString(clsdbo_DimProduct.Size); } if (clsdbo_DimProduct.SizeRange == null) { txtSizeRange.Text = default(string); } else { txtSizeRange.Text = System.Convert.ToString(clsdbo_DimProduct.SizeRange); } if (clsdbo_DimProduct.Weight == null) { txtWeight.Text = default(string); } else { txtWeight.Text = System.Convert.ToString(clsdbo_DimProduct.Weight); } if (clsdbo_DimProduct.DaysToManufacture == null) { txtDaysToManufacture.Text = default(string); } else { txtDaysToManufacture.Text = System.Convert.ToString(clsdbo_DimProduct.DaysToManufacture); } if (clsdbo_DimProduct.ProductLine == null) { txtProductLine.Text = default(string); } else { txtProductLine.Text = System.Convert.ToString(clsdbo_DimProduct.ProductLine); } if (clsdbo_DimProduct.DealerPrice == null) { txtDealerPrice.Text = default(string); } else { txtDealerPrice.Text = System.Convert.ToString(clsdbo_DimProduct.DealerPrice); } if (clsdbo_DimProduct.Class == null) { txtClass.Text = default(string); } else { txtClass.Text = System.Convert.ToString(clsdbo_DimProduct.Class); } if (clsdbo_DimProduct.Style == null) { txtStyle.Text = default(string); } else { txtStyle.Text = System.Convert.ToString(clsdbo_DimProduct.Style); } if (clsdbo_DimProduct.ModelName == null) { txtModelName.Text = default(string); } else { txtModelName.Text = System.Convert.ToString(clsdbo_DimProduct.ModelName); } if (clsdbo_DimProduct.EnglishDescription == null) { txtEnglishDescription.Text = default(string); } else { txtEnglishDescription.Text = System.Convert.ToString(clsdbo_DimProduct.EnglishDescription); } if (clsdbo_DimProduct.FrenchDescription == null) { txtFrenchDescription.Text = default(string); } else { txtFrenchDescription.Text = System.Convert.ToString(clsdbo_DimProduct.FrenchDescription); } if (clsdbo_DimProduct.ChineseDescription == null) { txtChineseDescription.Text = default(string); } else { txtChineseDescription.Text = System.Convert.ToString(clsdbo_DimProduct.ChineseDescription); } if (clsdbo_DimProduct.ArabicDescription == null) { txtArabicDescription.Text = default(string); } else { txtArabicDescription.Text = System.Convert.ToString(clsdbo_DimProduct.ArabicDescription); } if (clsdbo_DimProduct.HebrewDescription == null) { txtHebrewDescription.Text = default(string); } else { txtHebrewDescription.Text = System.Convert.ToString(clsdbo_DimProduct.HebrewDescription); } if (clsdbo_DimProduct.ThaiDescription == null) { txtThaiDescription.Text = default(string); } else { txtThaiDescription.Text = System.Convert.ToString(clsdbo_DimProduct.ThaiDescription); } if (clsdbo_DimProduct.GermanDescription == null) { txtGermanDescription.Text = default(string); } else { txtGermanDescription.Text = System.Convert.ToString(clsdbo_DimProduct.GermanDescription); } if (clsdbo_DimProduct.JapaneseDescription == null) { txtJapaneseDescription.Text = default(string); } else { txtJapaneseDescription.Text = System.Convert.ToString(clsdbo_DimProduct.JapaneseDescription); } if (clsdbo_DimProduct.TurkishDescription == null) { txtTurkishDescription.Text = default(string); } else { txtTurkishDescription.Text = System.Convert.ToString(clsdbo_DimProduct.TurkishDescription); } if (clsdbo_DimProduct.StartDate == null) { txtStartDate.Text = DateTime.Now.ToString(); } else { txtStartDate.Text = System.Convert.ToDateTime(clsdbo_DimProduct.StartDate).ToShortDateString(); } if (clsdbo_DimProduct.EndDate == null) { txtEndDate.Text = DateTime.Now.ToString(); } else { txtEndDate.Text = System.Convert.ToDateTime(clsdbo_DimProduct.EndDate).ToShortDateString(); } if (clsdbo_DimProduct.Status == null) { txtStatus.Text = default(string); } else { txtStatus.Text = System.Convert.ToString(clsdbo_DimProduct.Status); } } catch (Exception ex) { ec.ShowMessage(ex.Message, " Dbo. Dim Product "); } } }