public void BindData() { if (view_action == "notify") { Model.Contact_US cp = Factory.GetExecution().SelectByID <Model.Contact_US>(requestID); if (cp != null) { if (cp.Language == 1) { Chinese.Checked = true; } else if (cp.Language == 3) { English.Checked = true; } else if (cp.Language == 2) { Traditional.Checked = true; } txtTitle.Text = cp.Title; txtDepartment.Text = cp.Department; txtCompany.Text = cp.Company; txtAddress.Text = cp.Address; txtPhone.Text = cp.Phone; txtFax.Text = cp.Fax; txtPostcode.Text = cp.Postcode; txtmailbox.Text = cp.mailbox; txtCreatePeople.Text = cp.CreatePeople; HomePageUploadImg.ImageUrl = WebSite.IMAGESERVER_WEBPATH + photoPath + cp.LogoUrl; HomePageUploadFileName.Text = cp.LogoUrl; txtKeywords.Text = cp.Keywords; txtDescription.Text = cp.Description; } } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (view_action == "notify") { Model.Contact_US cp = Factory.GetExecution().SelectByID <Model.Contact_US>(requestID); if (cp != null) { cp.Language = Convert.ToInt32(Request.Form["language"]); cp.Title = txtTitle.Text; cp.Department = txtDepartment.Text; cp.Company = txtCompany.Text; cp.Address = txtAddress.Text; cp.Phone = txtPhone.Text; cp.Fax = txtFax.Text; cp.Postcode = txtPostcode.Text; cp.mailbox = txtmailbox.Text; cp.CreatePeople = txtCreatePeople.Text; cp.LogoUrl = HomePageUploadFileName.Text; cp.CreatePeople = txtCreatePeople.Text; cp.UpdateTime = DateTime.Now; cp.Keywords = txtKeywords.Text.Trim(); cp.Description = txtDescription.Text.Trim(); bool flag = Factory.GetExecution().Update <Model.Contact_US>(cp); if (flag) { Common.MessageBox.ShowRedirect(this, "/ContactUs/ContactInformation.aspx"); } } } else { Model.Contact_US cp = new Model.Contact_US(); cp.Language = Convert.ToInt32(Request.Form["language"]); cp.Title = txtTitle.Text; cp.Department = txtDepartment.Text; cp.Company = txtCompany.Text; cp.Address = txtAddress.Text; cp.Phone = txtPhone.Text; cp.Fax = txtFax.Text; cp.Postcode = txtPostcode.Text; cp.mailbox = txtmailbox.Text; cp.BrowseTimes = 0; cp.CreatePeople = txtCreatePeople.Text; cp.LogoUrl = HomePageUploadFileName.Text; cp.CreatePeople = txtCreatePeople.Text; cp.UpdateTime = DateTime.Now; cp.CreateTime = DateTime.Now; cp.Keywords = txtKeywords.Text.Trim(); cp.Description = txtDescription.Text.Trim(); bool flag = Factory.GetExecution().Add <Model.Contact_US>(cp); if (flag) { Common.MessageBox.ShowRedirect(this, "/ContactUs/ContactInformation.aspx"); } } } catch (Exception ex) { Common.MessageBox.ShowLayer(this, "添加失败!" + ex.Message, 2); } finally { BindData(); } }