public string InsertProductTitle(ProductTypeProperty dataItem) { sql = @"INSERT INTO `product_type` ( ID , PRODUCT_TITLE , PRODUCT_SUB_CODE , DESCRIPTION , CREATE_USER ) ( SELECT 1 + coalesce((SELECT max(Id) FROM product_type), 0) , 'dataItem.PRODUCT_TITLE' , 'dataItem.PRODUCT_SUB_CODE' , 'dataItem.DESCRIPTION' , 'dataItem.CREATE_USER' )"; sql = sql.Replace("dataItem.PRODUCT_TITLE", dataItem.PRODUCT_TITLE); sql = sql.Replace("dataItem.PRODUCT_SUB_CODE", dataItem.PRODUCT_SUB_CODE); sql = sql.Replace("dataItem.DESCRIPTION", dataItem.DESCRIPTION); sql = sql.Replace("dataItem.CREATE_USER", dataItem.CREATE_USER); sql = sql.Replace("dataItem.LAST_USER", dataItem.LAST_USER); sql = sql.Replace("dataItem.CREATE_DATE", dataItem.CREATE_DATE); sql = sql.Replace("dataItem.LAST_DATE", dataItem.LAST_DATE); return(sql); }
public string SearchByProductSubCode(ProductTypeProperty dataItem) { sql = @"SELECT * FROM `product_type` WHERE PRODUCT_SUB_CODE = 'dataItem.PRODUCT_SUB_CODE'"; sql = sql.Replace("dataItem.PRODUCT_SUB_CODE", dataItem.PRODUCT_SUB_CODE); return(sql); }
public string SearchExistProductType(ProductTypeProperty dataItem) { sql = @"SELECT ID FROM product_type WHERE PRODUCT_TITLE = 'dataItem.PRODUCT_TITLE' "; sql = sql.Replace("dataItem.PRODUCT_TITLE", dataItem.PRODUCT_TITLE); return(sql); }
public string SearchProductTitle(ProductTypeProperty dataItem) { sql = @"SELECT * FROM `product_type` WHERE PRODUCT_SUB_CODE = 'dataItem.PRODUCT_SUB_CODE' AND PRODUCT_TITLE = 'dataItem.PRODUCT_TITLE'"; sql = sql.Replace("dataItem.PRODUCT_SUB_CODE", dataItem.PRODUCT_SUB_CODE); sql = sql.Replace("dataItem.PRODUCT_TITLE", dataItem.PRODUCT_TITLE); return(sql); }
public List <SerialProductTypeProperty> SearchSerialProductType() { List <SerialProductTypeProperty> _result = new List <SerialProductTypeProperty>(); try { _resultData = _models.SearchProductType(); if (_resultData.StatusOnDb == true) { if (_resultData.ResultOnDb.Rows.Count > 0) { for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++) { ProductTypeProperty _productType = new ProductTypeProperty { ID = _resultData.ResultOnDb.Rows[i]["PRODUCT_TYPE_ID"].ToString(), PRODUCT_TITLE = _resultData.ResultOnDb.Rows[i]["PRODUCT_TITLE"].ToString() }; SerialTypeProperty _serialType = new SerialTypeProperty { ID = _resultData.ResultOnDb.Rows[i]["SERIAL_TYPE_ID"].ToString(), SERIAL_FORMAT = _resultData.ResultOnDb.Rows[i]["SERIAL_FORMAT"].ToString(), DETAIL = _resultData.ResultOnDb.Rows[i]["DETAIL"].ToString() }; SerialProductTypeProperty _serialProductType = new SerialProductTypeProperty { PRODUCT_TYPE = _productType, SERIAL_TYPE = _serialType }; _result.Add(_serialProductType); } } } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
//public List<ProductTypeProperty> Search() //{ // List<ProductTypeProperty> _result = new List<ProductTypeProperty>(); // try // { // _resultData = _models.Search(); // if (_resultData.StatusOnDb == true) // { // if (_resultData.ResultOnDb.Rows.Count > 0) // { // for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++) // { // } // } // } // else // { // MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // } // return _result; // } // catch (Exception ex) // { // MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return _result; // } //} public List <ProductTypeProperty> SearchByProductSubCode(ProductTypeProperty dataItem) { List <ProductTypeProperty> _result = new List <ProductTypeProperty>(); try { _resultData = _models.SearchByProductSubCode(dataItem); if (_resultData.StatusOnDb == true) { if (_resultData.ResultOnDb.Rows.Count > 0) { for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++) { ProductTypeProperty ProductTypeProperty = new ProductTypeProperty() { ID = _resultData.ResultOnDb.Rows[i]["ID"].ToString(), PRODUCT_TITLE = _resultData.ResultOnDb.Rows[i]["PRODUCT_TITLE"].ToString(), PRODUCT_SUB_CODE = _resultData.ResultOnDb.Rows[i]["PRODUCT_SUB_CODE"].ToString(), DESCRIPTION = _resultData.ResultOnDb.Rows[i]["DESCRIPTION"].ToString(), CREATE_USER = _resultData.ResultOnDb.Rows[i]["CREATE_USER"].ToString(), LAST_USER = _resultData.ResultOnDb.Rows[i]["LAST_USER"].ToString(), CREATE_DATE = _resultData.ResultOnDb.Rows[i]["CREATE_DATE"].ToString(), LAST_DATE = _resultData.ResultOnDb.Rows[i]["LAST_DATE"].ToString(), }; _result.Add(ProductTypeProperty); } } } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
private void Load_ProductType() { cmbProductType.Items.Clear(); this.cmbProductType.SelectedIndex = -1; ProductTypeProperty _productTypeProperty = new ProductTypeProperty() { PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString() }; _listProductTypeProperty = _productTypeController.SearchByProductSubCode(_productTypeProperty); foreach (ProductTypeProperty data in _listProductTypeProperty) { ComboboxItem item = new ComboboxItem(); item.Text = data.PRODUCT_TITLE; item.Value = data.ID; cmbProductType.Items.Add(item); } }
private void Load_ProductType() { this.SetPage(); this.lstProductType.DataSource = null; lstProductType.Items.Clear(); ProductTypeProperty PRODUCT_TYPE = new ProductTypeProperty() { PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString() }; List <ProductTypeProperty> listProductTypeProperty = _productTypeController.SearchByProductSubCode(PRODUCT_TYPE); foreach (ProductTypeProperty data in listProductTypeProperty) { ListBoxItem item = new ListBoxItem(); item.Text = data.PRODUCT_TITLE; item.Value = data.ID; lstProductType.Items.Add(item); } ; }
public OutputOnDbProperty SearchByProductSubCode(ProductTypeProperty dataItem) { _resultData = _services.SearchByProductSubCode(dataItem); return(_resultData); }
set => SetValue(ProductTypeProperty, value);