/// <summary> /// Insert Country Name. /// </summary> /// <param name="xmlData">Data that converted into xml format.</param> /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns> public int InsertCountryName(GeographicLocationBDto GeographicLocation) { Database db = null; DbCommand dbCmd = null; int Result = 0; try { db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING); dbCmd = db.GetStoredProcCommand(DALHelper.USP_ADMINISTRATION_COUNTRY_INSERT); db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String,GeographicLocation.CountryName); db.AddInParameter(dbCmd, "@COUNTRY_CODE", DbType.String, GeographicLocation.CountryCode); db.AddInParameter(dbCmd, "@COUNTRY_CURRENCY_SYMBOL", DbType.String, GeographicLocation.CurrencySymbol); db.AddInParameter(dbCmd, "@COUNTRY_CURRENCY_NAME", DbType.String, GeographicLocation.CurrencyName); db.AddInParameter(dbCmd, "@CREATED_BY", DbType.Int32,GeographicLocation.UserProfile.UserId); db.AddOutParameter(dbCmd, "@ISEXIST", DbType.Int32, 1); db.ExecuteNonQuery(dbCmd); Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@ISEXIST")); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } finally { DALHelper.Destroy(ref dbCmd); } return Result; }
private void vwCitySave() { try { int result = 0; objGeographicLocation = new GeographicLocationDal(); objGeographicLocationBDto = new GeographicLocationBDto(); objGeographicLocationBDto.CityName = txtCityName.Text; objGeographicLocationBDto.CountryId = int.Parse(cmbCountryNameCity.SelectedValue); objGeographicLocationBDto.StateId = int.Parse(cmbStateNameCity.SelectedValue); objGeographicLocationBDto.UserProfile = objAuthorizationBDto.UserProfile; result = objGeographicLocation.InsertCity(objGeographicLocationBDto); if (result >= 1) { Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString()); Master.MessageCssClass = "successMessage"; } else { Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString()); Master.MessageCssClass = "errorMessage"; } BindGridCity(); Reset(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
///// <summary> ///// Saves checkbox checked status into hashtable after check status changed. ///// </summary> ///// <param name="sender">The object which raised the event</param> ///// <param name="e">The event listener object</param> //public void chkItemWrt_CheckChanged(object sender, EventArgs e) //{ // CheckBox chkBox = (CheckBox)sender; // GridDataItem item = (GridDataItem)chkBox.NamingContainer; // if ((ViewState[PageConstants.vsItemIndexes] != null)) // { // htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes]; // } // else // { // htItemIndex = new Hashtable(); // } // if (chkBox.Checked == true) // { // hdnCheckIndex.Value = item.ItemIndex.ToString(); // htItemIndex.Add(htItemIndex.Count, item.ItemIndex); // item.Selected = true; // } // else // { // item.Selected = false; // for (int i = 0; i <= htItemIndex.Count - 1; i++) // { // if (htItemIndex[i] != null) // { // if (htItemIndex[i].ToString() == item.ItemIndex.ToString()) // { // radgrdCountry.Items[htItemIndex[i].ToString()].Edit = false; // htItemIndex.Remove(i); // break; // } // } // } // } // ViewState.Add(PageConstants.vsItemIndexes, htItemIndex); //} #endregion #region Save #region Save vwCountry private void vwCountrySave() { try { int result = 0; objGeographicLocation = new GeographicLocationDal(); GeographicLocationBDto objGeographicLocationBDto = new GeographicLocationBDto(); objGeographicLocationBDto = new GeographicLocationBDto(); objGeographicLocationBDto.CountryName = txtCountryName.Text; objGeographicLocationBDto.CountryCode = txtCountryCode.Text; objGeographicLocationBDto.CurrencySymbol = txtCurrencySymbol.Text; objGeographicLocationBDto.CurrencyName = txtCurrencyName.Text; objGeographicLocationBDto.UserProfile = objAuthorizationBDto.UserProfile; result = objGeographicLocation.InsertCountryName(objGeographicLocationBDto); if (result >= 1) { Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString()); Master.MessageCssClass = "successMessage"; } else { Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString()); Master.MessageCssClass = "errorMessage"; } BindGridCountry(); Reset(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }