protected override void setQueryParameters(OleDbParameterCollection parameters, QueryCondition queryCondition) { ApartmentQueryCondition qc = (ApartmentQueryCondition)queryCondition; if (!string.IsNullOrWhiteSpace(qc.unit_number)) { parameters.Add("@unit_number", OleDbType.VarWChar, 255).Value = "%" + qc.unit_number + "%"; } if (!string.IsNullOrWhiteSpace(qc.floorplan_id)) { parameters.Add("@floorplan_id", OleDbType.VarWChar, 255).Value = qc.floorplan_id; } if (!string.IsNullOrWhiteSpace(qc.building_id)) { parameters.Add("@building_id", OleDbType.VarWChar, 255).Value = qc.building_id; } else if (!string.IsNullOrWhiteSpace(qc.stage_id)) { parameters.Add("@stage_id", OleDbType.VarWChar, 255).Value = qc.stage_id; } else if (!string.IsNullOrWhiteSpace(qc.project_id)) { parameters.Add("@project_id", OleDbType.VarWChar, 255).Value = qc.project_id; } }
public ApartmentWindow(ListWindowType windowType, ApartmentQueryCondition qc) { this.queryCondition = qc; currentEntity = null; this.windowType = windowType; this.Init(); }
protected override String getQuerySQL(QueryCondition queryCondition) { ApartmentQueryCondition qc = (ApartmentQueryCondition)queryCondition; string rs = SQL_QUERY; string conditions = null; if (!string.IsNullOrWhiteSpace(qc.unit_number)) { conditions += this.getConditionsPre(conditions, "AND", "a.unit_number LIKE @unit_number"); } if (!string.IsNullOrWhiteSpace(qc.floorplan_id)) { conditions += this.getConditionsPre(conditions, "AND", "a.floorplan_id = @floorplan_id"); } if (!string.IsNullOrWhiteSpace(qc.building_id)) { conditions += this.getConditionsPre(conditions, "AND", "f.building_id = @building_id"); } else if (!string.IsNullOrWhiteSpace(qc.stage_id)) { conditions += this.getConditionsPre(conditions, "AND", "s.id = @stage_id"); } else if (!string.IsNullOrWhiteSpace(qc.project_id)) { conditions += this.getConditionsPre(conditions, "AND", "f.project_id = @project_id"); } rs += conditions; return(rs); }
private void button_Search_Click(object sender, EventArgs e) { this.queryCondition = new ApartmentQueryCondition(); this.queryCondition.project_id = (string)this.comboBox_Query_Project.SelectedValue; this.queryCondition.stage_id = (string)this.comboBox_Query_Stage.SelectedValue; this.queryCondition.building_id = (string)this.comboBox_Query_Building.SelectedValue; this.queryCondition.floorplan_id = (string)this.comboBox_Query_Floorplan.SelectedValue; this.queryCondition.unit_number = this.textBox_UnitNumber.Text; this.RefreshData(); }
private void toolStripMenuItem_QueryApartment_Click(object sender, EventArgs e) { if (this.dataGridView.SelectedExistData()) { IList <string> ids = this.dataGridView.SelectedIds(); ApartmentQueryCondition qc = new ApartmentQueryCondition(); qc.project_id = ids[0]; ApartmentWindow queryWindow = new ApartmentWindow(qc); queryWindow.ShowDialog(this); } }
private void toolStripMenuItem_QueryApartment_Click(object sender, EventArgs e) { if (this.dataGridView.SelectedExistData()) { IList <Building> objects = this.dataGridView.SelectedObjects(); ApartmentQueryCondition qc = new ApartmentQueryCondition(); qc.project_id = objects[0].project_id; qc.stage_id = objects[0].stage_id; qc.building_id = objects[0].id; ApartmentWindow queryWindow = new ApartmentWindow(qc); queryWindow.ShowDialog(this); } }
public override void remove(IList <string> ids) { foreach (string id in ids) { ApartmentQueryCondition qc = new ApartmentQueryCondition(); qc.floorplan_id = id; IList <Apartment> apartments = this.apartmentDao.query(qc); IList <string> apartmentIds = new List <string>(); foreach (Apartment s in apartments) { apartmentIds.Add(s.id); } this.apartmentDao.remove(apartmentIds); } base.remove(ids); }
public ApartmentWindow(ApartmentQueryCondition qc) { this.queryCondition = qc; currentEntity = null; this.Init(); }
public void RefreshData() { this.dataGridView.queryCondition = this.queryCondition; this.dataGridView.RefreshGrid(); }