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

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

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

                oBrokerDTO.Password         = EncryptedPwd;
                oBrokerDTO.ModifiedUser     = Session["UserID"].ToString();
                oBrokerDTO.ModifiedDateTime = DateTime.Now;
                oBrokerDTO.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.ModifiedUser     = Session["UserID"].ToString();
                oLoginDTOs.ModifiedDateTime = DateTime.Now;
                oLoginDTOs.ModifiedMachine  = Session["UserMachine"].ToString();

                #endregion

                BrokerMaintanance oBrokerMaintanance = new BrokerMaintanance();
                oBrokerMaintanance.oBrokerDTO = oBrokerDTO;
                oBrokerMaintanance.oLoginDTO  = oLoginDTOs;

                result = oWebApiCalls.UpdateBrokerData(oBrokerMaintanance);

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