/// <summary> /// /// </summary> /// <param name="objInvestor"></param> /// <returns></returns> internal int AddNewInvestorProfile(Business.Investor objInvestor) { int Result = -1; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InvestorProfileTableAdapter adap = new DSTableAdapters.InvestorProfileTableAdapter(); try { conn.Open(); adap.Connection = conn; Result = int.Parse(adap.AddNewInvestorProfile(objInvestor.InvestorID, objInvestor.Address, objInvestor.Phone, objInvestor.City, objInvestor.Country, objInvestor.Email, objInvestor.ZipCode, objInvestor.RegisterDay, objInvestor.InvestorComment, objInvestor.State, objInvestor.NickName, objInvestor.IDPassport).ToString()); } catch (Exception ex) { return -1; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <param name="objInvestor"></param> /// <returns></returns> internal int CreateNewInvestorProfile(Business.Investor objInvestor) { int Result = -1; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InvestorProfileTableAdapter adapInvestorProfile = new DSTableAdapters.InvestorProfileTableAdapter(); try { conn.Open(); adapInvestorProfile.Connection = conn; //if ((objInvestor.InvestorStatusID == -1) && (objInvestor.InvestorGroupInstance.InvestorGroupID == -1) && (string.IsNullOrEmpty(objInvestor.AgentID))) //{ // Result = int.Parse(adap.AddNewInvestor(null, null, objInvestor.Balance, objInvestor.Credit, objInvestor.Code, objInvestor.PrimaryPwd, objInvestor.ReadOnlyPwd, objInvestor.PhonePwd, // true, objInvestor.TaxRate, objInvestor.Leverage, objInvestor.AllowChangePwd, objInvestor.ReadOnly, objInvestor.SendReport, "0", 0).ToString()); //} //else //{ // int? resultFind = 0; // resultFind = adap.FindAgentWithAgentID(objInvestor.AgentID); // if (resultFind > 0) // { // Result = int.Parse(adap.AddNewInvestor(objInvestor.InvestorStatusID, objInvestor.InvestorGroupInstance.InvestorGroupID, objInvestor.Balance, // objInvestor.Credit, objInvestor.Code, objInvestor.PrimaryPwd, objInvestor.ReadOnlyPwd, objInvestor.PhonePwd, objInvestor.IsDisable, objInvestor.TaxRate, objInvestor.Leverage, // objInvestor.AllowChangePwd, objInvestor.ReadOnly, objInvestor.SendReport, objInvestor.AgentID, 0).ToString()); // } // else // { // Result = int.Parse(adap.AddNewInvestor(objInvestor.InvestorStatusID, objInvestor.InvestorGroupInstance.InvestorGroupID, objInvestor.Balance, // objInvestor.Credit, objInvestor.Code, objInvestor.PrimaryPwd, objInvestor.ReadOnlyPwd, objInvestor.PhonePwd, objInvestor.IsDisable, objInvestor.TaxRate, objInvestor.Leverage, // objInvestor.AllowChangePwd, objInvestor.ReadOnly, objInvestor.SendReport, "0", 0).ToString()); // } //} Result = int.Parse(adapInvestorProfile.AddNewInvestorProfile(objInvestor.InvestorID, objInvestor.Address, objInvestor.Phone, objInvestor.City, objInvestor.Country, objInvestor.Email, objInvestor.ZipCode, objInvestor.RegisterDay, objInvestor.InvestorComment, objInvestor.State, objInvestor.NickName, objInvestor.IDPassport).ToString()); } catch (Exception ex) { return Result; } finally { adapInvestorProfile.Connection.Close(); conn.Close(); } return Result; }