示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Saving Process..
            Countries objCountries = new Countries();
            objCountries.CountryName = txtCountyName.Text;
            objCountries.CountryCode = txtCountryCode.Text;
            objCountries.CountryGroup = txtCountryGroup.Text;

            if (!string.IsNullOrEmpty(hfCountryID.Value.ToString()))
            {
                objCountries.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objCountries.UpdatedDate = DateTime.Now;
                objCountries.CountryID = Convert.ToInt32(hfCountryID.Value);
                objCountries.CountryName = txtCountyName.Text;
                objCountries.CountryCode = txtCountryCode.Text;
                objCountries.CountryGroup = txtCountryGroup.Text;
                CountriesBO.UpdateCountries(objCountries);

            }
            else
            {
                objCountries.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objCountries.CreatedDate = DateTime.Now;
                CountriesBO.InsertCountries(objCountries);
            }


            txtCountyName.Text = string.Empty;
            txtCountryCode.Text = string.Empty;
            txtCountryGroup.Text = string.Empty;

            hfCountryID.Value = string.Empty;
            loadCountries();
        }
示例#2
0
        public int InsertCountries(Countries objCountries)
        {
            objCountries.CountryID = 1;
            BeginTransaction();

            try
            {
                objCountries.CountryID = Insert(objCountries);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objCountries.CountryID = -1;
            }

            return objCountries.CountryID;
        }
示例#3
0
        public int UpdateCountries(Countries objCountries)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "CountryName", "CountryCode", "CountryGroup", "UpdatedBy", "UpdatedDate" };
                rowsaffected = Update(objCountries, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }