protected void btnUpdate_Click(object sender, EventArgs e) { int coId = (int)Session[WebConstants.Session.REG_CO_ID]; CompanyTableAdapters.un_co_detailsTableAdapter coTA = new CompanyTableAdapters.un_co_detailsTableAdapter(); if (coTA.GetCompanyByName(txtCompanyShortName.Text, coId).GetEnumerator().MoveNext()) { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } else { coTA.Update(false, txtCompanyShortName.Text, txtCompanyLongName.Text, txtContactTitle.Text, txtContactInitial.Text, txtForename.Text, txtSurname.Text, txtAddressNo.Text, txtAddress1.Text, txtAddress2.Text, txtAddress3.Text, txtAddress4.Text, txtAddress5.Text, txtPostalCode.Text, getFullAddress(), txtTele.Text, txtTele1.Text, txtFax.Text, txtEmail.Text, txtCoNotes.Text, 0, 0, false, null, DateTime.Now, cbAutoSave.Checked, tbFireWarden.Text, tbFirstAider.Text, cbMultiSups.Checked, tbSupervisor.Text, true, DateTime.Today, 15, Utility.GetTrialEndDate(DateTime.Today,15),true, coId); SetInfoMessage(WebConstants.Messages.Information.RECORD_SAVED); Session[WebConstants.Session.WIZARD_STEP] = 2; Response.Redirect("~/Register/AddDepartment.aspx"); } }
public void HandlePostLoginProcess(int userId, string role, int coId) { TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0); HttpContext.Current.Cache.Insert(userId.ToString(), HttpContext.Current.Request.UserHostAddress, null, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, null); Company.un_co_detailsRow company = DatabaseUtility.GetCompany(coId); if (company != null && company.flg_show_wizard) { HttpContext.Current.Session[WebConstants.Session.REG_CO_ID] = company.co_id; HttpContext.Current.Session[WebConstants.Session.REG_USER_ID] = userId; DepartmentTableAdapters.DepartmentSelectCommandTableAdapter deptTA = new DepartmentTableAdapters.DepartmentSelectCommandTableAdapter(); IEnumerator ie = deptTA.GetDepartmentsByCoId(coId).GetEnumerator(); if (ie.MoveNext()) { Department.DepartmentSelectCommandRow department = (Department.DepartmentSelectCommandRow)ie.Current; HttpContext.Current.Session[WebConstants.Session.REG_DEPT_ID] = department.dept_id; } if (company.Isflg_trialNull() == true || company.flg_trial == false) { company.trial_start_date = DateTime.Today; company.flg_trial = true; company.trial_num_of_days = 15; company.trial_end_date = Utility.GetTrialEndDate(DateTime.Today, 15); CompanyTableAdapters.un_co_detailsTableAdapter coTA = new CompanyTableAdapters.un_co_detailsTableAdapter(); coTA.Update(company); } HttpContext.Current.Response.Redirect("~/Register/AddCompany.aspx"); } else if (role.Equals(WebConstants.Roles.User)) { HttpContext.Current.Response.Redirect("TermsConditions.aspx"); } else { HttpContext.Current.Response.Redirect(role + "Home.aspx"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { int coId = int.Parse(Request[WebConstants.Request.CO_ID]); CompanyTableAdapters.un_co_detailsTableAdapter coTA = new CompanyTableAdapters.un_co_detailsTableAdapter(); if (coTA.GetCompanyByName(txtCompanyShortName.Text, coId).GetEnumerator().MoveNext()) { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } else if(Validate()) { if (cbTrial.Checked) { coTA.Update(false, txtCompanyShortName.Text, txtCompanyLongName.Text, txtContactTitle.Text, txtContactInitial.Text, txtForename.Text, txtSurname.Text, txtAddressNo.Text, txtAddress1.Text, txtAddress2.Text, txtAddress3.Text, txtAddress4.Text, txtAddress5.Text, txtPostalCode.Text, getFullAddress(), txtTele.Text, txtTele1.Text, txtFax.Text, txtEmail.Text, txtCoNotes.Text, 0, 0, false, loggedInUserId, DateTime.Now, cbAutoSave.Checked, tbFireWarden.Text, tbFirstAider.Text, cbMultiSups.Checked, tbSupervisor.Text, cbTrial.Checked, tbTrialStartDate.SelectedDate, int.Parse(tbTrialNumOfDays.Text), GetTrialEndDate(),cbWizard.Checked, coId); } else { coTA.Update(false, txtCompanyShortName.Text, txtCompanyLongName.Text, txtContactTitle.Text, txtContactInitial.Text, txtForename.Text, txtSurname.Text, txtAddressNo.Text, txtAddress1.Text, txtAddress2.Text, txtAddress3.Text, txtAddress4.Text, txtAddress5.Text, txtPostalCode.Text, getFullAddress(), txtTele.Text, txtTele1.Text, txtFax.Text, txtEmail.Text, txtCoNotes.Text, 0, 0, false, loggedInUserId, DateTime.Now, cbAutoSave.Checked, tbFireWarden.Text, tbFirstAider.Text, cbMultiSups.Checked, tbSupervisor.Text, cbTrial.Checked, null,null,null,cbWizard.Checked,coId); } SetInfoMessage(WebConstants.Messages.Information.RECORD_SAVED); } }