protected void btnAAdd_Click(object sender, EventArgs e) { bool result = false; try { #region Adviser AdviserDTO oAdviserDTOs = new AdviserDTO(); oAdviserDTOs.Name = txtAName.Text; oAdviserDTOs.Address = txtAAddress.Text; oAdviserDTOs.Telephone = txtATelephone.Text; oAdviserDTOs.Email = txtAEmail.Text; oAdviserDTOs.Description = txtADescription.InnerText; oAdviserDTOs.Type = Convert.ToInt32(ddlAType.SelectedValue.ToString()); oAdviserDTOs.JoinDate = Convert.ToDateTime(dtpAJoinDate.Text); oAdviserDTOs.Status = Convert.ToInt32(ddlAStatus.SelectedValue.ToString()); oAdviserDTOs.UserName = txtAUserName.Text; string EncryptedPwd = Cryptography.Encryption.Encrypt(txtAPassword.Text, txtAUserName.Text); oAdviserDTOs.Password = EncryptedPwd; oAdviserDTOs.CreatedUser = Session["UserID"].ToString(); oAdviserDTOs.CreatedDateTime = DateTime.Now; oAdviserDTOs.CreatedMachine = Session["UserMachine"].ToString(); oAdviserDTOs.ModifiedUser = Session["UserID"].ToString(); oAdviserDTOs.ModifiedDateTime = DateTime.Now; oAdviserDTOs.ModifiedMachine = Session["UserMachine"].ToString(); #endregion #region Login LoginDTO oLoginDTOs = new LoginDTO(); oLoginDTOs.UserName = txtAUserName.Text; oLoginDTOs.Password = EncryptedPwd; oLoginDTOs.UserType = Convert.ToInt32(Session["UserType"].ToString()); oLoginDTOs.LoginAttempts = 1; oLoginDTOs.CreatedUser = Session["UserID"].ToString(); oLoginDTOs.CreatedDateTime = DateTime.Now; oLoginDTOs.CreatedMachine = Session["UserMachine"].ToString(); oLoginDTOs.ModifiedUser = Session["UserID"].ToString(); oLoginDTOs.ModifiedDateTime = DateTime.Now; oLoginDTOs.ModifiedMachine = Session["UserMachine"].ToString(); #endregion AdviserMaintanance oAdviserMaintanance = new AdviserMaintanance(); oAdviserMaintanance.oAdviserDTO = oAdviserDTOs; oAdviserMaintanance.oLoginDTO = oLoginDTOs; result = oWebApiCalls.InsertAdviserData(oAdviserMaintanance); if (result == true) { ResetControllers(); Messages("Adviser Inserted Successfully!!"); } else { Messages("Connection Error!"); } } catch (Exception ex) { throw ex; } }
private void AdviserInsert() { bool result = false; try { #region Adviser AdviserDTO oAdviserDTOs = new AdviserDTO(); oAdviserDTOs.Name = txtName.Text; oAdviserDTOs.Address = txtAddress.Text; oAdviserDTOs.Telephone = txtTelephone.Text; oAdviserDTOs.Email = txtEmail.Text; oAdviserDTOs.Description = txtDescription.InnerText; oAdviserDTOs.Type = Convert.ToInt32(ddlType.SelectedValue.ToString()); oAdviserDTOs.JoinDate = Convert.ToDateTime(txtJoinDate.Text); //oAdviserDTOs.NumberOfShares = Convert.ToInt32(txtNoOfShares.Text); //oAdviserDTOs.SharePrice = Convert.ToDecimal(txtSharePrice.Text); oAdviserDTOs.Status = Convert.ToInt32(ddlStatus.SelectedValue.ToString()); oAdviserDTOs.UserName = txtUserName.Text; string EncryptedPwd = Cryptography.Encryption.Encrypt(txtPassword.Text, txtUserName.Text); oAdviserDTOs.Password = EncryptedPwd; oAdviserDTOs.CreatedUser = Session["UserID"].ToString(); oAdviserDTOs.CreatedDateTime = DateTime.Now; oAdviserDTOs.CreatedMachine = Session["UserMachine"].ToString(); oAdviserDTOs.ModifiedUser = Session["UserID"].ToString(); oAdviserDTOs.ModifiedDateTime = DateTime.Now; oAdviserDTOs.ModifiedMachine = Session["UserMachine"].ToString(); #endregion #region Login LoginDTO oLoginDTOs = new LoginDTO(); oLoginDTOs.UserName = txtUserName.Text; oLoginDTOs.Password = EncryptedPwd; oLoginDTOs.UserType = Convert.ToInt32(Session["UserType"].ToString()); oLoginDTOs.LoginAttempts = 1; oLoginDTOs.CreatedUser = Session["UserID"].ToString(); oLoginDTOs.CreatedDateTime = DateTime.Now; oLoginDTOs.CreatedMachine = Session["UserMachine"].ToString(); oLoginDTOs.ModifiedUser = Session["UserID"].ToString(); oLoginDTOs.ModifiedDateTime = DateTime.Now; oLoginDTOs.ModifiedMachine = Session["UserMachine"].ToString(); #endregion AdviserMaintanance oAdviserMaintanance = new AdviserMaintanance(); oAdviserMaintanance.oAdviserDTO = oAdviserDTOs; oAdviserMaintanance.oLoginDTO = oLoginDTOs; result = oWebApiCalls.InsertAdviserData(oAdviserMaintanance); if (result == true) { ResetControllers(); Messages("Adviser Inserted Successfully!!"); } else { Messages("Connection Error!"); } } catch (Exception ex) { throw ex; } }