Пример #1
0
        private void BrokerInsert()
        {
            bool result = false;

            try
            {
                #region Broker
                BrokerDTO oBrokerDTOs = new BrokerDTO();

                oBrokerDTOs.Name        = txtName.Text;
                oBrokerDTOs.Address     = txtAddress.Text;
                oBrokerDTOs.Telephone   = txtTelephone.Text;
                oBrokerDTOs.Email       = txtEmail.Text;
                oBrokerDTOs.Description = txtDescription.InnerText;
                oBrokerDTOs.Type        = Convert.ToInt32(ddlType.SelectedValue.ToString());
                oBrokerDTOs.JoinDate    = Convert.ToDateTime(txtJoinDate.Text);
                //oBrokerDTOs.NumberOfShares = Convert.ToInt32(txtNoOfShares.Text);
                //oBrokerDTOs.SharePrice = Convert.ToDecimal(txtSharePrice.Text);
                oBrokerDTOs.Status   = Convert.ToInt32(ddlStatus.SelectedValue.ToString());
                oBrokerDTOs.UserName = txtUserName.Text;

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

                oBrokerDTOs.Password         = EncryptedPwd;
                oBrokerDTOs.CreatedUser      = Session["UserID"].ToString();
                oBrokerDTOs.CreatedDateTime  = DateTime.Now;
                oBrokerDTOs.CreatedMachine   = Session["UserMachine"].ToString();
                oBrokerDTOs.ModifiedUser     = Session["UserID"].ToString();
                oBrokerDTOs.ModifiedDateTime = DateTime.Now;
                oBrokerDTOs.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

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

                result = oWebApiCalls.InsertBrokerData(oBrokerMaintanance);

                if (result == true)
                {
                    ResetControllers();
                    Messages("Broker Inserted Successfully!!");
                }
                else
                {
                    Messages("Connection Error!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        protected void btnBrokerAdd_Click(object sender, EventArgs e)
        {
            bool result = false;

            try
            {
                #region Broker
                BrokerDTO oBrokerDTOs = new BrokerDTO();

                oBrokerDTOs.Name        = txtBName.Text;
                oBrokerDTOs.Address     = txtBAddress.Text;
                oBrokerDTOs.Telephone   = txtBTelephone.Text;
                oBrokerDTOs.Email       = txtBEmail.Text;
                oBrokerDTOs.Description = txtBDescription.InnerText;
                oBrokerDTOs.Type        = Convert.ToInt32(ddlBType.SelectedValue.ToString());
                oBrokerDTOs.JoinDate    = Convert.ToDateTime(dtpBJoinDate.Text);
                oBrokerDTOs.Status      = Convert.ToInt32(ddlBStatus.SelectedValue.ToString());
                oBrokerDTOs.UserName    = txtBUserName.Text;

                string EncryptedPwd = Cryptography.Encryption.Encrypt(txtBPassword.Text, txtBUserName.Text);

                oBrokerDTOs.Password         = EncryptedPwd;
                oBrokerDTOs.CreatedUser      = Session["UserID"].ToString();
                oBrokerDTOs.CreatedDateTime  = DateTime.Now;
                oBrokerDTOs.CreatedMachine   = Session["UserMachine"].ToString();
                oBrokerDTOs.ModifiedUser     = Session["UserID"].ToString();
                oBrokerDTOs.ModifiedDateTime = DateTime.Now;
                oBrokerDTOs.ModifiedMachine  = Session["UserMachine"].ToString();
                #endregion

                #region Login

                LoginDTO oLoginDTOs = new LoginDTO();

                oLoginDTOs.UserName         = txtBUserName.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

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

                result = oWebApiCalls.InsertBrokerData(oBrokerMaintanance);

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