private void btnSave_Click(object sender, EventArgs e) { int er = 0; if (txtName.Text == "") { er++; ep.SetError(txtName, "Required"); } if (cmbCountry.SelectedValue == null || cmbCountry.SelectedValue.ToString() == "") { er++; ep.SetError(cmbCountry, "Required"); } if (er > 0) { return; } DAL.City city = new DAL.City(); city.Name = txtName.Text; city.CountryId = Convert.ToInt32(cmbCountry.SelectedValue); if (city.Insert()) { MessageBox.Show(@"Data Saved"); MyContorls.Hylper.Clear(this); txtName.Focus(); } else { MessageBox.Show(city.Error); } }
private void frmLedgerNew_Load(object sender, EventArgs e) { DAL.City ct = new DAL.City(); DAL.Head h = new DAL.Head(); cmbCity.Source(ct.Select()); cmbHead.Source(h.Select()); }
public static Entities.City CityEntities(DAL.City c) { return(new Entities.City() { CityAreaId = c.CityAreaId, CityId = c.CityId, CityName = c.CityName }); }
private void frmLedgerEdit_Load(object sender, EventArgs e) { DAL.City ct = new DAL.City(); cmbCity.DataSource = ct.Select().Tables[0]; cmbCity.DisplayMember = "name"; cmbCity.ValueMember = "id"; cmbCity.SelectedValue = -1; this.MaximumSize = this.Size; this.MinimumSize = this.Size; }
public static Models.City convertToDto(DAL.City city) { return(new City() { allCountValid = city.allCountValid, areaKod = city.areaKod, cityName = city.cityName, nowCountValid = city.nowCountValid, id = city.id }); }
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlCity = (DropDownList)DetailsView1.FindControl("ddlCity"); DAL.City city = new DAL.City(); city.CountryId = Convert.ToInt32(((DropDownList)DetailsView1.FindControl("ddlCountry")).SelectedValue); ddlCity.DataSource = city.SelectCountry().Tables[0]; ddlCity.DataTextField = "name"; ddlCity.DataValueField = "id"; ddlCity.DataBind(); ddlCity.Items.Insert(0, new ListItem("Select", "0")); }
protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); int er = 0; lblEName.Text = ""; lblECountry.Text = ""; lblMessage.Text = ""; if (txtName.Text == "") { er++; lblEName.Text = "Required"; } if (ddlCountry.SelectedIndex <= 0) { er++; lblECountry.Text = "Select One"; } if (er > 0) { return; } DAL.City ct = new DAL.City(); ct.Name = txtName.Text; ct.CountryId = Convert.ToInt32(ddlCountry.SelectedValue); if (ct.Insert()) { lblMessage.Text = "City Inserted"; lblMessage.ForeColor = System.Drawing.Color.Green; txtName.Text = ""; ddlCountry.SelectedIndex = 0; txtName.Focus(); } else { lblMessage.Text = ct.Error; lblMessage.ForeColor = System.Drawing.Color.Red; } }
public static List <JobView> JobView(List <Job> job) { try { using (DAL.IdialEntities3 dbn = new DAL.IdialEntities3()) { //new connection to the database dbn.Database.Connection.Open(); String diff2 = ""; List <Entities.JobView> jv = new List <JobView>(); DateTime temp; foreach (var item in job) { DAL.Workspace w = dbn.Workspace.FirstOrDefault(p1 => p1.WSId == item.JobWorkspaceId); DAL.SubjectJob s = dbn.SubjectJob.FirstOrDefault(p1 => p1.SubId == item.JobSubId); DAL.OutNet outNet = dbn.OutNet.FirstOrDefault(o => o.OutNetId == item.JobPartOutNetId); DAL.Company company = dbn.Company.FirstOrDefault(q => q.CompanyId == item.JobCompanyId); DAL.City city = dbn.City.FirstOrDefault(c => c.CityId == company.CompanyCityId); DAL.Area area = dbn.Area.FirstOrDefault(a => a.AreaId == company.CompanyAreaId); DAL.SubjectJob SubjectJob = dbn.SubjectJob.FirstOrDefault(o => o.SubId == item.JobSubId); DAL.Part p = dbn.Part.FirstOrDefault(s2 => s2.PartId == item.JobPartId); DAL.Job job1 = dbn.Job.FirstOrDefault(j => j.JobId == item.JobId); Entities.JobView v = new JobView(); DateTime.TryParse(item.JobDateAdv.ToString(), out temp); if (temp != null) { diff2 = Convert.ToInt32((DateTime.Today - temp).TotalDays).ToString(); } v = Entities.JobView.CreateJobView(area, company, job1, SubjectJob, w, p, outNet, city, diff2); jv.Add(v); } db.Database.Connection.Close(); return(jv); } //DAL.IdialEntities3.Connection.Open(); } catch (Exception e) { BL.SendMail.SendEmail(e.ToString(), e.Message, ""); BL.WriteLogError.WriteLogErrors(e.Message); return(null); } }
private void cmbCountry_SelectedIndexChanged(object sender, EventArgs e) { if (cmbCountry.SelectedValue == null || cmbCountry.SelectedValue.ToString() == "") { return; } try { DAL.City city = new DAL.City(); city.CountryId = Convert.ToInt32(cmbCountry.SelectedValue); cmbCity.DataSource = city.Select().Tables[0]; cmbCity.DisplayMember = "name"; cmbCity.ValueMember = "Id"; cmbCity.SelectedValue = -1; } catch (Exception) { } }
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); try { DAL.City ct = new DAL.City(); ct.CountryId = Convert.ToInt32(((DropDownList)sender).SelectedValue); DropDownList ddl = (DropDownList)DetailsView1.FindControl("ddlCity"); ddl.Items.Clear(); ddl.AppendDataBoundItems = true; ddl.Items.Add(new ListItem("Select", "0")); ddl.DataSource = ct.Select().Tables[0]; ddl.DataTextField = "name"; ddl.DataValueField = "id"; ddl.DataBind(); } catch { } }
private void btnSearch_Click(object sender, EventArgs e) { DAL.City city = new DAL.City(); dgvData.DataSource = city.Select().Tables[0]; }
//public JobView():base() //{ //} public static Entities.JobView CreateJobView(DAL.Area a, DAL.Company c, DAL.Job j, DAL.SubjectJob s, DAL.Workspace w, DAL.Part p, DAL.OutNet o, DAL.City ci, string diff) { return(new Entities.JobView() { JobDateAdv = j.JobDateAdv, JobDateShow = diff, CompanyName = c.CompanyName, CompanyId = c.CompanyId, JobRole = j.JobRole, JobDateCaughtJob = j.JobDateCaughtJob, PartName = p.PartName, OutNetName = o.OutNetName, WSName = w.WSName, JobExperience = j.JobExperience, JobStars = j.JobStars, JobDescribe = j.JobDescribe, AreaName = a.AreaName, BossId = j.JobBossId, CityName = ci.CityName, SubjectName = s.SubName, JobRequire = j.JobRequire, JobId = j.JobId }); }