private void show() { CompanyAdapter ca = new CompanyAdapter(); GridView1.DataSource = ca.getCompanyInfo(); GridView1.DataBind(); }
protected void updateUser_Click(object sender, EventArgs e) { CompanyAdapter ca = new CompanyAdapter(); T_Customers company = new T_Customers(); company.CompanyName = txtCompany.Text.Trim(); if (string.IsNullOrEmpty(company.CompanyName)) { Label1.Text = "公司名称不能为空"; return; } company.Address = txtAddress.Text.Trim(); company.Tel = txtTel.Text.Trim(); company.Jingban = txtJingban.Text.Trim(); company.Fadingdaibiaoren = txtFadingdaibiaoren.Text.Trim(); company.Dailiren = txtDailiren.Text.Trim(); if (!string.IsNullOrEmpty(HiddenField1.Value)) { company.Id = Int32.Parse(HiddenField1.Value); try { ca.Save(company); Label1.Text = "保存成功"; init(); show(); } catch (Exception ex) { Label1.Text = ex.Message; } } else { try { ca.insert(company); Label1.Text = "新增成功"; init(); show(); } catch (Exception ex) { Label1.Text = ex.Message; } } }
protected void benDelete_Click(object sender, EventArgs e) { CompanyAdapter ca = new CompanyAdapter(); int id = Int32.Parse(((HiddenField)((Button)sender).Parent.FindControl("hdfId")).Value); try { ca.delete(id); Label1.Text = "删除成功"; show(); } catch (Exception ex) { Label1.Text = ex.Message; } }
protected void ddlGongFang_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl = sender as DropDownList; string companyName = ddl.SelectedItem.Text.Trim(); if (companyName == "请选择" || string.IsNullOrEmpty(companyName)) { return; } TextBox14.Text = companyName; int id = Int32.Parse(ddl.SelectedValue); CompanyAdapter ca = new CompanyAdapter(); T_Customers gongfang = ca.getCompanyInfoById(id); TextBox5.Text = gongfang.Jingban; TextBox6.Text = gongfang.Tel; TextBox9.Text = gongfang.Fadingdaibiaoren; TextBox11.Text = gongfang.Dailiren; }
protected void ddlModel_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl = sender as DropDownList; string companyName = ddl.SelectedItem.Text.Trim(); if (companyName == "请选择" || string.IsNullOrEmpty(companyName)) { return; } TextBox12.Text = txtModel.Text = TextBox15.Text = companyName; int id = Int32.Parse(ddl.SelectedValue); CompanyAdapter ca = new CompanyAdapter(); T_Customers xufang = ca.getXuFangInfoById(id); TextBox4.Text = xufang.Address; TextBox3.Text = xufang.Jingban; TextBox2.Text = xufang.Tel; TextBox8.Text = xufang.Fadingdaibiaoren; TextBox10.Text = xufang.Dailiren; }
public CompanyService(IUnitOfWork unitOfWork, CompanyBuilder companyBuilder, CompanyAdapter companyAdapter) { this.unitOfWork = unitOfWork; this.companyBuilder = companyBuilder; this.companyAdapter = companyAdapter; }