コード例 #1
0
        private void UpdateAdviserData()
        {
            bool result = false;

            try
            {
                AdviserDTO oAdviserDTO = new AdviserDTO();
                oAdviserDTO.AdviserId   = Convert.ToInt32(Session["AdviserId"].ToString());
                oAdviserDTO.Name        = txtName.Text;
                oAdviserDTO.Address     = txtAddress.Text;
                oAdviserDTO.Telephone   = txtTelephone.Text;
                oAdviserDTO.Email       = txtEmail.Text;
                oAdviserDTO.Description = txtDescription.InnerText;
                oAdviserDTO.Type        = Convert.ToInt32(ddlType.SelectedValue.ToString());
                oAdviserDTO.JoinDate    = Convert.ToDateTime(txtJoinDate.Text);
                //oAdviserDTO.NumberOfShares = Convert.ToInt32(txtNoOfShares.Text);
                //oAdviserDTO.SharePrice = Convert.ToDecimal(txtSharePrice.Text);
                oAdviserDTO.Status   = Convert.ToInt32(ddlStatus.SelectedValue.ToString());
                oAdviserDTO.UserName = txtUserName.Text;

                string EncryptedPwd = Cryptography.Encryption.Encrypt(txtPassword.Text, txtUserName.Text);

                oAdviserDTO.Password         = EncryptedPwd;
                oAdviserDTO.ModifiedUser     = Session["UserID"].ToString();
                oAdviserDTO.ModifiedDateTime = DateTime.Now;
                oAdviserDTO.ModifiedMachine  = Session["UserMachine"].ToString();

                #region Login

                LoginDTO oLoginDTOs = new LoginDTO();

                oLoginDTOs.UserName         = txtUserName.Text;
                oLoginDTOs.Password         = EncryptedPwd;
                oLoginDTOs.UserType         = Convert.ToInt32(Session["UserType"].ToString());
                oLoginDTOs.LoginAttempts    = 1;
                oLoginDTOs.ModifiedUser     = Session["UserID"].ToString();
                oLoginDTOs.ModifiedDateTime = DateTime.Now;
                oLoginDTOs.ModifiedMachine  = Session["UserMachine"].ToString();

                #endregion

                AdviserMaintanance oAdviserMaintanance = new AdviserMaintanance();
                oAdviserMaintanance.oAdviserDTO = oAdviserDTO;
                oAdviserMaintanance.oLoginDTO   = oLoginDTOs;

                result = oWebApiCalls.UpdateAdviserData(oAdviserMaintanance);

                if (result == true)
                {
                    ResetControllers();
                    Messages("Adviser Updated Successfully!!");
                }
                else
                {
                    Messages("Connection Error!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }