public ActionResult Edit(int id, int positionType, int constiuent)
        {
            var committee = new Committee();
            TryUpdateModel(committee);
            committee.Type = new PositionType() { Id = positionType };
            committee.Constituent = new Constituent { Id = constiuent };

            mapper = new AutoDataContractMapper();
            var committeeData = new CommitteeData();
            mapper.Map(committee, committeeData);

            HttpHelper.Put(string.Format(serviceBaseUri + "/Committees/{0}", id), committeeData);
            return PartialView(new GridModel(GetCommitteeMembers()));
        }
示例#2
0
        public void CanCreateNewCommittee()
        {
            var newCommittee = new Committee() {Name = "COMMITTEE", Inactive = false};

            Assert.IsTrue(newCommittee.IsTransient(), "Should not yet be in the DB");

            using (var ts = new TransactionScope())
            {
                Repository.OfType<Committee>().EnsurePersistent(newCommittee);
                ts.CommitTransaction();
            }

            Assert.IsFalse(newCommittee.IsTransient(), "Should now be in the DB");
        }
        public string get_committee(string project_id, int type_person)
        {
            ComitteeList c = new ComitteeList();
            Committee stg = new Committee();
            c.commitee = new List<Committee>();
            string pers_id = "";
            try
            {
                string constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT PersID FROM Relation WHERE Status_ID = '3' AND ProjID='" + project_id + "'";

                SqlCommand qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader = qrproject.ExecuteReader();

                if (reader.Read())
                {
                    pers_id = reader["PersID"].ToString();
                }
                reader.Close();
                con.Close();

            }
            catch
            {
                c.code = 1;
                c.msg = "Error";
                return JsonConvert.SerializeObject(c);
            }

            try
            {
                string constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT Title, Fname, Lname FROM person WHERE PersID='" + pers_id + "'";

                SqlCommand qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader = qrproject.ExecuteReader();

                while (reader.Read())
                {
                    stg = new Committee();
                    stg.title_person = reader["Title"].ToString();
                    stg.firstName = reader["Fname"].ToString();
                    stg.lastName = reader["Lname"].ToString();
                    c.commitee.Add(stg);
                }
                reader.Close();
                con.Close();

                c.code = 0;
                c.msg = "OK";

                return JsonConvert.SerializeObject(c);
            }
            catch
            {
                c.code = 1;
                c.msg = "Error";
                return JsonConvert.SerializeObject(c);
            }
        }
 public void Update(int id, Committee entity)
 {
     var existing = GetById(id);
     existing.Name = entity.Name;
     existing.Description = entity.Description;
 }
 public void Add(Committee entity)
 {
     Context.CommitteeSet.AddObject(entity);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     var c = new Committee();
 }
示例#7
0
 public static List <ListItem> GetCommitteePositionListItems(Committee c)
 {
     return(GetCommitteePositionListItems(c, true));
 }