コード例 #1
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId     = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date           = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate           = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration      = txtNarration.Text.Trim();
         infoExchangeRate.Extra1         = String.Empty;
         infoExchangeRate.Extra2         = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date       = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate       = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration  = txtNarration.Text.Trim();
         infoExchangeRate.Extra1     = string.Empty;
         infoExchangeRate.Extra2     = string.Empty;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
 /// <summary>
 /// Function to insert particular values to ExchangeRate Table
 /// </summary>
 /// <param name="exchangerateinfo"></param>
 public void ExchangeRateAddParticularFields(ExchangeRateInfo exchangerateinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ExchangeRateAddParticularFields", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.CurrencyId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = exchangerateinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #4
0
        /// <summary>
        /// Store Weather Request and response info in DB
        /// </summary>
        /// <param name="watchRequest">Watch request data</param>
        /// <param name="weatherInfo">Weather data</param>
        /// <param name="locationInfo">Location data</param>
        /// <param name="exchangeRateInfo">Exchange rate data</param>
        public virtual async Task SaveRequestInfo(
            [NotNull] WatchRequest watchRequest,
            [NotNull] WeatherInfo weatherInfo,
            [NotNull] LocationInfo locationInfo,
            [NotNull] ExchangeRateInfo exchangeRateInfo)
        {
            await using var dbWatchServer = _connectionFactory.Create();
            var deviceData = dbWatchServer.QueryProc <DeviceData>(
                "add_device",
                new DataParameter("device_id", watchRequest.DeviceId ?? "unknown"),
                new DataParameter("device_name", watchRequest.DeviceName))
                             .Single();

            var requestData = _mapper.Map <RequestData>(watchRequest);

            requestData = _mapper.Map(weatherInfo, requestData);
            requestData = _mapper.Map(locationInfo, requestData);
            requestData = _mapper.Map(exchangeRateInfo, requestData);
            requestData.DeviceDataId = deviceData.Id;
            requestData.RequestTime  = DateTime.UtcNow;

            await dbWatchServer.GetTable <RequestData>().DataContext.InsertAsync(requestData);

            _logger.LogDebug("{@requestInfo}", requestData);
        }
コード例 #5
0
 /// <summary>
 /// Function to insert particular values to ExchangeRate Table
 /// </summary>
 /// <param name="exchangerateinfo"></param>
 public void ExchangeRateAddParticularFields(ExchangeRateInfo exchangerateinfo)
 {
     try
     {
         SPExchangeRate.ExchangeRateAddParticularFields(exchangerateinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERBll7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
 /// <summary>
 /// Function to Update values in ExchangeRate Table
 /// </summary>
 /// <param name="exchangerateinfo"></param>
 public void ExchangeRateEdit(ExchangeRateInfo exchangerateinfo)
 {
     try
     {
         SPExchangeRate.ExchangeRateEdit(exchangerateinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERBll2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
        /// <summary>
        /// Function to get particular values from ExchangeRate Table based on the parameter
        /// </summary>
        /// <param name="exchangeRateId"></param>
        /// <returns></returns>
        public ExchangeRateInfo ExchangeRateView(decimal exchangeRateId)
        {
            ExchangeRateInfo exchangerateinfo = new ExchangeRateInfo();

            try
            {
                exchangerateinfo = SPExchangeRate.ExchangeRateView(exchangeRateId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERBll4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(exchangerateinfo);
        }
コード例 #8
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate = spExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = spExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text         = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text    = infoExchangeRate.Narration;
         decExchangeRateId    = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #9
0
        /// <summary>
        /// Function to get particular values from ExchangeRate Table based on the parameter
        /// </summary>
        /// <param name="exchangeRateId"></param>
        /// <returns></returns>
        public ExchangeRateInfo ExchangeRateView(decimal exchangeRateId)
        {
            ExchangeRateInfo exchangerateinfo = new ExchangeRateInfo();
            SqlDataReader    sdrreader        = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ExchangeRateView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value = exchangeRateId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    exchangerateinfo.ExchangeRateId = decimal.Parse(sdrreader[0].ToString());
                    exchangerateinfo.CurrencyId     = decimal.Parse(sdrreader[1].ToString());
                    exchangerateinfo.Date           = DateTime.Parse(sdrreader[2].ToString());
                    exchangerateinfo.Rate           = decimal.Parse(sdrreader[3].ToString());
                    exchangerateinfo.Narration      = sdrreader[4].ToString();
                    exchangerateinfo.ExtraDate      = DateTime.Parse(sdrreader[5].ToString());
                    exchangerateinfo.Extra1         = sdrreader[6].ToString();
                    exchangerateinfo.Extra2         = sdrreader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(exchangerateinfo);
        }
コード例 #10
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration = txtNarration.Text.Trim();
         infoExchangeRate.Extra1 = String.Empty;
         infoExchangeRate.Extra2 = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (BllExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 BllExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #11
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         infoExchangeRate = BllExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = BllExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text = infoExchangeRate.Narration;
         decExchangeRateId = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
    /// <summary>
    /// Saves exchange rates.
    /// </summary>
    private void Save()
    {
        // Check permissions
        CheckConfigurationModification();

        string errorMessage = new Validator().NotEmpty(txtExchangeTableDisplayName.Text.Trim(), GetString("general.requiresdisplayname")).Result;

        if ((errorMessage == "") && (plcRateFromGlobal.Visible))
        {
            errorMessage = new Validator().NotEmpty(txtGlobalExchangeRate.Text.Trim(), GetString("ExchangeTable_Edit.DoubleFormatRequired")).Result;
        }

        if ((errorMessage == "") && (plcRateFromGlobal.Visible))
        {
            if (!ValidationHelper.IsPositiveNumber(txtGlobalExchangeRate.Text.Trim()) || (ValidationHelper.GetDouble(txtGlobalExchangeRate.Text.Trim(), 0) == 0))
            {
                errorMessage = GetString("ExchangeTable_Edit.errorRate");
            }
        }

        // From/to date validation
        if (errorMessage == "")
        {
            if ((!dtPickerExchangeTableValidFrom.IsValidRange()) || (!dtPickerExchangeTableValidTo.IsValidRange()))
            {
                errorMessage = GetString("general.errorinvaliddatetimerange");
            }

            if ((dtPickerExchangeTableValidFrom.SelectedDateTime != DateTime.MinValue) &&
                (dtPickerExchangeTableValidTo.SelectedDateTime != DateTime.MinValue) &&
                (dtPickerExchangeTableValidFrom.SelectedDateTime >= dtPickerExchangeTableValidTo.SelectedDateTime))
            {
                errorMessage = GetString("General.DateOverlaps");
            }
        }

        // Exchange rates validation
        if (errorMessage == String.Empty)
        {
            foreach (TextBox txt in mTextBoxes.Values)
            {
                string tmp = txt.Text.Trim();
                if (tmp != String.Empty)
                {
                    // Exchange rate mus be double
                    if (!ValidationHelper.IsDouble(tmp))
                    {
                        errorMessage = GetString("ExchangeTable_Edit.DoubleFormatRequired");
                        break;
                    }

                    // Exchange rate must be positive
                    double rate = ValidationHelper.GetDouble(tmp, 1);
                    if (rate <= 0)
                    {
                        errorMessage = GetString("ExchangeTable_Edit.errorRate");
                    }
                }
            }
        }

        // Save changes if no validation error
        if (errorMessage == "")
        {
            // Truncate display name
            string displayName = txtExchangeTableDisplayName.Text.Trim().Truncate(txtExchangeTableDisplayName.MaxLength);

            ExchangeTableInfo exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(displayName, SiteInfoProvider.GetSiteName(ConfiguredSiteID));

            // If exchangeTableName value is unique
            if ((exchangeTableObj == null) || (exchangeTableObj.ExchangeTableID == mExchangeTableId))
            {
                // Get ExchangeTableInfo object by primary key
                exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(mExchangeTableId);
                if (exchangeTableObj == null)
                {
                    // Create new item -> insert
                    exchangeTableObj = new ExchangeTableInfo();
                    exchangeTableObj.ExchangeTableSiteID = ConfiguredSiteID;
                }

                exchangeTableObj.ExchangeTableValidFrom = dtPickerExchangeTableValidFrom.SelectedDateTime;
                exchangeTableObj.ExchangeTableDisplayName = displayName;
                exchangeTableObj.ExchangeTableValidTo = dtPickerExchangeTableValidTo.SelectedDateTime;
                exchangeTableObj.ExchangeTableRateFromGlobalCurrency = 0;
                if (plcRateFromGlobal.Visible)
                {
                    exchangeTableObj.ExchangeTableRateFromGlobalCurrency = ValidationHelper.GetDouble(txtGlobalExchangeRate.Text.Trim(), 0);
                }

                // Save general exchange table information
                ExchangeTableInfoProvider.SetExchangeTableInfo(exchangeTableObj);

                // Save rates on edit
                if (mExchangeTableId > 0)
                {
                    foreach (TextBox txt in mTextBoxes.Values)
                    {
                        if (mData[txt.ClientID] != null)
                        {
                            int rateCurrencyId = ValidationHelper.GetInteger(((DataRowView)mData[txt.ClientID])["CurrencyID"], 0);
                            bool rateExists = mExchangeRates.ContainsKey(rateCurrencyId);

                            if (rateExists)
                            {
                                ExchangeRateInfo rate = new ExchangeRateInfo(mExchangeRates[rateCurrencyId]);

                                if (txt.Text.Trim() == String.Empty)
                                {
                                    // Remove exchange rate
                                    ExchangeRateInfoProvider.DeleteExchangeRateInfo(rate);
                                }
                                else
                                {
                                    rate.ExchangeRateValue = ValidationHelper.GetDouble(txt.Text.Trim(), 0);
                                    // Update rate
                                    ExchangeRateInfoProvider.SetExchangeRateInfo(rate);
                                }
                            }
                            else
                            {
                                if (txt.Text.Trim() != String.Empty)
                                {
                                    // Insert exchange rate
                                    ExchangeRateInfo rate = new ExchangeRateInfo();
                                    rate.ExchangeRateToCurrencyID = rateCurrencyId;
                                    rate.ExchangeRateValue = ValidationHelper.GetDouble(txt.Text.Trim(), 0);
                                    rate.ExchangeTableID = mExchangeTableId;

                                    ExchangeRateInfoProvider.SetExchangeRateInfo(rate);
                                }
                            }
                        }
                    }
                }

                URLHelper.Redirect("ExchangeTable_Edit.aspx?exchangeid=" + exchangeTableObj.ExchangeTableID + "&saved=1&siteId=" + SiteID);
            }
            else
            {
                // Show error message
                ShowError(GetString("ExchangeTable_Edit.CurrencyNameExists"));
            }
        }
        else
        {
            // Show error message
            ShowError(errorMessage);
        }
    }
コード例 #13
0
    /// <summary>
    /// Saves exchange rates.
    /// </summary>
    private void Save()
    {
        // Check permissions
        CheckConfigurationModification();

        string errorMessage = new Validator().NotEmpty(txtExchangeTableDisplayName.Text.Trim(), GetString("general.requiresdisplayname")).Result;

        if ((errorMessage == "") && (plcRateFromGlobal.Visible))
        {
            errorMessage = new Validator().NotEmpty(txtGlobalExchangeRate.Text.Trim(), GetString("ExchangeTable_Edit.DoubleFormatRequired")).Result;
        }

        if ((errorMessage == "") && (plcRateFromGlobal.Visible))
        {
            if (!ValidationHelper.IsPositiveNumber(txtGlobalExchangeRate.Text.Trim()) || (ValidationHelper.GetDouble(txtGlobalExchangeRate.Text.Trim(), 0) == 0))
            {
                errorMessage = GetString("ExchangeTable_Edit.errorRate");
            }
        }

        // From/to date validation
        if (errorMessage == "")
        {
            if ((!dtPickerExchangeTableValidFrom.IsValidRange()) || (!dtPickerExchangeTableValidTo.IsValidRange()))
            {
                errorMessage = GetString("general.errorinvaliddatetimerange");
            }

            if ((dtPickerExchangeTableValidFrom.SelectedDateTime != DateTime.MinValue) &&
                (dtPickerExchangeTableValidTo.SelectedDateTime != DateTime.MinValue) &&
                (dtPickerExchangeTableValidFrom.SelectedDateTime >= dtPickerExchangeTableValidTo.SelectedDateTime))
            {
                errorMessage = GetString("General.DateOverlaps");
            }
        }

        // Exchange rates validation
        if (errorMessage == String.Empty)
        {
            foreach (TextBox txt in mTextBoxes.Values)
            {
                string tmp = txt.Text.Trim();
                if (tmp != String.Empty)
                {
                    // Exchange rate mus be double
                    if (!ValidationHelper.IsDouble(tmp))
                    {
                        errorMessage = GetString("ExchangeTable_Edit.DoubleFormatRequired");
                        break;
                    }

                    // Exchange rate must be positive
                    double rate = ValidationHelper.GetDouble(tmp, 1);
                    if (rate <= 0)
                    {
                        errorMessage = GetString("ExchangeTable_Edit.errorRate");
                    }
                }
            }
        }

        // Save changes if no validation error
        if (errorMessage == "")
        {
            ExchangeTableInfo exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(txtExchangeTableDisplayName.Text.Trim(), SiteInfoProvider.GetSiteName(ConfiguredSiteID));

            // If exchangeTableName value is unique
            if ((exchangeTableObj == null) || (exchangeTableObj.ExchangeTableID == mExchangeTableId))
            {
                // Get ExchangeTableInfo object by primary key
                exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(mExchangeTableId);
                if (exchangeTableObj == null)
                {
                    // Create new item -> insert
                    exchangeTableObj = new ExchangeTableInfo();
                    exchangeTableObj.ExchangeTableSiteID = ConfiguredSiteID;
                }

                exchangeTableObj.ExchangeTableValidFrom              = dtPickerExchangeTableValidFrom.SelectedDateTime;
                exchangeTableObj.ExchangeTableDisplayName            = txtExchangeTableDisplayName.Text.Trim();
                exchangeTableObj.ExchangeTableValidTo                = dtPickerExchangeTableValidTo.SelectedDateTime;
                exchangeTableObj.ExchangeTableRateFromGlobalCurrency = 0;
                if (plcRateFromGlobal.Visible)
                {
                    exchangeTableObj.ExchangeTableRateFromGlobalCurrency = ValidationHelper.GetDouble(txtGlobalExchangeRate.Text.Trim(), 0);
                }

                // Save general exchange table information
                ExchangeTableInfoProvider.SetExchangeTableInfo(exchangeTableObj);

                // Save rates on edit
                if (mExchangeTableId > 0)
                {
                    foreach (TextBox txt in mTextBoxes.Values)
                    {
                        if (mData[txt.ClientID] != null)
                        {
                            int  rateCurrencyId = ValidationHelper.GetInteger(((DataRowView)mData[txt.ClientID])["CurrencyID"], 0);
                            bool rateExists     = mExchangeRates.ContainsKey(rateCurrencyId);

                            if (rateExists)
                            {
                                ExchangeRateInfo rate = new ExchangeRateInfo(mExchangeRates[rateCurrencyId]);

                                if (txt.Text.Trim() == String.Empty)
                                {
                                    // Remove exchange rate
                                    ExchangeRateInfoProvider.DeleteExchangeRateInfo(rate);
                                }
                                else
                                {
                                    rate.ExchangeRateValue = ValidationHelper.GetDouble(txt.Text.Trim(), 0);
                                    // Update rate
                                    ExchangeRateInfoProvider.SetExchangeRateInfo(rate);
                                }
                            }
                            else
                            {
                                if (txt.Text.Trim() != String.Empty)
                                {
                                    // Insert exchange rate
                                    ExchangeRateInfo rate = new ExchangeRateInfo();
                                    rate.ExchangeRateToCurrencyID = rateCurrencyId;
                                    rate.ExchangeRateValue        = ValidationHelper.GetDouble(txt.Text.Trim(), 0);
                                    rate.ExchangeTableID          = mExchangeTableId;

                                    ExchangeRateInfoProvider.SetExchangeRateInfo(rate);
                                }
                            }
                        }
                    }
                }

                URLHelper.Redirect("ExchangeTable_Edit.aspx?exchangeid=" + exchangeTableObj.ExchangeTableID + "&saved=1&siteId=" + SiteID);
            }
            else
            {
                // Show error message
                ShowError(GetString("ExchangeTable_Edit.CurrencyNameExists"));
            }
        }
        else
        {
            // Show error message
            ShowError(errorMessage);
        }
    }
コード例 #14
0
        public async Task <ActionResult <WatchResponse> > Get([FromQuery] WatchRequest watchRequest)
        {
            try
            {
                var weatherInfo      = new WeatherInfo();
                var locationInfo     = new LocationInfo();
                var exchangeRateInfo = new ExchangeRateInfo();

                if (watchRequest.Lat != null && watchRequest.Lon != null)
                {
                    // Get weather info
                    //
                    Enum.TryParse <WeatherProvider>(watchRequest.WeatherProvider, true, out var weatherProvider);
                    weatherInfo = (weatherProvider == WeatherProvider.DarkSky)
                        ? await _darkSkyClient.RequestDarkSky(watchRequest.Lat.Value, watchRequest.Lon.Value, watchRequest.DarkskyKey)
                        : await _openWeatherClient.RequestOpenWeather(watchRequest.Lat.Value, watchRequest.Lon.Value);

                    // Get location info
                    //
                    locationInfo = await _virtualearthClient
                                   .GetCachedLocationName(watchRequest.DeviceId, watchRequest.Lat.Value, watchRequest.Lon.Value);
                }

                // Get Exchange Rate info
                //
                if (!watchRequest.BaseCurrency.IsNullOrEmpty() && !watchRequest.TargetCurrency.IsNullOrEmpty())
                {
                    exchangeRateInfo = await _exchangeRateCacheStrategy
                                       .GetExchangeRate(watchRequest.BaseCurrency, watchRequest.TargetCurrency);
                }

                // Save all requested data
                //
                await _postgresDataProvider.SaveRequestInfo(watchRequest, weatherInfo, locationInfo, exchangeRateInfo);

                // WatchFaces earlier than 0.9.248 can not display diacritics
                //
                if (Version.TryParse(watchRequest.Version, out var wfVersion) &&
                    wfVersion.CompareTo(new Version(0, 9, 248)) < 0)
                {
                    locationInfo.CityName = locationInfo.CityName.StripDiacritics();
                }

                var watchResponse = new WatchResponse
                {
                    LocationInfo     = locationInfo,
                    WeatherInfo      = weatherInfo,
                    ExchangeRateInfo = exchangeRateInfo
                };

                if (_faceSettings.Log2Kafka)
                {
                    await _kafkaProvider.SendMessage(new { watchRequest, locationInfo, weatherInfo, exchangeRateInfo });
                }

                _logger.LogInformation(
                    new EventId(105, "WatchRequest"), "{@WatchRequest}, {@WatchResponse}, {@DeviceId}, {@CityName}",
                    watchRequest, watchResponse, watchRequest.DeviceId, watchResponse.LocationInfo.CityName);
                return(watchResponse);
            }
            catch (Exception ex)
            {
                _logger.LogWarning(ex, "Request error, {@WatchFaceRequest}", watchRequest);
                return(BadRequest(new ErrorResponse {
                    StatusCode = (int)HttpStatusCode.BadRequest, Description = "Bad request"
                }));
            }
        }
コード例 #15
0
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathBll BllCompanyPath = new CompanyPathBll();
         UserInfo infoUser = new UserInfo();
         UserBll bllUser = new UserBll();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         //ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         decCurrencyIdForStatus = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         if (BllCompanyCreation.CompanyCheckExistence(txtCompanyName.Text.Trim().ToString(), 0) == false)
         {
             decimal decCompanyId = BllCompanyCreation.CompanyAddParticularFeilds(infoCompany);
             PublicVariables._decCurrentCompanyId = decCompanyId;
             infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
             BllCompanyPath.CompanyPathAdd(infoCompanyPath);
             if (formMDI.demoProject || CreateCompany())
             {
                 if (!formMDI.demoProject)
                 {
                     infoCompanyPath.CompanyPath = strPath;
                 }
                 else
                 {
                     infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data";
                     PublicVariables._decCurrentCompanyId = 0;
                 }
                 CompanyInfo infoNewCompany = new CompanyInfo();
                 CompanyPathInfo infoNewCompanyPath = new CompanyPathInfo();
                 UserInfo infoNewUser = new UserInfo();
                 UserBll bllNewUser = new UserBll();
                 ExchangeRateInfo infoNewExchangeRate = new ExchangeRateInfo();
                 ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
                 CompanyPathBll BllNewCompanyPath = new CompanyPathBll();
                 infoNewCompany = infoCompany;
                 infoNewCompanyPath = infoCompanyPath;
                 infoNewUser = infoUser;
                 decCompanyId = BllCompanyCreation.CompanyAddParticularFeilds(infoNewCompany);
                 bllNewUser.UserAdd(infoNewUser);
                 BllNewCompanyPath.CompanyPathAdd(infoNewCompanyPath);
                 Messages.SavedMessage();
                 formMDI.MDIObj.MenuStripEnabling();
                 //  To set default currencyId.............//
                 infoNewExchangeRate.CurrencyId = infoNewCompany.CurrencyId;
                 infoNewExchangeRate.Rate = 1;
                 infoNewExchangeRate.Narration = string.Empty;
                 infoNewExchangeRate.Extra1 = string.Empty;
                 infoNewExchangeRate.Extra2 = string.Empty;
                 infoNewExchangeRate.ExtraDate = System.DateTime.Now;
                 infoNewExchangeRate.Date = System.DateTime.Now;
                 BllExchangeRate.ExchangeRateAdd(infoNewExchangeRate);
                 CurrencyBll BllCurrency = new CurrencyBll();
                 BllCurrency.DefaultCurrencySet(decCurrencyIdForStatus);
                 AfterCompanyCreation();
                 Clear();
                 this.Close();
             }
             else
             {
                 Messages.InformationMessage("Company creation failed");
             }
         }
         else
         {
             Messages.InformationMessage("Companyname already exist");
             txtCompanyName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #16
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathBll BllCompanyPath = new CompanyPathBll();
         UserInfo infoUser = new UserInfo();
         UserBll bllUser = new UserBll();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         strPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
         infoCompanyPath.CompanyPath = strPath;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoCompanyPath.ExtraDate = DateTime.Now;
         infoCompanyPath.CompanyId = 1;
         infoCompany.CompanyId = 1;
         BllCompanyCreation.CompanyEdit(infoCompany);
         BllCompanyPath.CompanyPathEdit(infoCompanyPath);
         Messages.UpdatedMessage();
         //  To set default currencyId...........In exchangeRate..//
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         infoExchangeRate.ExchangeRateId = 1;
         infoExchangeRate.Date = PublicVariables._dtCurrentDate;
         infoExchangeRate.CurrencyId = infoCompany.CurrencyId;
         infoExchangeRate.ExtraDate = PublicVariables._dtCurrentDate;
         infoExchangeRate.Narration = string.Empty;
         infoExchangeRate.Rate = 1;
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         BllExchangeRate.ExchangeRateEdit(infoExchangeRate);
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearBll BllFinancialYear = new FinancialYearBll();
         decimal decIdentity;
         infoFinancialYear.FromDate = PublicVariables._dtFromDate;
         infoFinancialYear.ToDate = PublicVariables._dtToDate;
         infoFinancialYear.ExtraDate = DateTime.Now;
         infoFinancialYear.Extra1 = string.Empty;
         infoFinancialYear.Extra2 = string.Empty;
         bool isExist = BllFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate);
         if (!isExist)
         {
             decIdentity = BllFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear);
         }
         //===========Add companyDetails in ExternalDb =====================//
         decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId;
         PublicVariables._decCurrentCompanyId = 0;
         CompanyCreationBll bllExCompanyCreation = new CompanyCreationBll();
         CompanyPathBll bllExCompanyPath = new CompanyPathBll();
         CompanyInfo infoExCompany = new CompanyInfo();
         CompanyPathInfo infoExCompanyPath = new CompanyPathInfo();
         infoExCompany = infoCompany;
         infoExCompanyPath = infoCompanyPath;
         infoExCompany.CompanyId = decCompanyIdForTemp;
         infoExCompanyPath.CompanyId = decCompanyIdForTemp;
         bllExCompanyCreation.CompanyEdit(infoExCompany);
         bllExCompanyPath.CompanyPathEdit(infoExCompanyPath);
         PublicVariables._decCurrentCompanyId = decCompanyIdForTemp;
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #17
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration = txtNarration.Text.Trim();
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         if (BllExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 BllExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #18
0
        /// <summary>
        /// Fill the corresponding details of party and calculations on cell value changed 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvPartyBalance_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                PartyBalanceBll BllPartyBalance = new PartyBalanceBll();

                if (e.RowIndex != -1 && e.ColumnIndex != -1)
                {
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value == null || dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value.ToString() == string.Empty)
                    {
                        dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1);//decExchangeRateId;

                    }
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvtxtAmount" || dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbCurrency")
                    {
                        TotalAmount();
                    }
                    //---------------------check column missing---------------------------------//
                    CheckColumnMissing(e);
                    //==========================================================================//
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbReference")
                    {
                        if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value != null)//&& dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() != string.Empty)
                        {
                            //to fill combo without filling the already selected value
                            if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "Against")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                            else if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "New")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = true;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value = string.Empty;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                            //
                            else if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "OnAccount")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = true;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value = string.Empty;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                        }
                    }
                    else if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbVoucherType")
                    {
                        if (dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value != null && dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value.ToString().Trim() != string.Empty)
                        {
                            ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
                            ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
                            string str = dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value.ToString();
                            string[] words;
                            words = str.Split('_');
                            List<DataTable> listObj = new List<DataTable>();
                            listObj = BllPartyBalance.PartyBalanceComboViewByLedgerId(decLedgerId, strDebitOrCredit, decVoucherTypeId, strVoucherNo);
                            for (int inD = 0; inD < listObj[0].Rows.Count; inD++)
                            {
                                if (dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbVoucherType"].Value.ToString() == listObj[0].Rows[inD]["value"].ToString())
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = listObj[0].Rows[inD]["voucherNo"].ToString();
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = Math.Round(Convert.ToDecimal(listObj[0].Rows[inD]["balance"].ToString()), PublicVariables._inNoOfDecimalPlaces);

                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtOldExchangeRateId"].Value = listObj[0].Rows[inD]["exchangeRateId"].ToString();
                                    if (Convert.ToDecimal(listObj[0].Rows[inD]["exchangeRateId"].ToString()) != 1m)
                                    {
                                        infoExchangeRate = BllExchangeRate.ExchangeRateView(Convert.ToDecimal(listObj[0].Rows[inD]["exchangeRateId"].ToString()));
                                        decimal decCurrentExchangeRateId = BllExchangeRate.GetExchangeRateId(infoExchangeRate.CurrencyId, dtmVoucherDate);
                                        if (decCurrentExchangeRateId == 0)
                                        {
                                            CurrencyBll BllCurrency = new CurrencyBll();
                                            CurrencyInfo infoCurrency = new CurrencyInfo();
                                            infoCurrency = BllCurrency.CurrencyView(infoExchangeRate.CurrencyId);
                                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = decCurrentExchangeRateId;

                                            Messages.InformationMessage("Set ExchangeRate for "+infoCurrency.CurrencyName);

                                        }
                                        else
                                        {
                                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = decCurrentExchangeRateId;
                                        }
                                    }
                                    else
                                    {
                                        dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = 1m;
                                    }
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtInvoiceNo"].Value = listObj[0].Rows[inD]["invoiceNo"].ToString();
                                }
                            }
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtAmount"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = true;
                        }
                        //to make voucherno,pendingamount,invoiceno,currency as null when vouchertype is selected as empty
                        else
                        {
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtAmount"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtInvoiceNo"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = null;
                            SettingsBll BllSettings = new SettingsBll();
                            if (BllSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                            {
                                dgvcmbCurrency.ReadOnly = false;
                            }
                            else
                            {
                                dgvcmbCurrency.ReadOnly = true;

                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PB:16" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #19
0
        /// <summary>
        /// Save Data into persistent storage
        /// </summary>
        private async Task SaveData(
            WatchRequest watchRequest, WeatherInfo weatherInfo, LocationInfo locationInfo, ExchangeRateInfo exchangeRateInfo)
        {
            await using var dbConnection = _dbFactory.Create();
            var deviceData = await dbConnection.GetTable <DeviceData>()
                             .SingleOrDefaultAsync(_ => _.DeviceId == watchRequest.DeviceId);

            if (deviceData == null)
            {
                deviceData = new DeviceData
                {
                    DeviceId         = watchRequest.DeviceId,
                    DeviceName       = watchRequest.DeviceName,
                    FirstRequestTime = watchRequest.RequestTime
                };
                deviceData.Id = await dbConnection.GetTable <DeviceData>().DataContext.InsertWithInt32IdentityAsync(deviceData);
            }

            var requestData = _mapper.Map <RequestData>(watchRequest);

            requestData = _mapper.Map(weatherInfo, requestData);
            requestData = _mapper.Map(locationInfo, requestData);
            requestData = _mapper.Map(exchangeRateInfo, requestData);
            requestData.DeviceDataId = deviceData.Id;

            await dbConnection.GetTable <RequestData>().DataContext.InsertAsync(requestData);
        }