Esempio n. 1
0
        public string SearchSerialFormat(SerialTypeProperty dataItem)
        {
            sql = @"SELECT
                    ID
                    ,SERIAL_FORMAT
                    ,DETAIL
	
                    FROM
	                    `serial_type`
                    WHERE REPLACE(serial_type.SERIAL_FORMAT , ' ' , '') = REPLACE('" + dataItem.SERIAL_FORMAT + "', ' ' , '');";

            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);
            }
        }
Esempio n. 3
0
        public string InsertSerialFormat(SerialTypeProperty dataItem)
        {
            sql = @"INSERT INTO `serial_type` (
                        ID
                        ,SERIAL_FORMAT
                        ,DETAIL
                    )
                    (
                        SELECT CASE WHEN COUNT(`ID`) = 0 THEN 1 ELSE MAX(`ID`)+1 END AS `ID`
                            ,'" + dataItem.SERIAL_FORMAT + @"' AS `SERIAL_FORMAT`
                            ,'" + dataItem.DETAIL + @"' AS `DETAIL`

                        FROM `serial_type`
                    );";

            return(sql);
        }
Esempio n. 4
0
        public List <SerialTypeProperty> Search()
        {
            List <SerialTypeProperty> _result = new List <SerialTypeProperty>();

            try
            {
                _resultData = _models.Search();
                if (_resultData.StatusOnDb == true)
                {
                    if (_resultData.ResultOnDb.Rows.Count > 0)
                    {
                        for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++)
                        {
                            SerialTypeProperty SerialTypeProperty = new SerialTypeProperty()
                            {
                                ID            = _resultData.ResultOnDb.Rows[i]["ID"].ToString(),
                                SERIAL_FORMAT = _resultData.ResultOnDb.Rows[i]["SERIAL_FORMAT"].ToString(),
                                DETAIL        = _resultData.ResultOnDb.Rows[i]["DETAIL"].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(SerialTypeProperty);
                        }
                    }
                }
                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);
            }
        }