//end update /// <summary> /// new record /// </summary> protected int insert_country() { int _newid = 0; try { ///new instance of record CountryTable _tbl = new CountryTable(); //get values off insert form //check for duplicate name ASPxTextBox _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtCountryInsert"); if (_txt != null && _txt.Text != "") { string _newvalue = _txt.Text.Trim().ToString(); //country name if (!wwi_func.value_exists("CountryName", "CountryTable", _newvalue)) { _tbl.CountryName = _txt.Text.Trim().ToString(); //ISO code _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtISOInsert"); if (_txt != null && _txt.Text != "") { _tbl.ISOCode = _txt.Text.Trim().ToString(); } //euro ASPxCheckBox _chk = (ASPxCheckBox)this.fmvCountry.FindControl("dxckEuroInsert"); if (_chk != null) { _tbl.Eu = _chk.Checked ? true : false; } //insert _tbl.Save(); //get new id _newid = (int)_tbl.GetPrimaryKeyValue(); } else { string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } return(_newid); }
/// <summary> /// update hvoyagetable /// </summary> /// <param name="hblid">int</param> protected void update_country() { //voyageid int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship")); //original value for countryname string _oldvalue = this.dxhfOrder.Contains("oldvalue") ? this.dxhfOrder.Get("oldvalue").ToString() : ""; if (_pid > 0) { try { //new instance of record CountryTable _tbl = new CountryTable(_pid); //get values off insert form //check duplicate name ASPxTextBox _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtCountryEdit"); if (_txt != null && _txt.Text != "") { string _newvalue = _txt.Text.Trim().ToString(); //country name bool _duplicate = _newvalue != _oldvalue?wwi_func.value_exists("CountryName", "CountryTable", _newvalue) : false; if (!_duplicate) { _tbl.CountryName = _newvalue; //ISO code _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtISOEdit"); if (_txt != null && _txt.Text != "") { _tbl.ISOCode = _txt.Text.Trim().ToString(); } //euro ASPxCheckBox _chk = (ASPxCheckBox)this.fmvCountry.FindControl("dxckEuroEdit"); if (_chk != null) { _tbl.Eu = _chk.Checked ? true : false; } //update _tbl.Save(); } else { string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } else { string _ex = "Can't update record Country ID = 0"; this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } }
//end update /// <summary> /// new record /// </summary> protected int insert_country() { int _newid = 0; try { ///new instance of record CountryTable _tbl = new CountryTable(); //get values off insert form //check for duplicate name ASPxTextBox _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtCountryInsert"); if (_txt != null && _txt.Text != "") { string _newvalue = _txt.Text.Trim().ToString(); //country name if (!wwi_func.value_exists("CountryName", "CountryTable", _newvalue)) { _tbl.CountryName = _txt.Text.Trim().ToString(); //ISO code _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtISOInsert"); if (_txt != null && _txt.Text != "") { _tbl.ISOCode = _txt.Text.Trim().ToString(); } //euro ASPxCheckBox _chk = (ASPxCheckBox)this.fmvCountry.FindControl("dxckEuroInsert"); if (_chk != null) { _tbl.Eu = _chk.Checked ? true : false; } //insert _tbl.Save(); //get new id _newid = (int)_tbl.GetPrimaryKeyValue(); } else { string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } return _newid; }
/// <summary> /// update hvoyagetable /// </summary> /// <param name="hblid">int</param> protected void update_country() { //voyageid int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship")); //original value for countryname string _oldvalue = this.dxhfOrder.Contains("oldvalue") ? this.dxhfOrder.Get("oldvalue").ToString() : ""; if (_pid > 0) { try { //new instance of record CountryTable _tbl = new CountryTable(_pid); //get values off insert form //check duplicate name ASPxTextBox _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtCountryEdit"); if (_txt != null && _txt.Text != "") { string _newvalue = _txt.Text.Trim().ToString(); //country name bool _duplicate = _newvalue != _oldvalue ? wwi_func.value_exists("CountryName", "CountryTable", _newvalue) : false; if (!_duplicate) { _tbl.CountryName = _newvalue; //ISO code _txt = (ASPxTextBox)this.fmvCountry.FindControl("dxtxtISOEdit"); if (_txt != null && _txt.Text != "") { _tbl.ISOCode = _txt.Text.Trim().ToString(); } //euro ASPxCheckBox _chk = (ASPxCheckBox)this.fmvCountry.FindControl("dxckEuroEdit"); if (_chk != null) { _tbl.Eu = _chk.Checked ? true : false; } //update _tbl.Save(); } else { string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } } else { string _ex = "Can't update record Country ID = 0"; this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } }
public void Insert(string CountryName,bool? Eu,string ISOCode,byte[] Ts) { CountryTable item = new CountryTable(); item.CountryName = CountryName; item.Eu = Eu; item.ISOCode = ISOCode; item.Ts = Ts; item.Save(UserName); }
public void Update(int CountryID,string CountryName,bool? Eu,string ISOCode,byte[] Ts) { CountryTable item = new CountryTable(); item.MarkOld(); item.IsLoaded = true; item.CountryID = CountryID; item.CountryName = CountryName; item.Eu = Eu; item.ISOCode = ISOCode; item.Ts = Ts; item.Save(UserName); }