protected void btnUpdate_Click(object sender, EventArgs e) { UserTableAdapters.un_co_user_detailsTableAdapter userTA = new UserTableAdapters.un_co_user_detailsTableAdapter(); if (userTA.GetUserByLogonName(tbUserLogon.Text, (int)Session[WebConstants.Session.REG_USER_ID]).GetEnumerator().MoveNext()) { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } else { IEnumerator ieUsers = userTA.GetUserById((int)Session[WebConstants.Session.REG_USER_ID]).GetEnumerator(); if (ieUsers.MoveNext()) { User.un_co_user_detailsRow user = (User.un_co_user_detailsRow)ieUsers.Current; //user.user_name = tbUserName.Text; user.user_telephone = tbTelephone.Text; user.user_tel_ext = tbTelExt.Text; user.user_tel_mobile = tbMobile.Text; user.user_email = tbEmail.Text; user.user_department = tbDepartment.Text; user.user_location = tbLocation.Text; user.date_last_amended = DateTime.Now; userTA.Update(user); TransferTableAdapters.TransferTableAdapter tranTA = new TransferTableAdapters.TransferTableAdapter(); tranTA.TransferAll(int.Parse(ConfigurationSettings.AppSettings["SourceCompanyId"]), int.Parse(ConfigurationSettings.AppSettings["SourceDepartmentId"]), (int)Session[WebConstants.Session.REG_CO_ID], (int)Session[WebConstants.Session.REG_DEPT_ID], (int)Session[WebConstants.Session.REG_USER_ID]); UpdateTrialLicense(); Session[WebConstants.Session.WIZARD_STEP] = 4; Response.Redirect("~/Register/UploadOrders.aspx"); } } }
protected void btnSave_Click(object sender, EventArgs e) { UserTableAdapters.un_co_user_detailsTableAdapter userTA = new UserTableAdapters.un_co_user_detailsTableAdapter(); if (tbUserEnable.Text != tbConfirmUserEnable.Text) { SetErrorMessage("Passwords do not match"); return; } if (userTA.GetUserByLogonName(tbUserLogon.Text, null).GetEnumerator().MoveNext()) { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } else { IEnumerator ie = userTA.InsertAndReturn(false, (int)Session[WebConstants.Session.REG_CO_ID],1, tbUserName.Text, tbUserLogon.Text, Utility.GetMd5Sum(tbUserEnable.Text), tbUserEnableReminder.Text, tbTelephone.Text, tbTelExt.Text, tbMobile.Text, tbEmail.Text, tbDepartment.Text, tbLocation.Text, null, DateTime.Now, null, DateTime.Now,WebConstants.Roles.User).GetEnumerator(); if(ie.MoveNext()) { User.un_co_user_detailsRow user = (User.un_co_user_detailsRow)ie.Current; Session[WebConstants.Session.REG_USER_ID] = user.user_id; SetInfoMessage(WebConstants.Messages.Information.RECORD_SAVED); TransferTableAdapters.TransferTableAdapter tranTA = new TransferTableAdapters.TransferTableAdapter(); tranTA.TransferAll(int.Parse(AppSettings["SourceCompanyId"]), int.Parse(AppSettings["SourceDepartmentId"]), (int)Session[WebConstants.Session.REG_CO_ID], (int)Session[WebConstants.Session.REG_DEPT_ID], user.user_id); UpdateTrialLicense(); Session[WebConstants.Session.WIZARD_STEP] = 4; Response.Redirect("~/Register/UploadOrders.aspx"); } } }
protected void gv2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Transfer")) { try { int id = int.Parse(e.CommandArgument.ToString()); TransferTableAdapters.TransferTableAdapter transferTA = new TransferTableAdapters.TransferTableAdapter(); transferTA.TransferPeople(id, int.Parse(ddlCompany1.Text), int.Parse(ddlDepartment1.Text), loggedInUserId); } catch { } } }
protected void btnTransferAll2_Click(object sender, EventArgs e) { foreach (GridViewRow gr in gv2.Rows) { try { HiddenField hfId = (HiddenField)gr.FindControl("hfId2"); TransferTableAdapters.TransferTableAdapter ta = new TransferTableAdapters.TransferTableAdapter(); ta.TransferPeople(int.Parse(hfId.Value), int.Parse(ddlCompany1.SelectedValue), int.Parse(ddlDepartment1.SelectedValue), loggedInUserId); } catch { } } }