예제 #1
0
        public IHttpActionResult Puthouse(int id, house house)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != house.id)
            {
                return(BadRequest());
            }

            db.Entry(house).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!houseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
 public Node(int x, int y, color c, house pk)
 {
     this.x   = x;
     this.y   = y;
     this.c   = c;
     pathKind = pk;
 }
예제 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            house house = db.houses.Find(id);

            db.houses.Remove(house);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 void Start()
 {
     h = transform.root.GetComponent <house>();
     if (!use_start_inpos)
     {
         inpos = h.transform.InverseTransformPoint(transform.position);
     }
     floor = int.Parse(transform.parent.parent.name.Substring(1, 2));
 }
예제 #5
0
 public void ResetHouse()
 {
     // ARRANGE:
     house h = new house(0, 0)
                                                                                          // ACT:
               h.ResetHouse()                                                             // This method clears the seeds then adds 4 seeds to each house
                                                                                          // ASSERT:
               Assert.areEqual(4, h.GetCount(), "Reset houses must have 4 seeds in them") // At the end, house must have 4 seeds
 }
예제 #6
0
        public IHttpActionResult Posthouse(house house)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.houses.Add(house);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = house.id }, house));
        }
예제 #7
0
 public ActionResult Edit([Bind(Include = "id,name,photo,governorate,address,Lattitude,Longitude,placeId,description")] house house)
 {
     if (ModelState.IsValid)
     {
         db.Entry(house).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.placeId = new SelectList(db.houses, "id", "name", house.placeId);
     ViewBag.placeId = new SelectList(db.places, "id", "name", house.placeId);
     return(View(house));
 }
예제 #8
0
        // GET: houses/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            house house = db.houses.Find(id);

            if (house == null)
            {
                return(HttpNotFound());
            }
            return(View(house));
        }
 public house Insert_house_select(int ID)
 {
     house = house.Select(ID);
     Insert_house_name_txt.Text               = Convert.ToString(house.house_name);
     Insert_house_eligibility_txt.Text        = Convert.ToString(house.house_eligibility);
     Insert_house_request_date_txt.Text       = Convert.ToString(house.house_request_date);
     Insert_house_voucher_amt_txt.Text        = Convert.ToString(house.house_voucher_amt);
     Insert_house_voucher_begin_date_txt.Text = Convert.ToString(house.house_voucher_begin_date);
     Insert_house_voucher_exp_date_txt.Text   = Convert.ToString(house.house_voucher_exp_date);
     Insert_house_voucher_num_txt.Text        = Convert.ToString(house.house_voucher_num);
     Insert_house_voucher_schedule_txt.Text   = Convert.ToString(house.house_voucher_schedule);
     Insert_house_wait_list_txt.Text          = Convert.ToString(house.house_wait_list);
     return(house);
 }
예제 #10
0
        public IHttpActionResult Deletehouse(int id)
        {
            house house = db.houses.Find(id);

            if (house == null)
            {
                return(NotFound());
            }

            db.houses.Remove(house);
            db.SaveChanges();

            return(Ok(house));
        }
        public House createHouse(string housename, string password, int userID, string _addr, string _city, string _state)
        {
            using (var context = new houseMateEntities01())
            {
                if (!houseExists(housename))
                {
                    if (getTID(userID) <= 0)
                    {
                        // create the new house
                        house newHouse = new house
                        {
                            houseName = housename,
                            password = password,
                            address = _addr,
                            city = _city,
                            state = _state
                        };
                        context.houses.Add(newHouse);
                        context.SaveChanges();

                        // create the list for that house
                        list newList = new list
                        {
                            FK_houseID = newHouse.PK_houseID
                        };
                        context.lists.Add(newList);
                        context.SaveChanges();

                        // create the notice board for that house
                        notice_board newNBoard = new notice_board
                        {
                            FK_houseID = newHouse.PK_houseID
                        };
                        context.notice_board.Add(newNBoard);
                        context.SaveChanges();

                        return joinHouse(housename, password, userID);
                    }
                    else
                    {
                        return new House(-1, "already in a house");
                    }
                }
                else
                {
                    return new House(-1, "house doesn't exist");
                }
            }
        }
예제 #12
0
        // GET: houses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            house house = db.houses.Find(id);

            if (house == null)
            {
                return(HttpNotFound());
            }
            ViewBag.placeId = new SelectList(db.houses, "id", "name", house.placeId);
            ViewBag.placeId = new SelectList(db.places, "id", "name", house.placeId);
            return(View(house));
        }
 public house house_insert()
 {
     house.house_name               = Insert_house_name_txt.Text;
     house.house_eligibility        = Insert_house_eligibility_txt.Text;
     house.house_request_date       = Convert.ToDateTime(Insert_house_request_date_txt.Text);
     house.house_voucher_amt        = Convert.ToDecimal(Insert_house_voucher_amt_txt.Text);
     house.house_voucher_begin_date = Convert.ToDateTime(Insert_house_voucher_begin_date_txt.Text);
     house.house_voucher_exp_date   = Convert.ToDateTime(Insert_house_voucher_exp_date_txt.Text);
     house.house_voucher_num        = Convert.ToInt32(Insert_house_voucher_num_txt.Text);
     house.house_voucher_schedule   = Insert_house_voucher_schedule_txt.Text;
     house.house_wait_list          = Convert.ToInt32(Insert_house_wait_list_txt.Text);
     house = house.Insert(house);
     Insert_house_GridView.DataBind();
     Update_house_GridView.DataBind();
     Delete_house_GridView.DataBind();
     return(house);
 }
예제 #14
0
        //запись данных в БД
        private void button1_Click(object sender, EventArgs e)
        {
            @base @base;

            if (radioButton1.Checked == true)
            {
                house house = new house(
                    maskedTextBox1.Text, maskedTextBox2.Text,
                    (int)numericUpDown3.Value, 0, (int)numericUpDown1.Value, (int)numericUpDown2.Value, (int)numericUpDown4.Value, (int)numericUpDown5.Value, (int)numericUpDown6.Value);
                @base = new @base(
                    "insert into house(etag, rooms, s) values(" + house.get_etag() + ", " + house.get_rooms() + ", " + house.get_s() + ") " +
                    "declare @id int " +
                    "select @id = MAX(Id) from house " +
                    "insert into obj (city, street, nm_h, x, y, dop_inf) values(N'" + house.get_city() + "', N'" + house.get_street() + "', " + house.get_nm_h() + ", " + house.get_x() + ", " + house.get_y() + ", @id)");
                @base.zapis_v_bd();
                MessageBox.Show("Данные записанны");
            }
            else if (radioButton2.Checked == true)
            {
                kw kw = new kw(
                    maskedTextBox4.Text, maskedTextBox3.Text, (int)numericUpDown10.Value,
                    (int)numericUpDown11.Value, (int)numericUpDown1.Value, (int)numericUpDown2.Value, (int)numericUpDown9.Value, (int)numericUpDown8.Value, (int)numericUpDown7.Value);
                @base = new @base(
                    "insert into kw(etag, rooms, s) values (" + kw.get_etag() + ", " + kw.get_rooms() + ", " + kw.get_s() + ") " +
                    "declare @id int " +
                    "select @id=MAX(Id) from kw " +
                    "insert into obj (city, street, nm_kw, nm_h, x, y, dop_inf) values (N'" + kw.get_city() + "', N'" + kw.get_street() + "', " + kw.get_nm_kw() + ", " + kw.get_nm_h() + ", " + kw.get_x() + ", " + kw.get_y() + ", @id)");
                @base.zapis_v_bd();
                MessageBox.Show("Данные записанны");
            }
            else if (radioButton3.Checked == true)
            {
                land land = new land(maskedTextBox6.Text, maskedTextBox5.Text, 0, 0, (int)numericUpDown1.Value, (int)numericUpDown2.Value, (int)numericUpDown13.Value);
                @base = new @base("insert into land(s) values (" + land.get_s() + ") declare @id int select @id=MAX(Id) from land insert into obj (city, street, x, y, dop_inf) values (N'" + land.get_city() + "', N'" + land.get_street() + "', " + land.get_x() + ", " + land.get_y() + ", @id)");
                @base.zapis_v_bd();
                MessageBox.Show("Данные записанны");
            }
            else
            {
                MessageBox.Show("Выберите тип недвижимости", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #15
0
        public ActionResult Create(house house)
        {
            if (house.photo_file != null)
            {
                string filename  = Path.GetFileNameWithoutExtension(house.photo_file.FileName.Replace(" ", string.Empty));
                string extention = Path.GetExtension(house.photo_file.FileName.Replace(" ", string.Empty));
                filename    = filename + DateTime.Now.ToString("yymmddssfff") + extention;
                house.photo = "~/Content/images/" + filename;
                filename    = Path.Combine(Server.MapPath("~/Content/images/"), filename);
                house.photo_file.SaveAs(filename);
            }
            if (ModelState.IsValid)
            {
                db.houses.Add(house);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.placeId = new SelectList(db.houses, "id", "name", house.placeId);
            ViewBag.placeId = new SelectList(db.places, "id", "name", house.placeId);
            return(View(house));
        }
 protected void UPDATE(object sender, EventArgs e)
 {
     house = house_update(Convert.ToInt32(Update_house_GridView.SelectedValue));
 }
예제 #17
0
 public void setpathMap(int row, int col, house value)
 {
     pathMap[row, col] = value;
 }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     house = Insert_house_select(Convert.ToInt32(Insert_house_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     house = house_insert();
 }
 protected void Delete_Select_Record(object sender, EventArgs e)
 {
     house = Delete_house_select(Convert.ToInt32(Delete_house_GridView.SelectedValue));
 }
예제 #21
0
        //导入设计数据
        private void btok_Click(object sender, EventArgs e)
        {
            try
            {
                //处理对话框中的数据
                String textProject = this.textProject.Text;
                String txt1        = this.txt1.Text;
                String text2       = this.text2.Text;
                String text3       = this.text3.Text;
                String textPlan    = this.textPlan.Text;
                //始末行号
                String textStart = this.textStart.Text;
                String textEnd   = this.textEnd.Text;

                String houseId = findHouseId(textProject);
                if (string.IsNullOrEmpty(houseId))
                {
                    //保存house数据
                    house house = new house();
                    houseId         = System.Guid.NewGuid().ToString("N");
                    house.Id        = houseId;
                    house.Housename = textProject;
                    saveHouse(house);
                }

                //保存houseplan数据
                houseplan houseplan   = new houseplan();
                String    houseplanid = System.Guid.NewGuid().ToString("N");
                houseplan.Id             = houseplanid;
                houseplan.Houseid        = houseId;
                houseplan.Planname       = textPlan;
                houseplan.Room           = txt1;
                houseplan.Part           = text2;
                houseplan.Materialpackge = text3;
                saveHousePlan(houseplan);

                Microsoft.Office.Interop.Excel.Application excelApp = Globals.ThisAddIn.Application;
                Workbook  wb = ExcelHelper.GetActiveWorkbook(true, excelApp);
                Worksheet ws = null;
                if (wb == null)
                {
                    return;
                }
                //获取第三个工作簿
                ws = wb.Worksheets[3];

                if (ws == null)
                {
                    return;
                }

                //定义集合(工作簿1数据  用于存数据的坐标--数据信息)
                Dictionary <String, bamBean> dic = new Dictionary <String, bamBean>();
                int rowcount = ws.UsedRange.CurrentRegion.Rows.Count;
                //MessageBox.Show("行:" + rowcount);
                int colcount = ws.UsedRange.CurrentRegion.Columns.Count;
                //MessageBox.Show("列:" + colcount);

                //处理行数
                int start = String.IsNullOrEmpty(textStart) ? 5 : int.Parse(textStart);
                int end   = String.IsNullOrEmpty(textEnd) ? rowcount : int.Parse(textEnd);

                for (int i = start; i <= end; i++)
                {
                    //获取当前行的表达式,坐标为:(i,G)
                    String express = "0";
                    if (!string.IsNullOrEmpty(ws.Cells[i, 7].Text))
                    {
                        express = "G" + i + "=" + ws.Cells[i, 7].Text;
                    }
                    String unit = ws.Cells[i, 14].Text;
                    //获取公式
                    String gongshi = ws.Cells[i, 13].Formula;
                    for (int j = 2; j <= colcount; j++)
                    {
                        // 列7 :表达式     列8:单位
                        if (j == 2 || j == 3 || j == 4 || j == 5 || j == 9 || j == 10)
                        {
                            String cName = ws.Cells[i, j].Text;
                            String id    = System.Guid.NewGuid().ToString("N");

                            if (i == start)
                            {
                                //第一行一定是有值的,所以不用判断是否为空
                                designpackge designpackge = new designpackge();
                                //designpackge2Id = System.Guid.NewGuid().ToString("N");
                                designpackge.Id          = id;
                                designpackge.Houseplanid = houseplanid;
                                designpackge.Nametype    = "room";
                                designpackge.Cname       = cName;

                                designpackge.Unit = unit;
                                //designpackge.Parent_id = "-1";

                                //填入公式express
                                if (j == 3 || j == 4 || j == 5 || j == 9)
                                {
                                    designpackge.Expression = express;
                                }
                                else if (j == 10)
                                {
                                    if (string.IsNullOrEmpty(gongshi))
                                    {
                                        designpackge.Expression = "0";
                                    }
                                    else
                                    {
                                        designpackge.Expression = "H" + i + gongshi;
                                    }
                                    //填入物料编码
                                    designpackge.Materialid = ws.Cells[i, 11].Text;
                                }
                                else
                                {
                                    designpackge.Expression = "0";
                                }


                                String Parent_id = "";
                                if (j == 3 || j == 4 || j == 5 || j == 10)
                                {
                                    Parent_id = dic[i + "-" + (j - 1)].Id;
                                }
                                else if (j == 9)
                                {
                                    Parent_id = dic[i + "-" + 5].Id;
                                }
                                else if (j == 2)
                                {
                                    Parent_id = "-1";
                                }
                                designpackge.Parent_id = Parent_id;
                                insertinto(designpackge);


                                //记录数据
                                bamBean bean = new bamBean();
                                bean.Id       = id;
                                bean.Name     = cName;
                                bean.Parentid = Parent_id;
                                dic.Add(i + "-" + j, bean);
                            }
                            else if (i > start)
                            {
                                //大于第一层
                                if (!string.IsNullOrEmpty(cName))
                                {
                                    designpackge designpackge = new designpackge();
                                    //designpackge2Id = System.Guid.NewGuid().ToString("N");
                                    designpackge.Id          = id;
                                    designpackge.Houseplanid = houseplanid;
                                    designpackge.Nametype    = "room";
                                    designpackge.Cname       = cName;
                                    //designpackge.Expression = express;
                                    designpackge.Unit = unit;
                                    //designpackge.Parent_id = "-1";

                                    //填入公式express
                                    if (j == 5)
                                    {
                                        designpackge.Expression = express;
                                    }
                                    else if (j == 10)
                                    {
                                        if (string.IsNullOrEmpty(gongshi))
                                        {
                                            designpackge.Expression = "0";
                                        }
                                        else
                                        {
                                            designpackge.Expression = "H" + i + gongshi;
                                        }
                                        //填入物料编码
                                        designpackge.Materialid = ws.Cells[i, 11].Text;
                                    }
                                    else
                                    {
                                        designpackge.Expression = "0";
                                    }

                                    String Parent_id = "";
                                    if (j == 3 || j == 4 || j == 5 || j == 10)
                                    {
                                        if (String.IsNullOrEmpty(ws.Cells[i, j - 1].Text))
                                        {
                                            Parent_id = dic[(i - 1) + "-" + j].Parentid;
                                        }
                                        else
                                        {
                                            Parent_id = dic[i + "-" + (j - 1)].Id;
                                        }
                                    }
                                    else if (j == 9)
                                    {
                                        if (String.IsNullOrEmpty(ws.Cells[i, j - 1].Text))
                                        {
                                            Parent_id = dic[(i - 1) + "-" + j].Parentid;
                                        }
                                        else
                                        {
                                            Parent_id = dic[i + "-" + 5].Id;
                                        }
                                    }
                                    else if (j == 2)
                                    {
                                        Parent_id = "-1";
                                    }



                                    designpackge.Parent_id = Parent_id;
                                    insertinto(designpackge);


                                    //记录数据
                                    bamBean bean = new bamBean();
                                    bean.Id       = id;
                                    bean.Name     = cName;
                                    bean.Parentid = Parent_id;
                                    dic.Add(i + "-" + j, bean);
                                }
                                else
                                {
                                    // 说明这里只需要存dictionary就行了
                                    //读取自己的name以及父级节点
                                    bamBean bean = new bamBean();
                                    bean.Id = id;
                                    //bean.Name = ws.Cells[i - 1, j].Text;
                                    bean.Name = dic[(i - 1) + "-" + j].Name;

                                    if (j == 3 || j == 4 || j == 5 || j == 9 || j == 10)
                                    {
                                        bean.Parentid = dic[(i - 1) + "-" + j].Parentid;
                                    }
                                    else if (j == 2)
                                    {
                                        bean.Parentid = "-1";
                                    }
                                    dic.Add(i + "-" + j, bean);
                                }
                            }
                        }
                    }
                }
                //关闭窗口
                this.Close();
                MessageBox.Show("导入成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }