public List <MyCity> cityBind(MyCity Data) { MasterManager cm = new MasterManager(); List <MyCity> st = cm.GetCommonCityMaster(Data); return(st); }
public static void Main() { //MyName mn=new MyName(); //abstract classes cant be instantiated MyCity me=new MyCity(); me.GetName("Praffull Singh"); me.ShowName(); me.ShowCity("London"); me.TestFun(); }
public List <MyCity> GetCommonCityMaster(MyCity Data) { DataTable dt = GetCommonCityValues(Data); for (int i = 0; i < dt.Rows.Count; i++) { ListCity.Add(new MyCity { ID = Int32.Parse(dt.Rows[i]["ID"].ToString()), CityName = dt.Rows[i]["CityName"].ToString(), }); } return(ListCity); }
public void OnClick() { //todo - get current city production if (thisBuildingJob == null) { BuildingJob buildingJob = null; if (BuildingBlueprint != null) { buildingJob = new BuildingJob( BuildingBlueprint.name, BuildingBlueprint.productionCost, 0, () => { BuildingBlueprint.OnBuildingComplete(MyCity); Destroy(gameObject); }, null ); } else if (UnitBlueprint != null) { buildingJob = new BuildingJob( UnitBlueprint.name, UnitBlueprint.productionCost, 0, () => { UnitBlueprint.OnUnitComplete(MyCity); MyCityScreen.RemoveCompletedUnitFromInProgress(UnitBlueprint, MyCity); }, null ); } thisBuildingJob = buildingJob; } MyCity.SetCurrentBuildingJob(thisBuildingJob); if (MyCityScreen) { MyCityScreen.UpdateCurrentProductionText(); } }
protected void btnSave_Click(object sender, EventArgs e) { this.Validate(); int index = Convert.ToInt32(ViewState["EditedIndex"]); int id = Convert.ToInt32(ViewState["EditedId"]); RepeaterItem item = repCities.Items[index]; MyCity my = new MyCity(); if (id != -1) { my = rep.GetEntityById(id) as MyCity; } for (int i = 0; i < item.Controls.Count; i++) { TextBox t = item.Controls[i] as TextBox; if (t != null) { string propName = t.ToolTip; if (my.Name != t.Text) { my.Name = t.Text; } t.Style.Add("display", "none"); } } rep.Save(my); ViewState.Add("EditedId", -1); ViewState.Add("EditedIndex", -1); btnSave.Style.Add("display", "none"); btnCancel.Style.Add("display", "none"); isEditing = true; UpdateData(); }
public string Post(MyCity city) { return(city == null ? "Empty" : city.cname); }
public DataTable GetCommonCityValues(MyCity Data) { string _Query = "Select * from NVO_CityMaster"; return(GetViewData(_Query, "")); }
protected void repCities_ItemCommand(object source, RepeaterCommandEventArgs e) { #region Delete if (e.CommandName == "Delete") { int id = Convert.ToInt32(e.CommandArgument); rep.Delete(id); UpdateData(); } #endregion #region Edit if (e.CommandName == "Edit") { int id = Convert.ToInt32(e.CommandArgument); MyCity my = rep.GetEntityById(id) as MyCity; for (int i = 0; i < e.Item.Controls.Count; i++) { TextBox t = e.Item.Controls[i] as TextBox; if (t != null) { t.Style.Add("display", "block"); t.Text = my.Name; } } int index = -1; for (int i = 0; i < repCities.Items.Count; i++) { if (repCities.Items[i] == e.Item) { index = i; } } ViewState.Add("EditedId", id); ViewState.Add("EditedIndex", index); btnSave.Style.Add("display", "inline"); btnCancel.Style.Add("display", "inline"); isEditing = true; } #endregion #region Add if (e.CommandName == "Add") { List <MyCity> users = rep.GetAll(); MyCity my = new MyCity(); users.Add(my); repCities.DataSource = users; repCities.DataBind(); RepeaterItem item = repCities.Items.OfType <RepeaterItem>().ElementAt(repCities.Items.Count - 1); for (int i = 0; i < item.Controls.Count; i++) { TextBox t = item.Controls[i] as TextBox; if (t != null) { t.Style.Add("display", "block"); object obj = my.Name; t.Text = (obj == null) ? "" : obj.ToString(); } } int index = -1; for (int i = 0; i < repCities.Items.Count; i++) { if (repCities.Items[i] == item) { index = i; } } ViewState.Add("EditedId", -1); ViewState.Add("EditedIndex", index); btnSave.Style.Add("display", "inline"); btnCancel.Style.Add("display", "inline"); isEditing = true; } #endregion }