private void BindValues() { CaseAdmin _CaseAdmin = new CaseAdmin(); CaseRequest _CaseList = _CaseAdmin.GetByCaseID(ItemID); if (_CaseList != null) { //Set General Case Information lblCreatedDate.Text = _CaseList.CreateDte.ToShortDateString(); lblTitle.Text = _CaseList.Title; lblCaseTitle.Text = _CaseList.Title; lblAccountName.Text = this.GetAccountTypeByAccountID(_CaseList.AccountID); lblCaseStatus.Text = this.GetCaseStatusByCaseID(_CaseList.CaseStatusID); lblCasePriority.Text = this.GetCasePriorityByCaseID(_CaseList.CasePriorityID); //txtCaseDescription.Text = _CaseList.Description; lblCaseDescription.Text = _CaseList.Description; //Set Customer Information lblCustomerName.Text = _CaseList.FirstName + " " + _CaseList.LastName; lblCompanyName.Text = _CaseList.CompanyName; lblEmailID.Text = _CaseList.EmailID; lblPhoneNumber.Text = _CaseList.PhoneNumber; } }
private void BindEditData() { CaseAdmin _CaseAdmin = new CaseAdmin(); CaseRequest _CaseList = _CaseAdmin.GetByCaseID(itemID); if (_CaseList != null) { if (_CaseList.AccountID == null) {} else { lstAccountList.SelectedValue = _CaseList.AccountID.ToString(); } if (lstCasePriority.Items.Count > 0) { lstCaseStatus.SelectedValue = _CaseList.CaseStatusID.ToString(); } if (lstCaseStatus.Items.Count > 0) { lstCasePriority.SelectedValue = _CaseList.CasePriorityID.ToString(); } //set Values txtCaseTitle.Text = _CaseList.Title; txtCaseDescription.Text = _CaseList.Description.Replace("<br>", "\r\n"); txtFirstName.Text = _CaseList.FirstName; txtLastName.Text = _CaseList.LastName; txtCompanyName.Text = _CaseList.CompanyName; txtEmailID.Text = _CaseList.EmailID; txtPhoneNo.Text = _CaseList.PhoneNumber; lblCaseDate.Text = _CaseList.CreateDte.ToShortDateString(); } }
/// <summary> /// Submit Button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { CaseAdmin _CaseAdmin = new CaseAdmin(); CaseRequest _CaseList = new CaseRequest(); //If edit mode then retrieve data first if (itemID > 0 ) { _CaseList = _CaseAdmin.GetByCaseID(itemID); } //Set Null Values _CaseList.OwnerAccountID = null; _CaseList.CaseOrigin = "admin"; _CaseList.CreateUser = System.Web.HttpContext.Current.User.Identity.Name; _CaseList.CreateDte = System.DateTime.Now; _CaseList.PortalID = ZNodeConfigManager.SiteConfig.PortalID; //Set Values _CaseList.Title = txtCaseTitle.Text.Trim(); _CaseList.Description = txtCaseDescription.Text.Trim(); _CaseList.EmailID = txtEmailID.Text.Trim(); _CaseList.FirstName = txtFirstName.Text.Trim(); _CaseList.LastName = txtLastName.Text.Trim(); _CaseList.PhoneNumber = txtPhoneNo.Text.Trim(); _CaseList.CompanyName = txtCompanyName.Text.Trim(); if (lstAccountList.SelectedValue == "-1") { _CaseList.AccountID = null; } else { _CaseList.AccountID = int.Parse(lstAccountList.SelectedValue); } if (lstCasePriority.SelectedIndex != -1) { _CaseList.CasePriorityID = int.Parse(lstCasePriority.SelectedValue); } if (lstCaseStatus.SelectedValue != null) { _CaseList.CaseStatusID = int.Parse(lstCaseStatus.SelectedValue); } bool retval = false; if (itemID > 0) { retval = _CaseAdmin.Update(_CaseList); } else { retval = _CaseAdmin.Add(_CaseList); } if (retval) { //redirect to list page Response.Redirect("~/admin/secure/sales/cases/list.aspx"); } else { //display error message lblMsg.Text = "An error occurred while updating. Please try again."; } }
private void BindData() { CaseAdmin _CaseAdmin = new CaseAdmin(); CaseRequest _CaseList = _CaseAdmin.GetByCaseID(ItemId); if (_CaseList != null) { txtEmailSubj.Text = _CaseList.Title; lblEmailid.Text = _CaseList.EmailID; } }