//inserting the data public void InsertInState(int fKCountryId, string stateName, bool isActive) { StateData objstateData = new StateData(fKCountryId, stateName, isActive); objstateData.Validate(); StateDB.InsertInState(objstateData); }
public void TestGetStates() { List <State> states = StateDB.GetStates(); Assert.AreEqual(53, states.Count); Assert.AreEqual("Alabama", states[0].StateName); }
//public void UpDateState(State objState) //{ // StateDB.ManageState(objState, ActionType.Add); //} /// <summary> /// Update records into State table /// </summary> /// <param >Takes individual Parameters</param> public void UpdateState(int PKStateId, int FKCountryId, String StateName, bool IsActive) { State objState = new State(PKStateId, FKCountryId, StateName, IsActive); objState.Validate(); StateDB.ManageState(objState, ActionType.Update); }
/// <summary> /// Add record to state table /// </summary> /// <param >Takes individual parameters</param> public void InsertState(int FKCountryId, String StateName, bool IsActive) { State objState = new State(-1, FKCountryId, StateName, IsActive); objState.Validate(); StateDB.ManageState(objState, ActionType.Add); }
public bool IsStateExist(string CountryName, string stateName) { if (StateDB.IsStateExist(CountryName, stateName)) { throw new ApplicationException("state name already exists"); } else { return(StateDB.IsStateExist(CountryName, stateName)); } }
//for updating the state table public void UpdateInState(StateData objStateData) { try { objStateData.Validate(); StateDB.UpdateInState(objStateData); } catch (Exception ex) { throw ex; } }
public void InsertState(int countryId, String stateName, bool isActive) { try { State objState = new State(-1, countryId, stateName, isActive); objState.Validate(); StateDB.ManageState(objState, ActionType.Add); } catch (System.Data.SqlClient.SqlException) { throw new ApplicationException("CountryName Entered"); } }
private void frmUpdate_Load(object sender, EventArgs e) { //Load the states into the combo box List <State> states = StateDB.GetStates(); stateComboBox.DataSource = states; stateComboBox.DisplayMember = "StateName"; stateComboBox.ValueMember = "StateCode"; //Bind the controls to the customer object customerBindingSource.Clear(); customerBindingSource.Add(customer); }
public void UpdateState(int stateId, int countryId, String stateName, bool isActive) { try { State objState = new State(stateId, countryId, stateName, isActive); objState.Validate(); StateDB.ManageState(objState, ActionType.Edit); } catch (FormatException) { throw; } }
private void EngramValue(SimulationEvent e) { SimulationObjectProxy obProx; string engramName = ((StringValue)e["EngramName"]).value; string engramValue = ((StringValue)e["EngramValue"]).value; string engramDataType = ((StringValue)e["EngramDataType"]).value; string objectID = string.Empty; objectID = ((StringValue)e["SpecificUnit"]).value; if (objectID != string.Empty) { obProx = objectProxies[objectID]; if (!StateDB.physicalObjects.ContainsKey(objectID)) { return; } EmitterValue em = (EmitterValue)obProx["Emitters"].GetDataValue(); CustomAttributesValue cus = (CustomAttributesValue)obProx["CustomAttributes"].GetDataValue(); if (em.attIsEngram.ContainsKey(engramName)) { cus.attributes[engramName] = DataValueFactory.BuildString(engramValue); obProx["CustomAttributes"].SetDataValue(cus); } //Add the qualified engram name to the collection. //Does not need to be the same qualified name as the scencon uses. StateDB.UpdateEngrams(String.Format("{0}|{1}", objectID, engramName), engramValue, engramDataType); return; } else { StateDB.UpdateEngrams(engramName, engramValue, engramDataType); foreach (string id in objectProxies.Keys) { obProx = objectProxies[id]; if (!StateDB.physicalObjects.ContainsKey(id)) { continue; } EmitterValue em = (EmitterValue)obProx["Emitters"].GetDataValue(); CustomAttributesValue cus = (CustomAttributesValue)obProx["CustomAttributes"].GetDataValue(); if (em.attIsEngram.ContainsKey(engramName)) { cus.attributes[engramName] = DataValueFactory.BuildString(engramValue); obProx["CustomAttributes"].SetDataValue(cus); } } return; } }
private void btnSave_Click_1(object sender, EventArgs e) { try { state stat = new state(); StateDB sdb = new StateDB(); stat.StateCode = txtStateID.Text.Trim(); stat.StateName = txtStateName.Text.Trim(); stat.Status = getStatusCode(cmbStatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; if (sdb.validateState(stat)) { if (btnText.Equals("Update")) { if (sdb.updateState(stat)) { MessageBox.Show("State updated"); closeAllPanels(); ListState(); } else { MessageBox.Show("Failed to update State"); } } else if (btnText.Equals("Save")) { if (sdb.insertState(stat)) { MessageBox.Show("State Added"); closeAllPanels(); ListState(); } else { MessageBox.Show("Failed to Insert state"); } } } else { MessageBox.Show("state Data Validation failed"); } } catch (Exception) { MessageBox.Show("Failed Adding / Editing state"); } }
private void NewObject(SimulationEvent e) { string objectType = ((StringValue)e["ObjectType"]).value; Console.WriteLine(String.Format("Blackboard gets new object; ID: {0}; Type: {1}", ((StringValue)e["ID"]).value, objectType)); SimulationObject ob = SimulationObjectFactory.BuildObject(ref simModel, objectType); ob.attributes["ID"] = e["ID"]; // REFACTOR: I shouldn't actually do this. I should only initialize the values that I own. //AD: I'm populating the values passed in the NewObject event into the SimulationObject foreach (string attname in ((AttributeCollectionValue)e["Attributes"]).attributes.Keys) { ob.attributes[attname] = ((AttributeCollectionValue)e["Attributes"])[attname]; } blackboard.AddObject(ob); // Initialize StateDB objects if (((StringValue)e["ObjectType"]).value == "Team") { StateDB.Team t = new StateDB.Team(((StringValue)e["ID"]).value, ((StringListValue)((AttributeCollectionValue)e["Attributes"]).attributes["TeamHostility"]).strings); StateDB.teams[t.id] = t; } else if (((StringValue)e["ObjectType"]).value == "DecisionMaker") { string teamID = ((StringValue)((AttributeCollectionValue)e["Attributes"]).attributes["TeamMember"]).value; StateDB.DecisionMaker d = new StateDB.DecisionMaker(((StringValue)e["ID"]).value, StateDB.teams.ContainsKey(teamID) ? StateDB.teams[teamID] : null); StateDB.decisionMakers[d.id] = d; } else if (SimUtility.isPhysicalObject(objectType)) { String linkedRegion = ""; if (e.parameters.ContainsKey("LinkedRegion")) { linkedRegion = ((StringValue)e["LinkedRegion"]).value; } StateDB.AddPhysicalObject(((StringValue)e["ID"]).value, objectType, linkedRegion); } }
private void LoadComboBoxes() { try { stateList = StateDB.GetStateList(); stateComboBox.DataSource = stateList; List <Terms> termslist; termslist = TermsDB.GetTermsList(); termsIDComboBox.DataSource = termslist; List <GLAccount> accountList; accountList = GLAccountDB.GetGLAccountList(); accountNoComboBox.DataSource = accountList; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
private void ListState() { try { grdList.Rows.Clear(); StateDB sdb = new StateDB(); List <state> sList = sdb.getStateList(); foreach (state stat in sList) { grdList.Rows.Add(stat.StateCode, stat.StateName, getStatusString(stat.Status), stat.CreateTime, stat.CreateUser); } } catch (Exception) { MessageBox.Show("Error in State listing"); } enableBottomButtons(); pnlStateList.Visible = true; }
//for getting the data from the table public object GetStates() { StateDB = new StateDB(); return(StateDB.GetState()); }
public bool IsStateExist(string StateName, int FKCountryId, int PKStateId) { return(StateDB.IsStateExist(StateName, FKCountryId, PKStateId)); }
/// <summary> /// Bind the Countryname using countryid /// </summary> /// <param >Takes CountryId</param> public DataSet GetAllStatesByCountryId(int CountryId) { return(StateDB.GetAllStatesByCountryId(CountryId)); }
/// <summary> /// Delete records to State table /// </summary> /// <param >Takes State objects</param> public void DeleteState(int PKStateId) { State objState = new State(PKStateId, 0, "", false); StateDB.ManageState(objState, ActionType.Delete); }
private void ResetSimulation() { blackboard.ClearObjects(); StateDB.Reset(); ScoringDB.Reset(); }
//for deleting the data from the table public void DeleteState(State state) { StateDB = new StateDB(); StateDB.DeleteState(state); }
//for adding the data in the table public void AddState(State state) { StateDB = new StateDB(); StateDB.AddState(state); }
/// <summary> /// Add a Single record to State Table /// </summary> /// <param>Takes State object</param> public void InsertState(State objState) { objState.Validate(); StateDB.ManageState(objState, ActionType.Add); }
public void TestGetStatesDBUnavailable() { /* This test is -supposed- to fail while the database is online and accessible.*/ Assert.Throws <MySqlException>(() => StateDB.GetStates()); }
//getting data from the tables public static object GetStates() { return(StateDB.GetCountryAndState()); }
//for Updating the data in the table public void UpdateState(State state) { StateDB = new StateDB(); StateDB.UpdateState(state); }
/// <summary> /// Fetch the records into gridview takes from State table /// </summary> /// <returns>Takes State object</returns> public DataSet GetAllStates() { return(StateDB.GetAllStates()); }
//for filtering the data public List <State> FilterState(int Id) { StateDB = new StateDB(); return(StateDB.FilteredState(Id)); }
//Getting the filtered data of the state public static object FilteredResultState(int id, bool status) { return(StateDB.FilteredResultState(id, status)); }
/// <summary> /// Fetch the records from State table /// </summary> /// <param>Takes individual objects</param> public State GetStateByStateID(int StateId) { return(StateDB.GetStateByPKStateId(StateId)); }
//for delete the data public void DeleteInState(int StateId) { StateDB.DeleteInSatte(StateId); }