protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string companyId = GetQueryParameterValue(QueryStringNames.QUERY_STR_COMPANY_ID); ViewState[QueryStringNames.QUERY_STR_COMPANY_ID] = companyId; if (!String.IsNullOrEmpty(companyId)) { CMNUserDataSet course = _cmnBC.getCompanyDataSetById(companyId); if (course.T_CMN003_COMPANY.Rows.Count > 0) { CMNUserDataSet.T_CMN003_COMPANYRow companyRow = (CMNUserDataSet.T_CMN003_COMPANYRow)course.T_CMN003_COMPANY.Rows[0]; companyName.Text = companyRow.COMPANY_NAME; companyDetail.Text = companyRow.COMPANY_DETAIL; contactInfo.Text = companyRow.COMPANY_CONTACT; location.Text = companyRow.COMPANY_LOCATION; this.UserDataBind(); } else { ShowMessage("No Company Found!", MessageSeverity.Information); } } } }
protected void btnUpdateCompany_Click(object sender, EventArgs e) { string companyId = ViewState[QueryStringNames.QUERY_STR_COMPANY_ID].ToString(); if (!string.IsNullOrEmpty(companyId)) { CMNUserDataSet companyDS = (CMNUserDataSet)_cmnBC.getCompanyDataSetById(companyId); CMNUserDataSet.T_CMN003_COMPANYRow companyRow = (CMNUserDataSet.T_CMN003_COMPANYRow)companyDS.T_CMN003_COMPANY.Rows[0]; companyRow.COMPANY_NAME = this.companyName.Text; companyRow.COMPANY_DETAIL = this.companyDetail.Text; companyRow.COMPANY_CONTACT = this.contactInfo.Text; companyRow.COMPANY_LOCATION = this.location.Text; _bc.UpdateTable(companyDS.T_CMN003_COMPANY); ShowMessage("Update Successfully!", MessageSeverity.Information); //Response.Redirect("~/Secure/User/ListCompany.aspx"); } }
protected void btnAddCompany_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.companyName.Text)) { CMNUserDataSet userDS = new CMNUserDataSet(); CMNUserDataSet.T_CMN003_COMPANYRow companyRow = userDS.T_CMN003_COMPANY.NewT_CMN003_COMPANYRow(); companyRow.COMPANY_ID = Utility.NewDataKey(); companyRow.COMPANY_NAME = this.companyName.Text; companyRow.COMPANY_DETAIL = this.companyDetail.Text; companyRow.COMPANY_CONTACT = this.contactInfo.Text; companyRow.COMPANY_LOCATION = this.location.Text; Utility.UpdateCommonFields(companyRow); userDS.T_CMN003_COMPANY.AddT_CMN003_COMPANYRow(companyRow); _bc.UpdateTable(userDS.T_CMN003_COMPANY); RedirectToCompanyList(); } }