コード例 #1
0
        //inserting the data
        public void InsertInState(int fKCountryId, string stateName, bool isActive)
        {
            StateData objstateData = new StateData(fKCountryId, stateName, isActive);

            objstateData.Validate();
            StateDB.InsertInState(objstateData);
        }
コード例 #2
0
        public void TestGetStates()
        {
            List <State> states = StateDB.GetStates();

            Assert.AreEqual(53, states.Count);
            Assert.AreEqual("Alabama", states[0].StateName);
        }
コード例 #3
0
    //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);
    }
コード例 #4
0
    /// <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);
    }
コード例 #5
0
 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));
     }
 }
コード例 #6
0
 //for updating the state table
 public void UpdateInState(StateData objStateData)
 {
     try
     {
         objStateData.Validate();
         StateDB.UpdateInState(objStateData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #7
0
 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");
     }
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 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;
     }
 }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
        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");
            }
        }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
        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());
            }
        }
コード例 #14
0
 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;
 }
コード例 #15
0
 //for getting the data from the table
 public object GetStates()
 {
     StateDB = new StateDB();
     return(StateDB.GetState());
 }
コード例 #16
0
 public bool IsStateExist(string StateName, int FKCountryId, int PKStateId)
 {
     return(StateDB.IsStateExist(StateName, FKCountryId, PKStateId));
 }
コード例 #17
0
    /// <summary>
    /// Bind the Countryname using countryid
    /// </summary>
    /// <param >Takes CountryId</param>

    public DataSet GetAllStatesByCountryId(int CountryId)
    {
        return(StateDB.GetAllStatesByCountryId(CountryId));
    }
コード例 #18
0
    /// <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);
    }
コード例 #19
0
 private void ResetSimulation()
 {
     blackboard.ClearObjects();
     StateDB.Reset();
     ScoringDB.Reset();
 }
コード例 #20
0
 //for deleting the data from the table
 public void DeleteState(State state)
 {
     StateDB = new StateDB();
     StateDB.DeleteState(state);
 }
コード例 #21
0
 //for adding the data in the table
 public void AddState(State state)
 {
     StateDB = new StateDB();
     StateDB.AddState(state);
 }
コード例 #22
0
 /// <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);
 }
コード例 #23
0
 public void TestGetStatesDBUnavailable()
 {
     /* This test is -supposed- to fail while the database is online and accessible.*/
     Assert.Throws <MySqlException>(() => StateDB.GetStates());
 }
コード例 #24
0
 //getting data from the  tables
 public static object GetStates()
 {
     return(StateDB.GetCountryAndState());
 }
コード例 #25
0
 //for Updating the data in the table
 public void UpdateState(State state)
 {
     StateDB = new StateDB();
     StateDB.UpdateState(state);
 }
コード例 #26
0
 /// <summary>
 /// Fetch the records into gridview takes from State table
 /// </summary>
 /// <returns>Takes State object</returns>
 public DataSet GetAllStates()
 {
     return(StateDB.GetAllStates());
 }
コード例 #27
0
 //for filtering the data
 public List <State> FilterState(int Id)
 {
     StateDB = new StateDB();
     return(StateDB.FilteredState(Id));
 }
コード例 #28
0
 //Getting the filtered data of the state
 public static object FilteredResultState(int id, bool status)
 {
     return(StateDB.FilteredResultState(id, status));
 }
コード例 #29
0
    /// <summary>
    /// Fetch the records from State table
    /// </summary>
    /// <param>Takes individual objects</param>

    public State GetStateByStateID(int StateId)
    {
        return(StateDB.GetStateByPKStateId(StateId));
    }
コード例 #30
0
 //for delete the data
 public void DeleteInState(int StateId)
 {
     StateDB.DeleteInSatte(StateId);
 }