Beispiel #1
0
        public bool UpdateSystemAdmin(SystemAdminDTO dtoSysAdmin)
        {
            bool   result = true;
            string query  = string.Format("UPDATE SYSTEM_ADMIN SET SYS_PWD = @SYS_PWD, SYS_GAS92_CURRENT_PRICE = @SYS_GAS92_CURRENT_PRICE, SYS_GAS95_CURRENT_PRICE = @SYS_GAS95_CURRENT_PRICE, SYS_GASDO_CURRENT_PRICE = @SYS_GASDO_CURRENT_PRICE " +
                                          "SYS_GAS92_NEW_PRICE = @SYS_GAS92_NEW_PRICE, SYS_GAS95_NEW_PRICE = @SYS_GAS95_NEW_PRICE, SYS_GASDO_NEW_PRICE = @SYS_GASDO_NEW_PRICE, SYS_APPLY_DATE = @SYS_APPLY_DATE " +
                                          " WHERE SYS_ADMIN = @SYS_ADMIN");

            SqlParameter[] sqlParameters = new SqlParameter[9];
            sqlParameters[0]       = new SqlParameter("@SYS_ADMIN", SqlDbType.NVarChar);
            sqlParameters[0].Value = Convert.ToString(dtoSysAdmin.SysAdminAccount);
            sqlParameters[1]       = new SqlParameter("@SYS_PWD", SqlDbType.NVarChar);
            sqlParameters[1].Value = Convert.ToString(dtoSysAdmin.SysAdminPwd);
            sqlParameters[2]       = new SqlParameter("@SYS_GAS92_CURRENT_PRICE", SqlDbType.Int);
            sqlParameters[2].Value = Convert.ToInt32(dtoSysAdmin.SysGas92CurrentPrice);
            sqlParameters[3]       = new SqlParameter("@SYS_GAS95_CURRENT_PRICE", SqlDbType.Int);
            sqlParameters[3].Value = Convert.ToInt32(dtoSysAdmin.SysGas95CurrentPrice);
            sqlParameters[4]       = new SqlParameter("@SYS_GASDO_CURRENT_PRICE", SqlDbType.Int);
            sqlParameters[4].Value = Convert.ToInt32(dtoSysAdmin.SysGasDOCurrentPrice);
            sqlParameters[5]       = new SqlParameter("@SYS_GAS92_NEW_PRICE", SqlDbType.Int);
            sqlParameters[5].Value = Convert.ToInt32(dtoSysAdmin.SysGas92NewPrice);
            sqlParameters[6]       = new SqlParameter("@SYS_GAS95_NEW_PRICE", SqlDbType.Int);
            sqlParameters[6].Value = Convert.ToInt32(dtoSysAdmin.SysGas95NewPrice);
            sqlParameters[7]       = new SqlParameter("@SYS_GASDO_NEW_PRICE", SqlDbType.Int);
            sqlParameters[7].Value = Convert.ToInt32(dtoSysAdmin.SysGasDONewPrice);
            sqlParameters[8]       = new SqlParameter("@SYS_APPLY_DATE", SqlDbType.DateTime);
            sqlParameters[8].Value = Convert.ToDateTime(dtoSysAdmin.SysApplyDate);

            result = m_dbConnection.ExecuteUpdateQuery(query, sqlParameters);
            return(result);
        }
Beispiel #2
0
        private float m_fGasStoreGasDOTotal;   //total gasDO in store

        public DataTransfer()
        {
            m_iResponseCode                    = RESPONSE_CODE_NONE;
            m_stResponseErrorMsg               = "";
            m_stResponseErrorMsgDetail         = "";
            m_stResponseDataString             = "";
            m_bResponseDataBool                = false;
            m_dtoResponseDataCustomerDTO       = null;
            m_dtoResponseDataCardDTO           = null;
            m_dtoResponseDataGasStationDTO     = null;
            m_dtoResponseDataRechargeDTO       = null;
            m_dtoResponseDataSaleGasDTO        = null;
            m_dtoResponseDataSystemAdminDTO    = null;
            m_dtoResponseDataGasStoreDTO       = null;
            m_dtoResponseDataGasStoreUpdateDTO = null;
            m_dsResponseDataSet                = null;

            m_iCurrentPriceGas92 = 0;
            m_iCurrentPriceGas95 = 0;
            m_iCurrentPriceGasDO = 0;

            m_fGasStoreGas92Total = 0;
            m_fGasStoreGas95Total = 0;
            m_fGasStoreGasDOTotal = 0;
        }
Beispiel #3
0
        //public DataSet GetSystemAdminInfo(string admin, string pwd)
        //{
        //    string query = string.Format("SELECT * FROM SYSTEM_ADMIN WHERE SYS_ADMIN = @SYS_ADMIN AND SYS_PWD = @SYS_PWD");
        //    SqlParameter[] sqlParameters = new SqlParameter[2];
        //    sqlParameters[0] = new SqlParameter("@SYS_ADMIN", SqlDbType.NVarChar);
        //    sqlParameters[0].Value = Convert.ToString(admin);
        //    sqlParameters[1] = new SqlParameter("@SYS_PWD", SqlDbType.NVarChar);
        //    sqlParameters[1].Value = Convert.ToString(pwd);
        //    DataTable tblResult = m_dbConnection.ExecuteSelectQuery(query, sqlParameters);
        //    if (tblResult.Rows.Count > 0)
        //    {
        //        DataSet ds = new DataSet();
        //        ds.Tables.Add(tblResult.Copy());
        //        return ds;
        //    }
        //    return null;
        //}

        public SystemAdminDTO GetSystemAdminInfo(string admin, string pwd)
        {
            SystemAdminDTO dtoSysAdmin = null;
            string         query       = string.Format("SELECT * FROM SYSTEM_ADMIN WHERE SYS_ADMIN = @SYS_ADMIN AND SYS_PWD = @SYS_PWD");

            SqlParameter[] sqlParameters = new SqlParameter[2];
            sqlParameters[0]       = new SqlParameter("@SYS_ADMIN", SqlDbType.NVarChar);
            sqlParameters[0].Value = Convert.ToString(admin);
            sqlParameters[1]       = new SqlParameter("@SYS_PWD", SqlDbType.NVarChar);
            sqlParameters[1].Value = Convert.ToString(pwd);
            DataTable tblResult = m_dbConnection.ExecuteSelectQuery(query, sqlParameters);

            if (tblResult.Rows.Count > 0)
            {
                dtoSysAdmin = new SystemAdminDTO();
                foreach (DataRow dr in tblResult.Rows)
                {
                    dtoSysAdmin.SysAdminAccount      = dr["SYS_ADMIN"].ToString();
                    dtoSysAdmin.SysAdminPwd          = dr["SYS_PWD"].ToString();
                    dtoSysAdmin.SysGas92CurrentPrice = Int32.Parse(dr["SYS_GAS92_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGas95CurrentPrice = Int32.Parse(dr["SYS_GAS95_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGasDOCurrentPrice = Int32.Parse(dr["SYS_GASDO_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGas92NewPrice     = Int32.Parse(dr["SYS_GAS92_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysGas95NewPrice     = Int32.Parse(dr["SYS_GAS95_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysGasDONewPrice     = Int32.Parse(dr["SYS_GASDO_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysApplyDate         = DateTime.Parse(dr["SYS_APPLY_DATE"].ToString());
                }
            }
            return(dtoSysAdmin);
        }
Beispiel #4
0
        public DataTransfer UpdateSystemAdminPrice(SystemAdminDTO dtoSysAdmin)
        {
            DataTransfer dataResult = new DataTransfer();

            try
            {
                string query = string.Format("UPDATE SYSTEM_ADMIN SET SYS_GAS92_CURRENT_PRICE = @SYS_GAS92_CURRENT_PRICE, SYS_GAS95_CURRENT_PRICE = @SYS_GAS95_CURRENT_PRICE, SYS_GASDO_CURRENT_PRICE = @SYS_GASDO_CURRENT_PRICE, " +
                                             "SYS_GAS92_NEW_PRICE = @SYS_GAS92_NEW_PRICE, SYS_GAS95_NEW_PRICE = @SYS_GAS95_NEW_PRICE, SYS_GASDO_NEW_PRICE = @SYS_GASDO_NEW_PRICE, SYS_APPLY_DATE = @SYS_APPLY_DATE " +
                                             " WHERE SYS_ADMIN = @SYS_ADMIN");
                SqlParameter[] sqlParameters = new SqlParameter[8];
                sqlParameters[0]       = new SqlParameter("@SYS_ADMIN", SqlDbType.NVarChar);
                sqlParameters[0].Value = Convert.ToString(dtoSysAdmin.SysAdminAccount);
                sqlParameters[1]       = new SqlParameter("@SYS_GAS92_CURRENT_PRICE", SqlDbType.Int);
                sqlParameters[1].Value = Convert.ToInt32(dtoSysAdmin.SysGas92CurrentPrice);
                sqlParameters[2]       = new SqlParameter("@SYS_GAS95_CURRENT_PRICE", SqlDbType.Int);
                sqlParameters[2].Value = Convert.ToInt32(dtoSysAdmin.SysGas95CurrentPrice);
                sqlParameters[3]       = new SqlParameter("@SYS_GASDO_CURRENT_PRICE", SqlDbType.Int);
                sqlParameters[3].Value = Convert.ToInt32(dtoSysAdmin.SysGasDOCurrentPrice);
                sqlParameters[4]       = new SqlParameter("@SYS_GAS92_NEW_PRICE", SqlDbType.Int);
                sqlParameters[4].Value = Convert.ToInt32(dtoSysAdmin.SysGas92NewPrice);
                sqlParameters[5]       = new SqlParameter("@SYS_GAS95_NEW_PRICE", SqlDbType.Int);
                sqlParameters[5].Value = Convert.ToInt32(dtoSysAdmin.SysGas95NewPrice);
                sqlParameters[6]       = new SqlParameter("@SYS_GASDO_NEW_PRICE", SqlDbType.Int);
                sqlParameters[6].Value = Convert.ToInt32(dtoSysAdmin.SysGasDONewPrice);
                sqlParameters[7]       = new SqlParameter("@SYS_APPLY_DATE", SqlDbType.DateTime);
                sqlParameters[7].Value = Convert.ToDateTime(dtoSysAdmin.SysApplyDate);

                bool result = m_dbConnection.ExecuteUpdateQuery(query, sqlParameters);
                if (result)
                {
                    dataResult.ResponseCode     = DataTransfer.RESPONSE_CODE_SUCCESS;
                    dataResult.ResponseErrorMsg = SGMText.ADMIN_UPDATE_PRICE_SUCCESS;
                }
                else
                {
                    dataResult.ResponseCode     = DataTransfer.RESPONSE_CODE_FAIL;
                    dataResult.ResponseErrorMsg = SGMText.ADMIN_UPDATE_PRICE_ERR;
                }
            }
            catch (Exception ex)
            {
                dataResult.ResponseCode           = DataTransfer.RESPONSE_CODE_FAIL;
                dataResult.ResponseErrorMsg       = SGMText.ADMIN_UPDATE_PRICE_ERR;
                dataResult.ResponseErrorMsgDetail = ex.Message + " : " + ex.StackTrace;
            }

            return(dataResult);
        }
Beispiel #5
0
        public frmSGMSaleGas(SystemAdminDTO adminDTO, GasStationDTO gasStationDTO, int priceGas92, int priceGas95, int priceGasDO, float totalGas92, float totalGas95, float totalGasDO)
        {
            InitializeComponent();
            _adminDTO      = adminDTO;
            _gasStationDTO = gasStationDTO;

            m_iCurrentPriceGas92 = priceGas92;
            m_iCurrentPriceGas95 = priceGas95;
            m_iCurrentPriceGasDO = priceGasDO;
            m_iCurrentTotalGas92 = totalGas92;
            m_iCurrentTotalGas95 = totalGas95;
            m_iCurrentTotalGasDO = totalGasDO;
            m_jsHelper           = new JSonHelper();
            frmMsg               = new frmSGMMessage();
            frmCardInfo          = new frmSGMCardDetail(_cardDTO, _rechargeDTO);
            lblCurrentPrice.Text = SGMText.SALEGAS_CURRENT_PRICE + SGMText.GAS_92_TEXT + " : " + m_iCurrentPriceGas92 + " , " + SGMText.GAS_95_TEXT + " : " + m_iCurrentPriceGas95 + " , " + SGMText.GAS_DO_TEXT + " : " + m_iCurrentPriceGasDO;
        }
Beispiel #6
0
        public string ValidateAdminLogin(string admin, string pwd)
        {
            SystemAdminDAL dalSysAdmin = new SystemAdminDAL();
            DataTransfer   response    = new DataTransfer();
            SystemAdminDTO dto         = dalSysAdmin.GetSystemAdminInfo(admin, pwd);

            if (dto != null)
            {
                response.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS;
                response.ResponseDataSystemAdminDTO = dto;
            }
            else
            {
                response.ResponseCode     = DataTransfer.RESPONSE_CODE_FAIL;
                response.ResponseErrorMsg = SGMText.ADMIN_LOGON_ERROR;
            }
            return(JSonHelper.ConvertObjectToJSon(response));
        }
Beispiel #7
0
        public DataTransfer GetCurrentPrice(int iGasType)
        {
            DataTransfer dataResult = new DataTransfer();

            try
            {
                string    query     = string.Format("SELECT (CAST(SYS_APPLY_DATE AS FLOAT) - CAST(GETDATE() AS FLOAT)) AS RESULT_DATE, * FROM SYSTEM_ADMIN");
                DataTable tblResult = m_dbConnection.ExecuteSelectQuery(query, new SqlParameter[0]);

                if (tblResult.Rows.Count > 0)
                {
                    double resultDate = Double.Parse(tblResult.Rows[0]["RESULT_DATE"].ToString());
                    if (resultDate >= 0)
                    {
                        if (iGasType == SystemAdminDTO.GAS_TYPE_92)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_NEW_PRICE"].ToString());
                        }
                        else if (iGasType == SystemAdminDTO.GAS_TYPE_95)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GAS95_NEW_PRICE"].ToString());
                        }
                        else if (iGasType == SystemAdminDTO.GAS_TYPE_DO)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GASDO_NEW_PRICE"].ToString());
                        }
                        else
                        {
                            dataResult.ResponseCurrentPriceGas92 = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_NEW_PRICE"].ToString());
                            dataResult.ResponseCurrentPriceGas95 = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_NEW_PRICE"].ToString());
                            dataResult.ResponseCurrentPriceGasDO = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_NEW_PRICE"].ToString());
                        }
                    }
                    else
                    {
                        if (iGasType == SystemAdminDTO.GAS_TYPE_92)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_CURRENT_PRICE"].ToString());
                        }
                        else if (iGasType == SystemAdminDTO.GAS_TYPE_95)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GAS95_CURRENT_PRICE"].ToString());
                        }
                        else if (iGasType == SystemAdminDTO.GAS_TYPE_DO)
                        {
                            dataResult.ResponseDataInt = Int32.Parse(tblResult.Rows[0]["SYS_GASDO_CURRENT_PRICE"].ToString());
                        }
                        else
                        {
                            dataResult.ResponseCurrentPriceGas92 = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_CURRENT_PRICE"].ToString());
                            dataResult.ResponseCurrentPriceGas95 = Int32.Parse(tblResult.Rows[0]["SYS_GAS95_CURRENT_PRICE"].ToString());
                            dataResult.ResponseCurrentPriceGasDO = Int32.Parse(tblResult.Rows[0]["SYS_GASDO_CURRENT_PRICE"].ToString());
                        }
                    }
                    SystemAdminDTO dtoSysAdmin = new SystemAdminDTO();
                    dtoSysAdmin.SysAdminAccount      = tblResult.Rows[0]["SYS_ADMIN"].ToString();
                    dtoSysAdmin.SysAdminPwd          = tblResult.Rows[0]["SYS_PWD"].ToString();
                    dtoSysAdmin.SysGas92CurrentPrice = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGas95CurrentPrice = Int32.Parse(tblResult.Rows[0]["SYS_GAS95_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGasDOCurrentPrice = Int32.Parse(tblResult.Rows[0]["SYS_GASDO_CURRENT_PRICE"].ToString());
                    dtoSysAdmin.SysGas92NewPrice     = Int32.Parse(tblResult.Rows[0]["SYS_GAS92_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysGas95NewPrice     = Int32.Parse(tblResult.Rows[0]["SYS_GAS95_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysGasDONewPrice     = Int32.Parse(tblResult.Rows[0]["SYS_GASDO_NEW_PRICE"].ToString());
                    dtoSysAdmin.SysApplyDate         = DateTime.Parse(tblResult.Rows[0]["SYS_APPLY_DATE"].ToString());

                    dataResult.ResponseDataSystemAdminDTO = dtoSysAdmin;
                    dataResult.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS;
                }
                else
                {
                    dataResult.ResponseCode     = DataTransfer.RESPONSE_CODE_FAIL;
                    dataResult.ResponseErrorMsg = SGMText.SYS_ADMIN_GET_PRICE_ERR;
                }
            }
            catch (Exception ex)
            {
                dataResult.ResponseCode           = DataTransfer.RESPONSE_CODE_FAIL;
                dataResult.ResponseErrorMsg       = SGMText.SYS_ADMIN_GET_PRICE_ERR;
                dataResult.ResponseErrorMsgDetail = ex.Message + " : " + ex.StackTrace;
            }

            return(dataResult);
        }