/// <summary> /// /// </summary> /// <returns></returns> internal List<Business.IVirtualDealer> GetAllVirtualDealer() { List<Business.IVirtualDealer> result = new List<Business.IVirtualDealer>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.IVirtualDealerTableAdapter adap = new DSTableAdapters.IVirtualDealerTableAdapter(); DS.IVirtualDealerDataTable tbIVirtualDealer = new DS.IVirtualDealerDataTable(); try { conn.Open(); adap.Connection = conn; result = this.MapIVirtualDealer(adap.GetData()); } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return result; }
private void InitializeComponent() { this.module1 = new DevExpress.ExpressApp.SystemModule.SystemModule(); this.module2 = new DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule(); this.module3 = new DashboardTester.Module.DashboardTesterModule(); this.module4 = new DashboardTester.Module.Web.DashboardTesterAspNetModule(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // sqlConnection1 // this.sqlConnection1.ConnectionString = @"Integrated Security=SSPI;Pooling=false;Data Source=.\SQLEXPRESS;Initial Catalog=DashboardTester"; this.sqlConnection1.FireInfoMessageEventOnUserErrors = false; // // DashboardTesterAspNetApplication // this.ApplicationName = "DashboardTester"; this.Connection = this.sqlConnection1; this.Modules.Add(this.module1); this.Modules.Add(this.module2); this.Modules.Add(this.module3); this.Modules.Add(this.module4); this.DatabaseVersionMismatch += new System.EventHandler<DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs>(this.DashboardTesterAspNetApplication_DatabaseVersionMismatch); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }
private void test_connection_btn_Click(object sender, EventArgs e) { var bldr = new System.Data.SqlClient.SqlConnectionStringBuilder(); bldr.DataSource = serverTextBox.Text; bldr.InitialCatalog = dbNameTextBox.Text; bldr.IntegratedSecurity = windows_auth_cb.Checked; if (sql_auth_cb.Checked) { bldr.UserID = username_tb.Text; bldr.Password = password_tb.Text; } bldr.ConnectTimeout = 5; var conn = new System.Data.SqlClient.SqlConnection(bldr.ConnectionString); var success = false; try { conn.Open(); var cmd = conn.CreateCommand(); cmd.CommandText = "select 1"; cmd.ExecuteScalar(); success = true; } catch (Exception ex) { MessageBox.Show("Test connection failed because of an error in initializing provider. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (success) { MessageBox.Show("Test connection succeeded.", "CutOptima", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void InitClass(int id, int groupID) { this.RoleID = id; this.GroupID = groupID; using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[Configuration.ConnectionStringName].ConnectionString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT * FROM Authorization_RoleToControlGroup WHERE RoleID=@role AND GroupID=@group", conn)) { try { conn.Open(); cmd.Parameters.AddWithValue("@role", id); cmd.Parameters.AddWithValue("@group", groupID); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) this.id = reader.GetInt32(0); } catch (Exception ex) { if (Configuration.s_log != null) Configuration.s_log.Error("[Ошибка модуля авторизации] [Инициализация класса роли группы элементов управления] ", ex); } } } }
public void Persist(IEnumerable<TradeRecord> trades) { using (var connection = new System.Data.SqlClient.SqlConnection("Data Source=(local);Initial Catalog=TradeDatabase;Integrated Security=True;")) { connection.Open(); using (var transaction = connection.BeginTransaction()) { foreach (var trade in trades) { var command = connection.CreateCommand(); command.Transaction = transaction; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "dbo.insert_trade"; command.Parameters.AddWithValue("@sourceCurrency", trade.SourceCurrency); command.Parameters.AddWithValue("@destinationCurrency", trade.DestinationCurrency); command.Parameters.AddWithValue("@lots", trade.Lots); command.Parameters.AddWithValue("@price", trade.Price); command.ExecuteNonQuery(); } transaction.Commit(); } connection.Close(); } logger.LogInfo("{0} trades processed", trades.Count()); }
public static string CreateDatabase(Models.Lodge model, string appDataMapPath) { string success = "no"; try { model.DatabaseName = model.LodgeName.Replace(" ", "").Replace(".", ""); using (var connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["MasonMaster"].ConnectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { // SQLEXPRESS //command.CommandText = String.Format("CREATE DATABASE {0} ON PRIMARY (NAME={0}, FILENAME='{1}')", model.DatabaseName, filename); //command.ExecuteNonQuery(); //command.CommandText = String.Format("EXEC sp_detach_db '{0}', 'true'", model.DatabaseName); //command.ExecuteNonQuery(); //CREATE DATABASE SampleLodge ON ( // NAME = SampleLodge, // FILENAME = 'C:\git\LodgeSecretary\LodgeSecretary\App_Data\SampleLodge.mdf') // LOG ON //( name = SampleLodge_Log, // FILENAME = 'C:\git\LodgeSecretary\LodgeSecretary\App_Data\SampleLodge_Log.ldf') // Full SQL Server command.CommandText = string.Format("use master CREATE DATABASE {0} ON (NAME = {0}, FILENAME = '{1}{0}.mdf') " + "LOG ON ( name = {0}_Log, FILENAME = '{1}{0}_Log.ldf')", model.DatabaseName, appDataMapPath); command.ExecuteNonQuery(); success = "ok"; } } } catch (Exception ex) { success = ex.Message; } return success; }
public Home() { this.WebConfig = System.Configuration.ConfigurationManager.AppSettings["Setting"]; this.Build = System.Configuration.ConfigurationManager.AppSettings["Build"]; this.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(4); bool executeDB = false; #if AZURE this.WebRoleConfig = Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue("Environment"); executeDB = Convert.ToBoolean(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue("executeDB")); #else executeDB = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["ExecuteDB"]); #endif string conn; #if AZURE conn = Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue("DBConn"); #else conn = System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ToString(); ; #endif if (executeDB) { var cn = new System.Data.SqlClient.SqlConnection(conn); cn.Open(); var cmd = new System.Data.SqlClient.SqlCommand("SELECT TOP 1 Col1 FROM Items", cn); this.DatabaseValue = cmd.ExecuteScalar().ToString(); cn.Close(); } }
/// <summary> /// /// </summary> /// <returns></returns> internal List<Business.LastBalance> GetData() { List<Business.LastBalance> result = new List<Business.LastBalance>(); DSTableAdapters.LastAccountTableAdapter adap = new DSTableAdapters.LastAccountTableAdapter(); DS.LastAccountDataTable tbLastBalance = new DS.LastAccountDataTable(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); try { conn.Open(); adap.Connection = conn; tbLastBalance = adap.GetData(); result = this.MapLastBalance(tbLastBalance); } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return result; }
public static string ChangePassword(string userName, string password, string newPassword) { string encryptedPassword = Encrypt(password); string encryptedNewPassword = Encrypt(newPassword); string success = "nogo"; try { using (var connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["MasonMaster"].ConnectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = string.Format("Update UserProfile set password = '******' where UserName='******' and Password='******'", userName, encryptedPassword, encryptedNewPassword); if (command.ExecuteNonQuery() == 1) success = "ok"; } } } catch (Exception ex) { success = ex.Message; } return success; }
public static Accomplishment xxGetMemberDetail(string memberDetailId, string connString) { var memberDetail = new Models.Accomplishment(); try { using (var connection = new System.Data.SqlClient.SqlConnection(connString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = string.Format("Select * from lodge.MemberDetail where MemberDetailId ='{0}'", memberDetailId); var reader = command.ExecuteReader(); if (reader.HasRows) { reader.Read(); { memberDetail.AccomplishmentId = memberDetailId; memberDetail.MasonId = (int)reader["MasonId"]; memberDetail.AccomplishmentType = reader["MemberDetailTypeRef"].ToString(); memberDetail.ShortTitle = reader["ShortTitle"].ToString(); memberDetail.Location = reader["Location"].ToString(); memberDetail.StartDate = reader["StartDate"].ToString(); memberDetail.EndDate = reader["EndDate"].ToString(); memberDetail.Comments = reader["Comments"].ToString(); } } } } } catch (Exception ex) { memberDetail.Comments = ex.Message; } return memberDetail; }
/// <summary> /// /// </summary> /// <param name="objInvestorLog"></param> /// <returns></returns> internal int AddNewInvestorLog(Business.InvestorLog objInvestorLog) { int Result = -1; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InvestorLogTableAdapter adap = new DSTableAdapters.InvestorLogTableAdapter(); try { conn.Open(); adap.Connection = conn; Result = int.Parse(adap.AddNewInvestorLog(objInvestorLog.InvestorInstance.InvestorID, objInvestorLog.Time, objInvestorLog.IP, objInvestorLog.Message, objInvestorLog.Status).ToString()); } catch (Exception ex) { return -1; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <param name="objInvestor"></param> /// <returns></returns> internal bool UpdateInvestorProfile(Business.Investor objInvestor) { bool Result = false; 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; int ResultUpdate = adap.UpdateInvestorProfile(objInvestor.InvestorID, objInvestor.Address, objInvestor.Phone, objInvestor.City, objInvestor.Country, objInvestor.Email, objInvestor.ZipCode, objInvestor.InvestorComment, objInvestor.State, objInvestor.NickName, objInvestor.IDPassport, objInvestor.InvestorProfileID); if (ResultUpdate > 0) Result = true; } catch (Exception ex) { return false; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <param name="AgentGroupID"></param> /// <returns></returns> internal Business.AgentGroup GetAgentGroupByAgentGroupID(int AgentGroupID) { Business.AgentGroup Result = new Business.AgentGroup(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.AgentGroupTableAdapter adap = new DSTableAdapters.AgentGroupTableAdapter(); DS.AgentGroupDataTable tbAgentGroup = new DS.AgentGroupDataTable(); try { conn.Open(); adap.Connection = conn; tbAgentGroup = adap.GetAgentGroupByAgentGroupID(AgentGroupID); if (tbAgentGroup != null) { Result.AgentGroupID = tbAgentGroup[0].AgentGroupID; Result.Name = tbAgentGroup[0].Name; Result.Comment = tbAgentGroup[0].Comment; } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
public static string[] GetGroupUsers(string intranetGroup) { List<string> result = new List<string>(); try { using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(@"SELECT employee.employee_name FROM groups INNER JOIN employee2group ON groups.group_id=employee2group.group_id INNER JOIN employee ON employee2group.employee_id=employee.employee_id WHERE group_name=@name ORDER BY employee.employee_name", conn)) { try { conn.Open(); cmd.Parameters.AddWithValue("@name",intranetGroup); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) result.Add(reader.GetString(0)); } catch (Exception ex) { } } } return result.ToArray(); } catch (Exception ex) { AuthLib.Core.Logging.WriteEntry("Ошибка получения списка пользователей в роли.",ex); throw new Exception("Ошибка получения списка пользователей в роли.", ex); } }
public static int GetUserId(System.Web.HttpContext HttpContext) { int result = 0; try { using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT employee_id FROM employee WHERE login LIKE @name", conn)) { try { conn.Open(); cmd.Parameters.AddWithValue("@name", HttpContext.User.Identity.Name.Remove(0,3)); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) result = reader.GetInt32(0); } catch (Exception ex) { } } } return result; } catch (Exception ex) { AuthLib.Core.Logging.WriteEntry("Ошибка при получении идентификатора пользователя", ex); throw new Exception("Ошибка при получении идентификатора пользователя", ex); } }
private System.Data.DataRow GetParameter(string IDParametro, int? IDPortal, int? IDSistema, string IDUsuario) { // Aca se lee la informacion de la base de datos // y se preparan los layers string connStr = ValidacionSeguridad.Instance.GetSecurityConnectionString(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connStr); conn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand ("SELECT * FROM dbo.SF_VALOR_PARAMETRO(@IDParametro, @IDPortal, @IDSistema, @IDUsuario)", conn); System.Data.SqlClient.SqlParameter prm = new System.Data.SqlClient.SqlParameter("@IDParametro", System.Data.SqlDbType.VarChar, 100); prm.Value = IDParametro; cmd.Parameters.Add(prm); prm = new System.Data.SqlClient.SqlParameter("@IDPortal", System.Data.SqlDbType.Int); if (IDPortal.HasValue) { prm.Value = IDPortal.Value; } else { prm.Value = null; } cmd.Parameters.Add(prm); prm = new System.Data.SqlClient.SqlParameter("@IDSistema", System.Data.SqlDbType.Int); if (IDSistema.HasValue) { prm.Value = IDSistema.Value; } else { prm.Value = null; } cmd.Parameters.Add(prm); prm = new System.Data.SqlClient.SqlParameter("@IDUsuario", System.Data.SqlDbType.VarChar); if (IDUsuario != null) { prm.Value = IDUsuario; } else { prm.Value = null; } cmd.Parameters.Add(prm); // IdParametro, Alcance, ValorTexto, ValorEntero, ValorDecimal, ValorLogico, ValorFechaHora cmd.CommandType = System.Data.CommandType.Text; System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); conn.Close(); return ds.Tables[0].Rows[0]; //return resultado; }
public static bool AddGroup(string intranetGroupName) { try { int groupID = 0; //Получаем идентификатор группы using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("INSERT INTO groups(group_id,group_name) VALUES((SELECT MIN(group_id)-1 FROM groups WHERE id>-1000), @name)", conn)) { try { conn.Open(); cmd.Parameters.AddWithValue("@name", intranetGroupName); cmd.ExecuteNonQuery(); } catch (Exception ex) { } } } return true; } catch (Exception ex) { Core.Logging.WriteEntry("Ошибка добавления группы.", ex, 1); return false; } }
public string Create(EventModel eventEntity) { try { using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring)) { sqlConnection.Open(); string sqlQuery = "INSERT INTO Event(_EventType_key,EventID,EventName,ProjectedDate,ActualDate,_Workgroup_key,CreatedBy,DateCreated,ModifiedBy,DateModified) VALUES (@_EventType_key,@EventID,@EventName,@ProjectedDate,@ActualDate,@_Workgroup_key,@CreatedBy,@DateCreated,@ModifiedBy,@DateModified)"; sqlConnection.Execute(sqlQuery, new { eventEntity._EventType_key, eventEntity.EventID, eventEntity.EventName, eventEntity.ProjectedDate, eventEntity.ActualDate, eventEntity._Workgroup_key, eventEntity.CreatedBy, eventEntity.DateCreated, eventEntity.ModifiedBy, eventEntity.DateModified }); sqlConnection.Close(); } return "Created"; } catch (Exception ex) { return ex.Message; } }
public static void ExecuteNonQuery(string strSQL) { System.Data.SqlClient.SqlConnectionStringBuilder csb = new System.Data.SqlClient.SqlConnectionStringBuilder(); csb.DataSource = System.Environment.MachineName; csb.InitialCatalog = "TestDB"; csb.IntegratedSecurity = true; string conString = csb.ConnectionString; using (System.Data.IDbConnection con = new System.Data.SqlClient.SqlConnection(conString)) { using (System.Data.IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = strSQL; if (cmd.Connection.State != System.Data.ConnectionState.Open) cmd.Connection.Open(); cmd.ExecuteNonQuery(); if (cmd.Connection.State != System.Data.ConnectionState.Closed) cmd.Connection.Close(); } // End Using cmd } // End Using con }
private void FillDataSet() { //1. Make a Connection System.Data.SqlClient.SqlConnection objCon; objCon = new System.Data.SqlClient.SqlConnection(); objCon.ConnectionString = @"Data Source=(localDB)\v11.0;Initial Catalog = EmployeeProjects; Integrated Security=True;"; objCon.Open(); //2. Issue a Command System.Data.SqlClient.SqlCommand objCmd; objCmd = new System.Data.SqlClient.SqlCommand(); objCmd.Connection = objCon; objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = @"pSelEmployeeProjectHours"; //3. Process the Results System.Data.DataSet objDS = new DataSet(); System.Data.SqlClient.SqlDataAdapter objDA; objDA = new System.Data.SqlClient.SqlDataAdapter(); objDA.SelectCommand = objCmd; objDA.Fill(objDS); // objCon.Open() is not needed! dataGridView1.DataSource = objDS.Tables[0]; //4. Clean up code objCon.Close(); dataGridView1.Refresh(); }
/// <summary> /// /// </summary> /// <param name="SymbolID"></param> /// <param name="CollectionValue"></param> /// <param name="Name"></param> /// <param name="Code"></param> /// <param name="BoolValue"></param> /// <param name="StringValue"></param> /// <param name="NumValue"></param> /// <param name="DateValue"></param> /// <returns></returns> internal int AddNewMarketArea(int MarketAreaID, int CollectionValue, string Name, string Code, int BoolValue, string StringValue, string NumValue, DateTime DateValue) { int Result = -1; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.MarketAreaConfigTableAdapter adap = new DSTableAdapters.MarketAreaConfigTableAdapter(); DS.MarketAreaConfigDataTable tbMarketAreaConfig = new DS.MarketAreaConfigDataTable(); try { conn.Open(); adap.Connection = conn; Result = int.Parse(adap.AddNewMarketAreaConfig(MarketAreaID, Code, CollectionValue, StringValue, NumValue, BoolValue, DateValue, Name).ToString()); } catch (Exception ex) { return -1; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
private void DoallThetracking(string trackkey, string value) { System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); conn.ConnectionString = "Server=devrystudentsp10.db.6077598.hostedresource.com;User Id=DeVryStudentSP10;Password=OidLZqBv4;"; conn.Open(); // Console.WriteLine(conn.State); System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(); comm.Connection = conn; string SQL = "insert into huber_tracker12 (usertrackerid, trackkey, value,trackwhen) values (NEWID(), @trackkey, @trackvalue, @trackwhen)"; comm.CommandText = SQL; comm.Parameters.AddWithValue("@trackkey", trackkey); comm.Parameters.AddWithValue("@trackvalue", value); comm.Parameters.AddWithValue("@trackwhen", DateTime.Now); comm.ExecuteNonQuery(); SQL = "delete from huber_tracker12 where usertrackerid not in (select top 300 usertrackerid from huber_tracker12 order by trackwhen desc)"; comm.CommandText = SQL; comm.ExecuteNonQuery(); conn.Close(); }
public string Create(Customer customerEntity) { try { using(System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring)) { sqlConnection.Open(); string sqlQuery = "INSERT INTO [dbo].[Customer]([FirstName],[LastName],[Address],[City]) VALUES (@FirstName, @LastName, @Address, @City)"; sqlConnection.Execute(sqlQuery, new { customerEntity.FirstName, customerEntity.LastName, customerEntity.Address, customerEntity.City, }); sqlConnection.Close(); } return "Created"; } catch (Exception ex) { return ex.Message; } }
public void InsertError(Exception err, int refId, bool sendMail) { string conn = System.Configuration.ConfigurationManager.ConnectionStrings["MainConnection"].ConnectionString; string queryString = "INSERT INTO [MLB].[dbo].[Error] ([RefId],[ErrorMethod],[ErrorText],[ErrorDate]) VALUES (@RefId,@ErrorMethod,@ErrorText,@ErrorDate)"; using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(conn)) { // Create the Command and Parameter objects. System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(queryString, connection); command.Parameters.AddWithValue("@RefId", refId); command.Parameters.AddWithValue("@ErrorMethod", err.Source); command.Parameters.AddWithValue("@ErrorText", err.InnerException); command.Parameters.AddWithValue("@ErrorDate", DateTime.Now); try { connection.Open(); command.ExecuteNonQuery(); } catch (Exception ex) { } } if (sendMail) { var email = EmailMessageFactory.GetErrorEmail(err); var result = EmailClient.SendEmail(email); } }
public static void Main(string[] args) { try { using (var connection = new System.Data.SqlClient.SqlConnection(ConnectionString)) { connection.Open(); var sql = "select * FROM People"; var people = connection.Query<People>(sql); foreach (var person in people) { Console.WriteLine(JsonConvert.SerializeObject(person)); } } } catch (Exception ex) { Console.WriteLine(ex.Message + ex.StackTrace); } Console.ReadLine(); }
private void CbBackups_DropDown_1(object sender, EventArgs e) { using (var connection = new System.Data.SqlClient.SqlConnection(string.Format("Server={0};Database={1};Trusted_Connection=True;", TxtLocalBkp.Text, TxtDataBase.Text))) { connection.Open(); using (var command = new System.Data.SqlClient.SqlCommand( "SELECT physical_device_name FROM msdb.dbo.backupmediafamily " + "INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id " + "WHERE (msdb.dbo.backupset.database_name LIKE @DatabaseName)", connection)) { command.Parameters.AddWithValue("DatabaseName", TxtDataBase.Text); using (var reader = command.ExecuteReader()) { var table = new DataTable(); table.Load(reader); table.Columns.Add("FriendlyName"); foreach (DataRow row in table.Rows) { row["FriendlyName"] = System.IO.Path.GetFileName(row["physical_device_name"].ToString()); } if (CbBackups.DataSource != null && CbBackups.DataSource is DataTable) { var oldTable = ((DataTable)CbBackups.DataSource); CbBackups.DataSource = null; oldTable.Dispose(); } CbBackups.DataSource = table; CbBackups.DisplayMember = "FriendlyName"; CbBackups.ValueMember = "physical_device_name"; } } } }
/// <summary> /// /// </summary> /// <param name="values"></param> /// <returns></returns> internal int AddStatement(List<Business.Statement> values) { int result = -1; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.StatementTableAdapter adap = new DSTableAdapters.StatementTableAdapter(); try { if (values != null && values.Count > 0) { conn.Open(); adap.Connection = conn; int count = values.Count; for (int i = 0; i < count; i++) { result = int.Parse(adap.AddNewStatement(values[i].InvestorCode, values[i].Content, values[i].TimeStatement, values[i].Email, values[i].StatementType).ToString()); } } } catch (Exception ex) { return -1; } finally { adap.Connection.Close(); conn.Close(); } return result; }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { String sqlstring; // sqlstring = "insert into sys_user values ((select max(sysuser_id)+1 from sys_user),'" + // CreateUserWizard1.UserName + "','" + CreateUserWizard1.Password + "','1', GETDATE(), 3);"; //SQL 2005 version sqlstring = "insert into sys_user select max(sysuser_id)+1, '" + CreateUserWizard1.UserName + "','" + CreateUserWizard1.Password + "', GETDATE(), (Select top 1 sysrole_id from sys_role where sysrole_name='Applicant') from sys_user "; // create a connection with sqldatabase //System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection( // " Data Source=SD;Initial Catalog=SRS;User ID=sa;Password=Ab123456;Connect Timeout=10;TrustServerCertificate=True "); System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection( WebConfigurationManager.ConnectionStrings["SRSDB"].ConnectionString); // create a sql command which will user connection string and your select statement string System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(sqlstring, con); // create a sqldatabase reader which will execute the above command to get the values from sqldatabase try { con.Open(); if (comm.ExecuteNonQuery() > 0) { } } finally { con.Close(); } }
public static int ExecuteNonQuery(string strSQL) { int retVal = 0; try { using (System.Data.Common.DbConnection con = new System.Data.SqlClient.SqlConnection(GetConnectionString())) { using (System.Data.Common.DbCommand cmd = con.CreateCommand()) { cmd.CommandText = strSQL; if (cmd.Connection.State != System.Data.ConnectionState.Open) cmd.Connection.Open(); retVal = cmd.ExecuteNonQuery(); if (cmd.Connection.State != System.Data.ConnectionState.Closed) cmd.Connection.Close(); } // End Using cmd } } catch (System.Exception ex) { // System.Console.WriteLine(ex.Message); retVal = -1; } return retVal; }
public static void ProcessResponse(List<Response> locationsResponse) { bool writeToFiles = Convert.ToBoolean(ConfigurationManager.AppSettings["writeToFiles"]); StringBuilder sb = new StringBuilder(); sb.AppendLine(Headers); for (int i = 0; i < locationsResponse.Count; i++) { if (writeToFiles) { sb.AppendFormat(HeaderFormat, "\"" + locationsResponse[i].postal_code.ToString() + "\"", "\"" + locationsResponse[i].timestamp.ToString().Replace("T00:00:00-05:00", "") + "\"", locationsResponse[i].tempMin.ToString(), locationsResponse[i].tempAvg.ToString(), locationsResponse[i].tempMax.ToString(), locationsResponse[i].cldCvrAvg.ToString(), locationsResponse[i].snowfall.ToString(), locationsResponse[i].precip.ToString()); sb.AppendLine(); string FileName = Folder + "\\" + PostalCode + "_" + CurrentTimeWindow.Replace("T00:00:00+00:00", "").Replace(".", "_").Replace(",", "_") + "_" + DateTime.Now.ToShortDateString().Replace("/", "") + ".csv"; System.IO.File.WriteAllText(FileName, sb.ToString()); } else { using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["ConnectionString"])) { con.Open(); string insert = "INSERT INTO WeatherResults ([timestamp],[postal_code],[tempMin],[tempAvg],[tempMax],[cldCvrAvg],[snowfall],[precip],[LastUpdated]) VALUES(@timestamp,@postal_code,@tempMin,@tempAvg,@tempMax,@cldCvrAvg,@snowfall,@precip,@LastUpdated)"; con.Execute(insert, new { timestamp = locationsResponse[i].timestamp.ToString().Replace("T00:00:00-05:00", ""), postal_code = locationsResponse[i].postal_code, tempMin = locationsResponse[i].tempMin, tempAvg = locationsResponse[i].tempAvg, tempMax = locationsResponse[i].tempMax, cldCvrAvg = locationsResponse[i].cldCvrAvg, snowfall = locationsResponse[i].snowfall, precip = locationsResponse[i].precip, LastUpdated = DateTime.Now.ToShortDateString()}); //string update = "UPDATE us_postal_codes SET Done = 1 WHERE [Postal Code] = @postalcode"; //con.Execute(update, new { postalcode = locationsResponse[i].postal_code }); } } } }
/// <summary> /// Configures the SqlDataAdapter. /// </summary> /// <param name="tableName">Table name to be use in the DataSet.</param> public void Configure(string tableName) { this.hasBeenConfigured = true; this.sqlDataAdapter = null; System.Data.SqlClient.SqlCommand sqlSelectCommand; System.Data.SqlClient.SqlCommand sqlInsertCommand; System.Data.SqlClient.SqlCommand sqlUpdateCommand; System.Data.SqlClient.SqlCommand sqlDeleteCommand; System.Data.SqlClient.SqlParameter sqlParameter; sqlSelectCommand = new System.Data.SqlClient.SqlCommand(); sqlInsertCommand = new System.Data.SqlClient.SqlCommand(); sqlUpdateCommand = new System.Data.SqlClient.SqlCommand(); sqlDeleteCommand = new System.Data.SqlClient.SqlCommand(); System.Data.SqlClient.SqlConnection localSqlConnection = null; switch (this.lastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: string connectionString = this.ConnectionString; if (connectionString.Length == 0) { connectionString = OlymarsDemo.DataClasses.Information.GetConnectionStringFromConfigurationFile; if (connectionString.Length == 0) { connectionString = OlymarsDemo.DataClasses.Information.GetConnectionStringFromRegistry; } } if (connectionString.Length == 0) { throw new System.InvalidOperationException("No connection information was supplied (ConnectionString == \"\")! (OlymarsDemo.SqlDataAdapters.SqlDataAdapter_tblSupplier)"); } localSqlConnection = new System.Data.SqlClient.SqlConnection(connectionString); sqlSelectCommand.Connection = localSqlConnection; sqlInsertCommand.Connection = localSqlConnection; sqlUpdateCommand.Connection = localSqlConnection; sqlDeleteCommand.Connection = localSqlConnection; break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: localSqlConnection = this.SqlConnection; sqlSelectCommand.Connection = localSqlConnection; sqlInsertCommand.Connection = localSqlConnection; sqlUpdateCommand.Connection = localSqlConnection; sqlDeleteCommand.Connection = localSqlConnection; break; case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction: sqlSelectCommand.Connection = this.sqlTransaction.Connection; sqlSelectCommand.Transaction = this.sqlTransaction; sqlInsertCommand.Connection = this.sqlTransaction.Connection; sqlInsertCommand.Transaction = this.sqlTransaction; sqlUpdateCommand.Connection = this.sqlTransaction.Connection; sqlUpdateCommand.Transaction = this.sqlTransaction; sqlDeleteCommand.Connection = this.sqlTransaction.Connection; sqlDeleteCommand.Transaction = this.sqlTransaction; break; } sqlSelectCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlSelectCommand.CommandText = "spS_tblSupplier"; sqlParameter = new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4); sqlParameter.Direction = System.Data.ParameterDirection.ReturnValue; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlSelectCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_GuidID", System.Data.SqlDbType.UniqueIdentifier, 16); sqlParameter.SourceColumn = "Sup_GuidID"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlSelectCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@ReturnXML", System.Data.SqlDbType.Bit, 1); sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.Value = false; sqlSelectCommand.Parameters.Add(sqlParameter); sqlInsertCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlInsertCommand.CommandText = "spI_tblSupplier"; sqlParameter = new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4); sqlParameter.Direction = System.Data.ParameterDirection.ReturnValue; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlInsertCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_GuidID", System.Data.SqlDbType.UniqueIdentifier, 16); sqlParameter.SourceColumn = "Sup_GuidID"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlInsertCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_StrName", System.Data.SqlDbType.VarChar, 255); sqlParameter.SourceColumn = "Sup_StrName"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlInsertCommand.Parameters.Add(sqlParameter); sqlUpdateCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlUpdateCommand.CommandText = "spU_tblSupplier"; sqlParameter = new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4); sqlParameter.Direction = System.Data.ParameterDirection.ReturnValue; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlUpdateCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_GuidID", System.Data.SqlDbType.UniqueIdentifier, 16); sqlParameter.SourceColumn = "Sup_GuidID"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlUpdateCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_StrName", System.Data.SqlDbType.VarChar, 255); sqlParameter.SourceColumn = "Sup_StrName"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlUpdateCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@ConsiderNull_Sup_StrName", System.Data.SqlDbType.Bit, 1); sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.Value = true; sqlUpdateCommand.Parameters.Add(sqlParameter); sqlDeleteCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlDeleteCommand.CommandText = "spD_tblSupplier"; sqlParameter = new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4); sqlParameter.Direction = System.Data.ParameterDirection.ReturnValue; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlDeleteCommand.Parameters.Add(sqlParameter); sqlParameter = new System.Data.SqlClient.SqlParameter("@Sup_GuidID", System.Data.SqlDbType.UniqueIdentifier, 16); sqlParameter.SourceColumn = "Sup_GuidID"; sqlParameter.Direction = System.Data.ParameterDirection.Input; sqlParameter.IsNullable = true; sqlParameter.Value = System.DBNull.Value; sqlDeleteCommand.Parameters.Add(sqlParameter); // Let's create the SqlDataAdapter this.sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDataAdapter.SelectCommand = sqlSelectCommand; this.sqlDataAdapter.InsertCommand = sqlInsertCommand; this.sqlDataAdapter.UpdateCommand = sqlUpdateCommand; this.sqlDataAdapter.DeleteCommand = sqlDeleteCommand; this.sqlDataAdapter.TableMappings.AddRange( new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping( "tblSupplier" , tableName , new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("Sup_GuidID", "Sup_GuidID") , new System.Data.Common.DataColumnMapping("Sup_StrName", "Sup_StrName") } ) } ); }
public void Load_MultiTables() { var dt = SSDTHelper.ExcelReader.Read(Util.GetLocalFileFullPath("TestData.xlsx"), new string[] { "People", "Salary" }); var loader = new SSDTHelper.DataLoader(); loader.ConnectionString = Config.ConnectionString; loader.Load(dt); using (var cn = new System.Data.SqlClient.SqlConnection(Config.ConnectionString)) { cn.Open(); var result = cn.Query(@"SELECT * FROM People ORDER BY ID").ToList(); if (result.Count != 3) { Assert.True(false, $"3行あるはずが{result.Count}行しかない"); return; } if (result[0].Id != 1 || result[0].Name != "Hoge" || result[0].Age != 20) { Assert.True(false, $"1行目のデータが何か違う"); return; } if (result[1].Id != 2 || result[1].Name != "Fuga" || result[1].Age != 99) { Assert.True(false, $"2行目のデータが何か違う"); return; } if (result[2].Id != 3 || result[2].Name != "FugaFuga" || result[2].Age != 0) { Assert.True(false, $"3行目のデータが何か違う"); return; } var result2 = cn.Query(@"SELECT * FROM Salary ORDER BY ID").ToList(); if (result2.Count != 3) { Assert.True(false, $"3行あるはずが{result2.Count}行しかない"); return; } if (result2[0].Id != 1 || result2[0].Salary != 3000) { Assert.True(false, $"1行目のデータが何か違う"); return; } if (result2[1].Id != 2 || result2[1].Salary != 5000) { Assert.True(false, $"2行目のデータが何か違う"); return; } if (result2[2].Id != 3 || result2[2].Salary != 4000) { Assert.True(false, $"3行目のデータが何か違う"); return; } Assert.True(true); } }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the LibraryManagement.Domain.Stations object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <LibraryManagement.Domain.Stations> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "tblStations"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("id", typeof(System.Int32)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("name", typeof(System.String)); col1.AllowDBNull = true; DataColumn col2 = dataTable.Columns.Add("Description", typeof(System.String)); col2.AllowDBNull = true; DataColumn col3 = dataTable.Columns.Add("login", typeof(System.Int32)); col3.AllowDBNull = true; DataColumn col4 = dataTable.Columns.Add("user_id", typeof(System.Int32)); col4.AllowDBNull = true; DataColumn col5 = dataTable.Columns.Add("pos_id", typeof(System.String)); col5.AllowDBNull = true; DataColumn col6 = dataTable.Columns.Add("prnport", typeof(System.Int32)); col6.AllowDBNull = true; DataColumn col7 = dataTable.Columns.Add("ipaddress", typeof(System.String)); col7.AllowDBNull = true; DataColumn col8 = dataTable.Columns.Add("message", typeof(System.Boolean)); col8.AllowDBNull = true; DataColumn col9 = dataTable.Columns.Add("serialkey", typeof(System.String)); col9.AllowDBNull = true; DataColumn col10 = dataTable.Columns.Add("Status", typeof(System.Boolean)); col10.AllowDBNull = false; bulkCopy.ColumnMappings.Add("id", "id"); bulkCopy.ColumnMappings.Add("name", "name"); bulkCopy.ColumnMappings.Add("Description", "Description"); bulkCopy.ColumnMappings.Add("login", "login"); bulkCopy.ColumnMappings.Add("user_id", "user_id"); bulkCopy.ColumnMappings.Add("pos_id", "pos_id"); bulkCopy.ColumnMappings.Add("prnport", "prnport"); bulkCopy.ColumnMappings.Add("ipaddress", "ipaddress"); bulkCopy.ColumnMappings.Add("message", "message"); bulkCopy.ColumnMappings.Add("serialkey", "serialkey"); bulkCopy.ColumnMappings.Add("Status", "Status"); foreach (LibraryManagement.Domain.Stations entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["id"] = entity.Id; row["name"] = entity.Name; row["Description"] = entity.Description; row["login"] = entity.Login.HasValue ? (object)entity.Login : System.DBNull.Value; row["user_id"] = entity.UserId.HasValue ? (object)entity.UserId : System.DBNull.Value; row["pos_id"] = entity.PosId; row["prnport"] = entity.Prnport.HasValue ? (object)entity.Prnport : System.DBNull.Value; row["ipaddress"] = entity.Ipaddress; row["message"] = entity.Message.HasValue ? (object)entity.Message : System.DBNull.Value; row["serialkey"] = entity.Serialkey; row["Status"] = entity.Status; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (LibraryManagement.Domain.Stations entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
/// <summary> /// Método necesario para admitir el Diseñador. No se puede modificar /// el contenido del método con el editor de código. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Ensaye)); System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader(); this.panel1 = new System.Windows.Forms.Panel(); this.buscaBtn1 = new Soluciones2000.Tools.WinLib.BuscaBtn(); this.dsEnsaye1 = new LancNeo.dsEnsaye(); this.txtIdEnsaye = new System.Windows.Forms.TextBox(); this.lblIdEnsaye = new System.Windows.Forms.Label(); this.lblEnsaye = new System.Windows.Forms.Label(); this.txtEnsaye = new System.Windows.Forms.TextBox(); this.sqlDAEnsaye = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConn = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.panelToolBar.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dsEnsaye1)).BeginInit(); this.SuspendLayout(); // // statusBar1 // this.statusBar1.ShowPanels = true; this.statusBar1.Size = new System.Drawing.Size(576, 22); // // panelToolBar // this.panelToolBar.Size = new System.Drawing.Size(576, 64); // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.Controls.Add(this.buscaBtn1); this.panel1.Controls.Add(this.txtIdEnsaye); this.panel1.Controls.Add(this.lblIdEnsaye); this.panel1.Controls.Add(this.lblEnsaye); this.panel1.Controls.Add(this.txtEnsaye); this.panel1.Location = new System.Drawing.Point(88, 109); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(400, 205); this.panel1.TabIndex = 3; // // buscaBtn1 // this.buscaBtn1.AnchoDlgBusq = 0; this.buscaBtn1.BackColor = System.Drawing.Color.Transparent; this.buscaBtn1.Datos = this.dsEnsaye1.Ensaye; this.buscaBtn1.Icon = ((System.Drawing.Icon)(resources.GetObject("buscaBtn1.Icon"))); this.buscaBtn1.Location = new System.Drawing.Point(296, 40); this.buscaBtn1.Name = "buscaBtn1"; this.buscaBtn1.Size = new System.Drawing.Size(64, 64); this.buscaBtn1.TabIndex = 2; this.toolTip1.SetToolTip(this.buscaBtn1, "Buscar"); // // dsEnsaye1 // this.dsEnsaye1.DataSetName = "dsEnsaye"; this.dsEnsaye1.Locale = new System.Globalization.CultureInfo("es-MX"); this.dsEnsaye1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // txtIdEnsaye // this.txtIdEnsaye.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsEnsaye1, "Ensaye.IdEnsaye", true)); this.txtIdEnsaye.Location = new System.Drawing.Point(192, 75); this.txtIdEnsaye.Name = "txtIdEnsaye"; this.txtIdEnsaye.Size = new System.Drawing.Size(100, 20); this.txtIdEnsaye.TabIndex = 1; this.txtIdEnsaye.Text = "textBox1"; // // lblIdEnsaye // this.lblIdEnsaye.Location = new System.Drawing.Point(80, 75); this.lblIdEnsaye.Name = "lblIdEnsaye"; this.lblIdEnsaye.Size = new System.Drawing.Size(100, 23); this.lblIdEnsaye.TabIndex = 0; this.lblIdEnsaye.Text = "Id Ensaye:"; this.lblIdEnsaye.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // lblEnsaye // this.lblEnsaye.Location = new System.Drawing.Point(80, 107); this.lblEnsaye.Name = "lblEnsaye"; this.lblEnsaye.Size = new System.Drawing.Size(100, 23); this.lblEnsaye.TabIndex = 0; this.lblEnsaye.Text = "Ensaye:"; this.lblEnsaye.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // txtEnsaye // this.txtEnsaye.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsEnsaye1, "Ensaye.Ensaye", true)); this.txtEnsaye.Location = new System.Drawing.Point(192, 107); this.txtEnsaye.Name = "txtEnsaye"; this.txtEnsaye.Size = new System.Drawing.Size(100, 20); this.txtEnsaye.TabIndex = 1; this.txtEnsaye.Text = "textBox1"; // // sqlDAEnsaye // this.sqlDAEnsaye.DeleteCommand = this.sqlDeleteCommand1; this.sqlDAEnsaye.InsertCommand = this.sqlInsertCommand1; this.sqlDAEnsaye.SelectCommand = this.sqlSelectCommand1; this.sqlDAEnsaye.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Ensaye", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("IdEnsaye", "IdEnsaye"), new System.Data.Common.DataColumnMapping("Ensaye", "Ensaye") }) }); this.sqlDAEnsaye.UpdateCommand = this.sqlUpdateCommand1; // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = "DELETE FROM Ensaye WHERE (IdEnsaye = @Original_IdEnsaye) AND (Ensaye = @Original_" + "Ensaye OR @Original_Ensaye IS NULL AND Ensaye IS NULL)"; this.sqlDeleteCommand1.Connection = this.sqlConn; this.sqlDeleteCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Original_IdEnsaye", System.Data.SqlDbType.NVarChar, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "IdEnsaye", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Ensaye", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Ensaye", System.Data.DataRowVersion.Original, null) }); // // sqlConn // this.sqlConn.ConnectionString = ((string)(configurationAppSettings.GetValue("sqlConn.ConnectionString", typeof(string)))); this.sqlConn.FireInfoMessageEventOnUserErrors = false; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = "INSERT INTO Ensaye(IdEnsaye, Ensaye) VALUES (@IdEnsaye, @Ensaye); SELECT IdEnsaye" + ", Ensaye FROM Ensaye WHERE (IdEnsaye = @IdEnsaye)"; this.sqlInsertCommand1.Connection = this.sqlConn; this.sqlInsertCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@IdEnsaye", System.Data.SqlDbType.NVarChar, 2, "IdEnsaye"), new System.Data.SqlClient.SqlParameter("@Ensaye", System.Data.SqlDbType.NVarChar, 50, "Ensaye") }); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT IdEnsaye, Ensaye FROM Ensaye"; this.sqlSelectCommand1.Connection = this.sqlConn; // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = resources.GetString("sqlUpdateCommand1.CommandText"); this.sqlUpdateCommand1.Connection = this.sqlConn; this.sqlUpdateCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@IdEnsaye", System.Data.SqlDbType.NVarChar, 2, "IdEnsaye"), new System.Data.SqlClient.SqlParameter("@Ensaye", System.Data.SqlDbType.NVarChar, 50, "Ensaye"), new System.Data.SqlClient.SqlParameter("@Original_IdEnsaye", System.Data.SqlDbType.NVarChar, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "IdEnsaye", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Ensaye", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Ensaye", System.Data.DataRowVersion.Original, null) }); // // Ensaye // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(576, 423); this.Controls.Add(this.panel1); this.DAGeneral = this.sqlDAEnsaye; this.dsGeneral = this.dsEnsaye1; this.Name = "Ensaye"; this.NombreTabla = "Ensaye"; this.Text = "Ensaye"; this.Load += new System.EventHandler(this.Ensaye_Load); this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.statusBar1, 0); this.Controls.SetChildIndex(this.panelToolBar, 0); this.panelToolBar.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dsEnsaye1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.northwindDataSet1 = new CustomSectionInGroup.DataSet1(); this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection2 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlDataAdapterOrders = new System.Data.SqlClient.SqlDataAdapter(); this.panel1 = new System.Windows.Forms.Panel(); this.gridGroupingControl1 = new Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl(); ((System.ComponentModel.ISupportInitialize)(this.northwindDataSet1)).BeginInit(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridGroupingControl1)).BeginInit(); this.SuspendLayout(); // // northwindDataSet1 // this.northwindDataSet1.DataSetName = "DataSet1"; this.northwindDataSet1.Locale = new System.Globalization.CultureInfo("en-US"); this.northwindDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // sqlSelectCommand2 // this.sqlSelectCommand2.CommandText = "SELECT OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, Shi" + "pVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, Ship" + "Country FROM Orders"; this.sqlSelectCommand2.Connection = this.sqlConnection2; // // sqlConnection2 // this.sqlConnection2.ConnectionString = "Network Address=66.135.59.108,49489;initial catalog=NORTHWIND;password=Sync_sampl" + "es;persist security info=True;user id=sa;packet size=4096;Pooling=true"; this.sqlConnection2.FireInfoMessageEventOnUserErrors = false; // // sqlInsertCommand2 // this.sqlInsertCommand2.CommandText = resources.GetString("sqlInsertCommand2.CommandText"); this.sqlInsertCommand2.Connection = this.sqlConnection2; this.sqlInsertCommand2.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@CustomerID", System.Data.SqlDbType.NVarChar, 5, "CustomerID"), new System.Data.SqlClient.SqlParameter("@EmployeeID", System.Data.SqlDbType.Int, 4, "EmployeeID"), new System.Data.SqlClient.SqlParameter("@OrderDate", System.Data.SqlDbType.DateTime, 8, "OrderDate"), new System.Data.SqlClient.SqlParameter("@RequiredDate", System.Data.SqlDbType.DateTime, 8, "RequiredDate"), new System.Data.SqlClient.SqlParameter("@ShippedDate", System.Data.SqlDbType.DateTime, 8, "ShippedDate"), new System.Data.SqlClient.SqlParameter("@ShipVia", System.Data.SqlDbType.Int, 4, "ShipVia"), new System.Data.SqlClient.SqlParameter("@Freight", System.Data.SqlDbType.Money, 8, "Freight"), new System.Data.SqlClient.SqlParameter("@ShipName", System.Data.SqlDbType.NVarChar, 40, "ShipName"), new System.Data.SqlClient.SqlParameter("@ShipAddress", System.Data.SqlDbType.NVarChar, 60, "ShipAddress"), new System.Data.SqlClient.SqlParameter("@ShipCity", System.Data.SqlDbType.NVarChar, 15, "ShipCity"), new System.Data.SqlClient.SqlParameter("@ShipRegion", System.Data.SqlDbType.NVarChar, 15, "ShipRegion"), new System.Data.SqlClient.SqlParameter("@ShipPostalCode", System.Data.SqlDbType.NVarChar, 10, "ShipPostalCode"), new System.Data.SqlClient.SqlParameter("@ShipCountry", System.Data.SqlDbType.NVarChar, 15, "ShipCountry") }); // // sqlUpdateCommand2 // this.sqlUpdateCommand2.CommandText = resources.GetString("sqlUpdateCommand2.CommandText"); this.sqlUpdateCommand2.Connection = this.sqlConnection2; this.sqlUpdateCommand2.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@CustomerID", System.Data.SqlDbType.NVarChar, 5, "CustomerID"), new System.Data.SqlClient.SqlParameter("@EmployeeID", System.Data.SqlDbType.Int, 4, "EmployeeID"), new System.Data.SqlClient.SqlParameter("@OrderDate", System.Data.SqlDbType.DateTime, 8, "OrderDate"), new System.Data.SqlClient.SqlParameter("@RequiredDate", System.Data.SqlDbType.DateTime, 8, "RequiredDate"), new System.Data.SqlClient.SqlParameter("@ShippedDate", System.Data.SqlDbType.DateTime, 8, "ShippedDate"), new System.Data.SqlClient.SqlParameter("@ShipVia", System.Data.SqlDbType.Int, 4, "ShipVia"), new System.Data.SqlClient.SqlParameter("@Freight", System.Data.SqlDbType.Money, 8, "Freight"), new System.Data.SqlClient.SqlParameter("@ShipName", System.Data.SqlDbType.NVarChar, 40, "ShipName"), new System.Data.SqlClient.SqlParameter("@ShipAddress", System.Data.SqlDbType.NVarChar, 60, "ShipAddress"), new System.Data.SqlClient.SqlParameter("@ShipCity", System.Data.SqlDbType.NVarChar, 15, "ShipCity"), new System.Data.SqlClient.SqlParameter("@ShipRegion", System.Data.SqlDbType.NVarChar, 15, "ShipRegion"), new System.Data.SqlClient.SqlParameter("@ShipPostalCode", System.Data.SqlDbType.NVarChar, 10, "ShipPostalCode"), new System.Data.SqlClient.SqlParameter("@ShipCountry", System.Data.SqlDbType.NVarChar, 15, "ShipCountry"), new System.Data.SqlClient.SqlParameter("@Original_OrderID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "OrderID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_CustomerID", System.Data.SqlDbType.NVarChar, 5, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CustomerID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_EmployeeID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "EmployeeID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Freight", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Freight", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_OrderDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "OrderDate", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_RequiredDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "RequiredDate", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipAddress", System.Data.SqlDbType.NVarChar, 60, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipAddress", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipCity", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipCity", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipCountry", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipCountry", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipName", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipPostalCode", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipPostalCode", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipRegion", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipRegion", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipVia", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipVia", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShippedDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShippedDate", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@OrderID", System.Data.SqlDbType.Int, 4, "OrderID") }); // // sqlDeleteCommand2 // this.sqlDeleteCommand2.CommandText = resources.GetString("sqlDeleteCommand2.CommandText"); this.sqlDeleteCommand2.Connection = this.sqlConnection2; this.sqlDeleteCommand2.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Original_OrderID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "OrderID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_CustomerID", System.Data.SqlDbType.NVarChar, 5, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CustomerID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_EmployeeID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "EmployeeID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Freight", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Freight", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_OrderDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "OrderDate", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_RequiredDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "RequiredDate", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipAddress", System.Data.SqlDbType.NVarChar, 60, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipAddress", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipCity", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipCity", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipCountry", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipCountry", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipName", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipPostalCode", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipPostalCode", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipRegion", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipRegion", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShipVia", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShipVia", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ShippedDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ShippedDate", System.Data.DataRowVersion.Original, null) }); // // sqlDataAdapterOrders // this.sqlDataAdapterOrders.DeleteCommand = this.sqlDeleteCommand2; this.sqlDataAdapterOrders.InsertCommand = this.sqlInsertCommand2; this.sqlDataAdapterOrders.SelectCommand = this.sqlSelectCommand2; this.sqlDataAdapterOrders.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Orders", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("OrderID", "OrderID"), new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), new System.Data.Common.DataColumnMapping("OrderDate", "OrderDate"), new System.Data.Common.DataColumnMapping("RequiredDate", "RequiredDate"), new System.Data.Common.DataColumnMapping("ShippedDate", "ShippedDate"), new System.Data.Common.DataColumnMapping("ShipVia", "ShipVia"), new System.Data.Common.DataColumnMapping("Freight", "Freight"), new System.Data.Common.DataColumnMapping("ShipName", "ShipName"), new System.Data.Common.DataColumnMapping("ShipAddress", "ShipAddress"), new System.Data.Common.DataColumnMapping("ShipCity", "ShipCity"), new System.Data.Common.DataColumnMapping("ShipRegion", "ShipRegion"), new System.Data.Common.DataColumnMapping("ShipPostalCode", "ShipPostalCode"), new System.Data.Common.DataColumnMapping("ShipCountry", "ShipCountry") }) }); this.sqlDataAdapterOrders.UpdateCommand = this.sqlUpdateCommand2; // // panel1 // this.panel1.Controls.Add(this.gridGroupingControl1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1012, 656); this.panel1.TabIndex = 0; // // gridGroupingControl1 // this.gridGroupingControl1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(231)))), ((int)(((byte)(162)))))); this.gridGroupingControl1.BackColor = System.Drawing.SystemColors.Window; this.gridGroupingControl1.DataSource = this.northwindDataSet1.Orders; this.gridGroupingControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.gridGroupingControl1.FreezeCaption = false; this.gridGroupingControl1.Location = new System.Drawing.Point(0, 0); this.gridGroupingControl1.Name = "gridGroupingControl1"; this.gridGroupingControl1.ShowGroupDropArea = true; this.gridGroupingControl1.Size = new System.Drawing.Size(1012, 656); this.gridGroupingControl1.TabIndex = 1; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1012, 656); this.MinimumSize = new System.Drawing.Size(650, 500); this.Controls.Add(this.panel1); this.Name = "Form1"; this.Text = "Group Customization"; ((System.ComponentModel.ISupportInitialize)(this.northwindDataSet1)).EndInit(); this.panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridGroupingControl1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Order object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <PetShop.Business.Order> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "Orders"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("OrderId", typeof(int)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("UserId", typeof(string)); col1.AllowDBNull = false; DataColumn col2 = dataTable.Columns.Add("OrderDate", typeof(System.DateTime)); col2.AllowDBNull = false; DataColumn col3 = dataTable.Columns.Add("ShipAddr1", typeof(string)); col3.AllowDBNull = false; DataColumn col4 = dataTable.Columns.Add("ShipAddr2", typeof(string)); col4.AllowDBNull = true; DataColumn col5 = dataTable.Columns.Add("ShipCity", typeof(string)); col5.AllowDBNull = false; DataColumn col6 = dataTable.Columns.Add("ShipState", typeof(string)); col6.AllowDBNull = false; DataColumn col7 = dataTable.Columns.Add("ShipZip", typeof(string)); col7.AllowDBNull = false; DataColumn col8 = dataTable.Columns.Add("ShipCountry", typeof(string)); col8.AllowDBNull = false; DataColumn col9 = dataTable.Columns.Add("BillAddr1", typeof(string)); col9.AllowDBNull = false; DataColumn col10 = dataTable.Columns.Add("BillAddr2", typeof(string)); col10.AllowDBNull = true; DataColumn col11 = dataTable.Columns.Add("BillCity", typeof(string)); col11.AllowDBNull = false; DataColumn col12 = dataTable.Columns.Add("BillState", typeof(string)); col12.AllowDBNull = false; DataColumn col13 = dataTable.Columns.Add("BillZip", typeof(string)); col13.AllowDBNull = false; DataColumn col14 = dataTable.Columns.Add("BillCountry", typeof(string)); col14.AllowDBNull = false; DataColumn col15 = dataTable.Columns.Add("Courier", typeof(string)); col15.AllowDBNull = false; DataColumn col16 = dataTable.Columns.Add("TotalPrice", typeof(decimal)); col16.AllowDBNull = false; DataColumn col17 = dataTable.Columns.Add("BillToFirstName", typeof(string)); col17.AllowDBNull = false; DataColumn col18 = dataTable.Columns.Add("BillToLastName", typeof(string)); col18.AllowDBNull = false; DataColumn col19 = dataTable.Columns.Add("ShipToFirstName", typeof(string)); col19.AllowDBNull = false; DataColumn col20 = dataTable.Columns.Add("ShipToLastName", typeof(string)); col20.AllowDBNull = false; DataColumn col21 = dataTable.Columns.Add("AuthorizationNumber", typeof(int)); col21.AllowDBNull = false; DataColumn col22 = dataTable.Columns.Add("Locale", typeof(string)); col22.AllowDBNull = false; bulkCopy.ColumnMappings.Add("OrderId", "OrderId"); bulkCopy.ColumnMappings.Add("UserId", "UserId"); bulkCopy.ColumnMappings.Add("OrderDate", "OrderDate"); bulkCopy.ColumnMappings.Add("ShipAddr1", "ShipAddr1"); bulkCopy.ColumnMappings.Add("ShipAddr2", "ShipAddr2"); bulkCopy.ColumnMappings.Add("ShipCity", "ShipCity"); bulkCopy.ColumnMappings.Add("ShipState", "ShipState"); bulkCopy.ColumnMappings.Add("ShipZip", "ShipZip"); bulkCopy.ColumnMappings.Add("ShipCountry", "ShipCountry"); bulkCopy.ColumnMappings.Add("BillAddr1", "BillAddr1"); bulkCopy.ColumnMappings.Add("BillAddr2", "BillAddr2"); bulkCopy.ColumnMappings.Add("BillCity", "BillCity"); bulkCopy.ColumnMappings.Add("BillState", "BillState"); bulkCopy.ColumnMappings.Add("BillZip", "BillZip"); bulkCopy.ColumnMappings.Add("BillCountry", "BillCountry"); bulkCopy.ColumnMappings.Add("Courier", "Courier"); bulkCopy.ColumnMappings.Add("TotalPrice", "TotalPrice"); bulkCopy.ColumnMappings.Add("BillToFirstName", "BillToFirstName"); bulkCopy.ColumnMappings.Add("BillToLastName", "BillToLastName"); bulkCopy.ColumnMappings.Add("ShipToFirstName", "ShipToFirstName"); bulkCopy.ColumnMappings.Add("ShipToLastName", "ShipToLastName"); bulkCopy.ColumnMappings.Add("AuthorizationNumber", "AuthorizationNumber"); bulkCopy.ColumnMappings.Add("Locale", "Locale"); foreach (PetShop.Business.Order entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["OrderId"] = entity.OrderId; row["UserId"] = entity.UserId; row["OrderDate"] = entity.OrderDate; row["ShipAddr1"] = entity.ShipAddr1; row["ShipAddr2"] = entity.ShipAddr2; row["ShipCity"] = entity.ShipCity; row["ShipState"] = entity.ShipState; row["ShipZip"] = entity.ShipZip; row["ShipCountry"] = entity.ShipCountry; row["BillAddr1"] = entity.BillAddr1; row["BillAddr2"] = entity.BillAddr2; row["BillCity"] = entity.BillCity; row["BillState"] = entity.BillState; row["BillZip"] = entity.BillZip; row["BillCountry"] = entity.BillCountry; row["Courier"] = entity.Courier; row["TotalPrice"] = entity.TotalPrice; row["BillToFirstName"] = entity.BillToFirstName; row["BillToLastName"] = entity.BillToLastName; row["ShipToFirstName"] = entity.ShipToFirstName; row["ShipToLastName"] = entity.ShipToLastName; row["AuthorizationNumber"] = entity.AuthorizationNumber; row["Locale"] = entity.Locale; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (PetShop.Business.Order entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Item object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <PetShop.Business.Item> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "Item"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("ItemId", typeof(string)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("ProductId", typeof(string)); col1.AllowDBNull = false; DataColumn col2 = dataTable.Columns.Add("ListPrice", typeof(System.Decimal?)); col2.AllowDBNull = true; DataColumn col3 = dataTable.Columns.Add("UnitCost", typeof(System.Decimal?)); col3.AllowDBNull = true; DataColumn col4 = dataTable.Columns.Add("Supplier", typeof(System.Int32?)); col4.AllowDBNull = true; DataColumn col5 = dataTable.Columns.Add("Status", typeof(string)); col5.AllowDBNull = true; DataColumn col6 = dataTable.Columns.Add("Name", typeof(string)); col6.AllowDBNull = true; DataColumn col7 = dataTable.Columns.Add("Image", typeof(string)); col7.AllowDBNull = true; bulkCopy.ColumnMappings.Add("ItemId", "ItemId"); bulkCopy.ColumnMappings.Add("ProductId", "ProductId"); bulkCopy.ColumnMappings.Add("ListPrice", "ListPrice"); bulkCopy.ColumnMappings.Add("UnitCost", "UnitCost"); bulkCopy.ColumnMappings.Add("Supplier", "Supplier"); bulkCopy.ColumnMappings.Add("Status", "Status"); bulkCopy.ColumnMappings.Add("Name", "Name"); bulkCopy.ColumnMappings.Add("Image", "Image"); foreach (PetShop.Business.Item entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["ItemId"] = entity.ItemId; row["ProductId"] = entity.ProductId; row["ListPrice"] = entity.ListPrice.HasValue ? (object)entity.ListPrice : System.DBNull.Value; row["UnitCost"] = entity.UnitCost.HasValue ? (object)entity.UnitCost : System.DBNull.Value; row["Supplier"] = entity.Supplier.HasValue ? (object)entity.Supplier : System.DBNull.Value; row["Status"] = entity.Status; row["Name"] = entity.Name; row["Image"] = entity.Image; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (PetShop.Business.Item entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.StoreContact object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <Nettiers.AdventureWorks.Entities.StoreContact> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "StoreContact"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("CustomerID", typeof(System.Int32)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("ContactID", typeof(System.Int32)); col1.AllowDBNull = false; DataColumn col2 = dataTable.Columns.Add("ContactTypeID", typeof(System.Int32)); col2.AllowDBNull = false; DataColumn col3 = dataTable.Columns.Add("rowguid", typeof(System.Guid)); col3.AllowDBNull = false; DataColumn col4 = dataTable.Columns.Add("ModifiedDate", typeof(System.DateTime)); col4.AllowDBNull = false; bulkCopy.ColumnMappings.Add("CustomerID", "CustomerID"); bulkCopy.ColumnMappings.Add("ContactID", "ContactID"); bulkCopy.ColumnMappings.Add("ContactTypeID", "ContactTypeID"); bulkCopy.ColumnMappings.Add("rowguid", "rowguid"); bulkCopy.ColumnMappings.Add("ModifiedDate", "ModifiedDate"); foreach (Nettiers.AdventureWorks.Entities.StoreContact entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["CustomerID"] = entity.CustomerId; row["ContactID"] = entity.ContactId; row["ContactTypeID"] = entity.ContactTypeId; row["rowguid"] = entity.Rowguid; row["ModifiedDate"] = entity.ModifiedDate; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (Nettiers.AdventureWorks.Entities.StoreContact entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
public List <Stock> UpdatePrices(List <Stock> Current) { Dictionary <string, DateTime> UpdateMe = new Dictionary <string, DateTime>(); int count = -1; foreach (var v in Current) { DateTime d = v.History.Max(x => x.TradeDate); if ((DateTime.Now.Ticks - d.Ticks) > TimeSpan.FromHours(24).Ticks) { UpdateMe.Add(v.Ticker, d); } } System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(); con.ConnectionString = @"Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\Users\Ben Roberts\Dropbox\WOERK.mdf; Integrated Security=True; Connect Timeout=30;"; con.Open(); DbCommand t = con.CreateCommand(); t.Connection = con; t.CommandText = "SELECT MAX(Count) From StockHist;"; using (DbDataReader dr = t.ExecuteReader()) if (dr.HasRows) { while (dr.Read()) { object c = dr.GetValue(0); count = (int)c; } } else { return(null); } List <TradingDay> UpdatedStocks = new List <TradingDay>(); foreach (var m in UpdateMe) { UpdatedStocks.AddRange(GetData.DownloadStocksUsingString(m.Key, m.Value)); } for (int i = 0; i < UpdatedStocks.Count; i++) { UpdatedStocks[i].Count = count + 1; count++; } var context = new StockContext(); context.St1.AddRange(UpdatedStocks); context.SaveChanges(); List <Stock> NewStocks = new List <Stock>(); NewStocks = this.InitialiseStocks(false); return(NewStocks); }
/// <summary> /// Creates and configures a new instance of the SqlDataAdapter_tblSupplier class. /// </summary> /// <param name="sqlConnection">A valid System.Data.SqlClient.SqlConnection to the database.</param> /// <param name="tableName">Table name to be use in the DataSet.</param> public SqlDataAdapter_tblSupplier(System.Data.SqlClient.SqlConnection sqlConnection, string tableName) : this(sqlConnection) { this.Configure(tableName); }
public static void LogMessage(string message, bool message2, bool warning, bool error) { message.Trim(); if (message == null || message.Length == 0) { return; } if (!_logToConsole && !_logToFile && !LogToDatabase) { throw new Exception("Invalid configuration"); } if ((!_logError && !_logMessage && !_logWarning) || (!message2 && !warning && !error)) { throw new Exception("Error or Warning or Message must be specified"); } System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]); connection.Open(); int t = 0; if (message2 && _logMessage) { t = 1; } if (error && _logError) { t = 2; } if (warning && _logWarning) { t = 3; } System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("Insert into Log Values('" + message + "', " + t.ToString() + ")"); command.ExecuteNonQuery(); string l = string.Empty; if (!System.IO.File.Exists(System.Configuration.ConfigurationManager.AppSettings["LogFileDirectory"] + "LogFile" + DateTime.Now.ToShortDateString() + ".txt")) { l = System.IO.File.ReadAllText(System.Configuration.ConfigurationManager.AppSettings["LogFileDirectory"] + "LogFile" + DateTime.Now.ToShortDateString() + ".txt"); } if (error && _logError) { l = l + DateTime.Now.ToShortDateString() + message; } if (warning && _logWarning) { l = l + DateTime.Now.ToShortDateString() + message; } if (message2 && _logMessage) { l = l + DateTime.Now.ToShortDateString() + message; } System.IO.File.WriteAllText(System.Configuration.ConfigurationManager.AppSettings["LogFileDirectory"] + "LogFile" + DateTime.Now.ToShortDateString() + ".txt", l); if (error && _logError) { Console.ForegroundColor = ConsoleColor.Red; } if (warning && _logWarning) { Console.ForegroundColor = ConsoleColor.Yellow; } if (message2 && _logMessage) { Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine(DateTime.Now.ToShortDateString() + message); }
public List <Stock> InitialiseStocks(bool test) { List <Stock> Result = new List <Stock>(); System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(); con.ConnectionString = @"Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\Users\Ben Roberts\Dropbox\WOERK.mdf; Integrated Security=True; Connect Timeout=30;"; con.Open(); DbCommand t = con.CreateCommand(); if (test) { Result.Add(new Stock()); Result.Add(new Stock()); Result[0].Ticker = "CBA.AX"; Result[1].Ticker = "BHP.AX"; } else { t.Connection = con; t.CommandText = "SELECT DISTINCT Ticker FROM StockHist;"; using (DbDataReader dr = t.ExecuteReader()) { int i = 0; if (dr.HasRows) { while (dr.Read()) { Stock temp = new Stock(); object c = dr.GetValue(0); temp.Ticker = (string)c; Result.Add(temp); i++; } } } } foreach (var c in Result) { c.History = new List <TradingDay>(); string temp = "SELECT * FROM StockHist WHERE Ticker = '" + c.Ticker + "';"; t.CommandText = temp; using (DbDataReader dr = t.ExecuteReader()) { int i = 0; if (dr.HasRows) { while (dr.Read()) { object x = dr.GetValue(2); DateTime date = (DateTime)dr.GetValue(2); double Opening = (double)dr.GetValue(3); double Closing = (double)dr.GetValue(4); double High = (double)dr.GetValue(5); double Low = (double)dr.GetValue(6); int Volume = (int)dr.GetValue(7); double PrevClose = (double)dr.GetValue(9); double AdjClose = (double)dr.GetValue(10); TradingDay tempDay = new TradingDay(c.Ticker, i, date, Opening, Closing, High, Low, AdjClose, PrevClose, Volume); c.History.Add(tempDay); i++; } } } c.SortDates(); } return(Result); }
private void simpleButton1_Click(object sender, EventArgs e) { ////////////////frmViewReport frm = new frmViewReport(); ////////////////frm.rpt = new rptTienThuongXepLoai(); ////////////////string sCo = @"Server=.;database=VS_HRM;uid=sa;pwd=123;Connect Timeout=9999;"; //////////////////string sCo = @"Server=.;database=VS_HRM;uid=sa;pwd=123;Connect Timeout=9999;"; ////////////////DataTable dt = new DataTable(); ////////////////dt.Load(SqlHelper.ExecuteReader(sCo, "spTienThuongXepLoai")); ////////////////dt.TableName = "AAARE"; ////////////////frm.AddDataSource(dt); ////////////////dt = new DataTable(); ////////////////dt.Load(SqlHelper.ExecuteReader(sCo, CommandType.Text, @"SELECT //////////////// 'tdBaoCao' AS tdBaoCao,'CHXHCNVN' AS CHXHCNVN,'DLTDHP' AS DLTDHP,'STT' AS STT,'MS_CN' AS MS_CN,'HO_TEN' AS HO_TEN,'MucThuong' AS MucThuong,'XepLoaiThuong' AS XepLoaiThuong, //////////////// 'HeSoThuong' AS HeSoThuong,'SoTienThuong' AS SoTienThuong,'KyNhan' AS KyNhan,'TongCong' AS TongCong,'BangChu' AS BangChu,'LapBang' AS LapBang, //////////////// 'TPTCHC' AS TPTCHC,'KTTruong' AS KTTruong,'GiamDoc' AS GiamDoc,'NgayThangNam' NgayThangNam ////////////////")); ////////////////dt.TableName = "NNGU"; ////////////////frm.AddDataSource(dt); ////////////////frm.rpt = new rptTienThuongXepLoai(); ////////////////frm.Show(); //////////////frmViewReport frm = new frmViewReport(); //////////////frm.rpt = new rptDSDonVi(); //////////////DataTable dt = new DataTable(); //////////////dt.Load(SqlHelper.ExecuteReader(Commons.IConnections.CNStr, "rptDSDonVi", Commons.Modules.UserName, Commons.Modules.TypeLanguage)); //////////////dt.TableName = "DATA"; //////////////frm.AddDataSource(dt); //////////////frm.Show(); System.Data.SqlClient.SqlConnection conn; DataTable dt = new DataTable(); frmViewReport frm = new frmViewReport(); frm.rpt = new rptDSDonVi(); try { conn = new System.Data.SqlClient.SqlConnection(Commons.IConnections.CNStr); conn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("rptDSDonVi", conn); cmd.Parameters.Add("@UName", SqlDbType.NVarChar, 50).Value = Commons.Modules.UserName; cmd.Parameters.Add("@NNgu", SqlDbType.Int).Value = Commons.Modules.TypeLanguage; cmd.CommandType = CommandType.StoredProcedure; System.Data.SqlClient.SqlDataAdapter adp = new System.Data.SqlClient.SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); dt = new DataTable(); dt = ds.Tables[0].Copy(); dt.TableName = "TTC"; frm.AddDataSource(dt); dt = new DataTable(); dt = ds.Tables[1].Copy(); dt.TableName = "DATA"; frm.AddDataSource(dt); } catch { } frm.ShowDialog(); }
internal UnitOfWork(string connectionString) { Id = Guid.NewGuid(); Connection = new System.Data.SqlClient.SqlConnection(connectionString); }
public static void OpenConection() { cn = new System.Data.SqlClient.SqlConnection(GetConectionString()); Command = new System.Data.SqlClient.SqlCommand(); }
public List <TournamentModel> GetTournament_All() { List <TournamentModel> output; using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("Tournaments"))) { output = connection.Query <TournamentModel>("dbo.spTournaments_GetAll").ToList(); var p = new DynamicParameters(); foreach (TournamentModel t in output) { //populate prizes p = new DynamicParameters(); p.Add("@TournamentId", t.Id); t.Prizes = connection.Query <PrizeModel>("dbo.spPrizes_GetByTournament", p, commandType: CommandType.StoredProcedure).ToList(); //populate teams p = new DynamicParameters(); p.Add("@TournamentId", t.Id); t.EnteredTeams = connection.Query <TeamModel>("dbo.spTeam_GetByTournament", p, commandType: CommandType.StoredProcedure).ToList(); foreach (TeamModel team in t.EnteredTeams) { p = new DynamicParameters(); p.Add("@TeamId", team.Id); team.TeamMembers = connection.Query <PersonModel>("dbo.spTeamMembers_GetByTeam", p, commandType: CommandType.StoredProcedure).ToList(); } //populate rounds p = new DynamicParameters(); p.Add("@TournamentId", t.Id); List <MatchupModel> matchups = connection.Query <MatchupModel>("dbo.spMatchups_GetByTournament", p, commandType: CommandType.StoredProcedure).ToList(); foreach (MatchupModel m in matchups) { p = new DynamicParameters(); p.Add("@MatchupId", m.Id); m.Entries = connection.Query <MatchupEntryModel>("dbo.spMatchupEntries_GetByMatchups", p, commandType: CommandType.StoredProcedure).ToList(); //populate each entry (2 models) //populate each matchup (1 model) List <TeamModel> allTeams = GetTeam_all(); if (m.WinnerId > 0) { m.Winner = allTeams.Where(x => x.Id == m.WinnerId).First(); } foreach (var me in m.Entries) { if (me.TeamCompetingId > 0) { me.TeamCompeting = allTeams.Where(x => x.Id == me.TeamCompetingId).First(); } if (me.ParentMatchupId > 0) { me.ParentMatchup = matchups.Where(x => x.Id == me.ParentMatchupId).First(); } } } //List<List<MatchupModel>> load List <MatchupModel> currRow = new List <MatchupModel>(); int currRound = 1; foreach (MatchupModel m in matchups) { //check to see if the round has been changed if (m.MatchupRound > currRound) { t.Rounds.Add(currRow); currRow = new List <MatchupModel>(); currRound += 1; } currRow.Add(m); } t.Rounds.Add(currRow); } } return(output); }
public override bool Initialize(System.Data.SqlClient.SqlConnection con) { return(base.Initialize(con)); }
private void InitializeComponent() { this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.dataSet11 = new CustomSummary.DataSet1(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details]"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = @"INSERT INTO [Order Details] (OrderID, ProductID, UnitPrice, Quantity, Discount) VALUES (@OrderID, @ProductID, @UnitPrice, @Quantity, @Discount); SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details] WHERE (OrderID = @OrderID) AND (ProductID = @ProductID)"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@OrderID", System.Data.SqlDbType.Int, 4, "OrderID")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductID", System.Data.SqlDbType.Int, 4, "ProductID")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UnitPrice", System.Data.SqlDbType.Money, 8, "UnitPrice")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Quantity", System.Data.SqlDbType.SmallInt, 2, "Quantity")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Discount", System.Data.SqlDbType.Real, 4, "Discount")); // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = @"UPDATE [Order Details] SET OrderID = @OrderID, ProductID = @ProductID, UnitPrice = @UnitPrice, Quantity = @Quantity, Discount = @Discount WHERE (OrderID = @Original_OrderID) AND (ProductID = @Original_ProductID) AND (Discount = @Original_Discount) AND (Quantity = @Original_Quantity) AND (UnitPrice = @Original_UnitPrice); SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details] WHERE (OrderID = @OrderID) AND (ProductID = @ProductID)"; this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@OrderID", System.Data.SqlDbType.Int, 4, "OrderID")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductID", System.Data.SqlDbType.Int, 4, "ProductID")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UnitPrice", System.Data.SqlDbType.Money, 8, "UnitPrice")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Quantity", System.Data.SqlDbType.SmallInt, 2, "Quantity")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Discount", System.Data.SqlDbType.Real, 4, "Discount")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_OrderID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OrderID", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Discount", System.Data.SqlDbType.Real, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Discount", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Quantity", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Quantity", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_UnitPrice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UnitPrice", System.Data.DataRowVersion.Original, null)); // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = "DELETE FROM [Order Details] WHERE (OrderID = @Original_OrderID) AND (ProductID = " + "@Original_ProductID) AND (Discount = @Original_Discount) AND (Quantity = @Origin" + "al_Quantity) AND (UnitPrice = @Original_UnitPrice)"; this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_OrderID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OrderID", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Discount", System.Data.SqlDbType.Real, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Discount", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Quantity", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Quantity", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_UnitPrice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UnitPrice", System.Data.DataRowVersion.Original, null)); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "Network Address=66.135.59.108,49489;initial catalog=NORTHWIND;password=Sync_samples;persist security info=True;user id=sa;packet size=4096;Pooling=true"; // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Order Details", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("OrderID", "OrderID"), new System.Data.Common.DataColumnMapping("ProductID", "ProductID"), new System.Data.Common.DataColumnMapping("UnitPrice", "UnitPrice"), new System.Data.Common.DataColumnMapping("Quantity", "Quantity"), new System.Data.Common.DataColumnMapping("Discount", "Discount") }) }); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("en-US"); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); }
/// <summary> /// Required method for telerik Reporting designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { Telerik.Reporting.ReportParameter reportParameter1 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter2 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter3 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter4 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter5 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter6 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter7 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter8 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter9 = new Telerik.Reporting.ReportParameter(); Telerik.Reporting.ReportParameter reportParameter10 = new Telerik.Reporting.ReportParameter(); this.pageHeader = new Telerik.Reporting.PageHeaderSection(); this.textBox37 = new Telerik.Reporting.TextBox(); this.textBox36 = new Telerik.Reporting.TextBox(); this.textBox35 = new Telerik.Reporting.TextBox(); this.textBox31 = new Telerik.Reporting.TextBox(); this.textBox30 = new Telerik.Reporting.TextBox(); this.textBox29 = new Telerik.Reporting.TextBox(); this.textBox28 = new Telerik.Reporting.TextBox(); this.textBox27 = new Telerik.Reporting.TextBox(); this.textBox34 = new Telerik.Reporting.TextBox(); this.textBox33 = new Telerik.Reporting.TextBox(); this.textBox32 = new Telerik.Reporting.TextBox(); this.textBox55 = new Telerik.Reporting.TextBox(); this.textBox54 = new Telerik.Reporting.TextBox(); this.textBox51 = new Telerik.Reporting.TextBox(); this.textBox43 = new Telerik.Reporting.TextBox(); this.detail = new Telerik.Reporting.DetailSection(); this.textBox1 = new Telerik.Reporting.TextBox(); this.textBox2 = new Telerik.Reporting.TextBox(); this.textBox3 = new Telerik.Reporting.TextBox(); this.textBox4 = new Telerik.Reporting.TextBox(); this.textBox5 = new Telerik.Reporting.TextBox(); this.textBox6 = new Telerik.Reporting.TextBox(); this.textBox7 = new Telerik.Reporting.TextBox(); this.textBox8 = new Telerik.Reporting.TextBox(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection2 = new System.Data.SqlClient.SqlConnection(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.reportFooterSection1 = new Telerik.Reporting.ReportFooterSection(); this.textBox9 = new Telerik.Reporting.TextBox(); this.textBox10 = new Telerik.Reporting.TextBox(); this.textBox11 = new Telerik.Reporting.TextBox(); this.textBox12 = new Telerik.Reporting.TextBox(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // pageHeader // this.pageHeader.Height = new Telerik.Reporting.Drawing.Unit(3.4999997615814209D, Telerik.Reporting.Drawing.UnitType.Cm); this.pageHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { this.textBox37, this.textBox36, this.textBox35, this.textBox31, this.textBox30, this.textBox29, this.textBox28, this.textBox27, this.textBox34, this.textBox33, this.textBox32, this.textBox55, this.textBox54, this.textBox51, this.textBox43}); this.pageHeader.Name = "pageHeader"; // // textBox37 // this.textBox37.Format = "{0:d}"; this.textBox37.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(2.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.7579324245452881D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox37.Name = "textBox37"; this.textBox37.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4.5262045860290527D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox37.Style.Font.Name = "Verdana"; this.textBox37.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox37.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left; this.textBox37.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox37.Value = "= Parameters.Fecha"; // // textBox36 // this.textBox36.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(2.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.1789662837982178D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox36.Name = "textBox36"; this.textBox36.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4.5347456932067871D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox36.Style.Font.Name = "Verdana"; this.textBox36.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox36.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left; this.textBox36.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox36.Value = "= Parameters.Tipo"; // // textBox35 // this.textBox35.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(2.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox35.Name = "textBox35"; this.textBox35.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4.7006397247314453D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox35.Style.Font.Name = "Verdana"; this.textBox35.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox35.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left; this.textBox35.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox35.Value = "= IsNull(Parameters.[Id_Prd], \"(Todos)\")"; // // textBox31 // this.textBox31.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.7579324245452881D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox31.Name = "textBox31"; this.textBox31.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2.203125D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox31.Style.Font.Bold = true; this.textBox31.Style.Font.Name = "Verdana"; this.textBox31.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox31.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox31.Value = "Fecha:"; // // textBox30 // this.textBox30.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox30.Name = "textBox30"; this.textBox30.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2.203125D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox30.Style.Font.Bold = true; this.textBox30.Style.Font.Name = "Verdana"; this.textBox30.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox30.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox30.Value = "Producto:"; // // textBox29 // this.textBox29.Format = "{0:g}"; this.textBox29.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(15.200000762939453D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.747083306312561D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox29.Name = "textBox29"; this.textBox29.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.1899995803833008D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox29.Style.Font.Name = "Verdana"; this.textBox29.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox29.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox29.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox29.Value = "= Parameters.FechaActual"; // // textBox28 // this.textBox28.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(15.200000762939453D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.1470834016799927D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox28.Name = "textBox28"; this.textBox28.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.1899995803833008D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.59999990463256836D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox28.Style.Font.Name = "Verdana"; this.textBox28.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox28.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox28.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox28.Value = "= \"Usuario: \" + Parameters.Usuario"; // // textBox27 // this.textBox27.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.1789662837982178D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox27.Name = "textBox27"; this.textBox27.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2.203125D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.57896620035171509D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox27.Style.Font.Bold = true; this.textBox27.Style.Font.Name = "Verdana"; this.textBox27.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(10D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox27.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox27.Value = "Tipo:"; // // textBox34 // this.textBox34.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.5370287895202637D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.54708343744277954D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox34.Name = "textBox34"; this.textBox34.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5159416198730469D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox34.Style.Font.Bold = true; this.textBox34.Style.Font.Name = "Verdana"; this.textBox34.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(12D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox34.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox34.Value = "= Parameters.NombreEmpresa"; // // textBox33 // this.textBox33.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.5370283126831055D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.1556251049041748D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox33.Name = "textBox33"; this.textBox33.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5159420967102051D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox33.Style.Font.Bold = true; this.textBox33.Style.Font.Name = "Verdana"; this.textBox33.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(12D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox33.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox33.Value = "= Parameters.NombreSucursal"; // // textBox32 // this.textBox32.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(6.9264044761657715D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.7641667127609253D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox32.Name = "textBox32"; this.textBox32.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(6.7371902465820312D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.59999990463256836D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox32.Style.Font.Bold = true; this.textBox32.Style.Font.Name = "Verdana"; this.textBox32.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(12D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox32.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox32.Value = "Rotación de inventarios"; // // textBox55 // this.textBox55.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(11.60333251953125D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(3D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox55.Name = "textBox55"; this.textBox55.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.49989971518516541D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox55.Style.Font.Name = "Verdana"; this.textBox55.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox55.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox55.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox55.Value = "Rotación días"; // // textBox54 // this.textBox54.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.7033329010009766D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(3D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox54.Name = "textBox54"; this.textBox54.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.49989971518516541D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox54.Style.Font.Name = "Verdana"; this.textBox54.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox54.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox54.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox54.Value = "Venta diaria"; // // textBox51 // this.textBox51.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.8033335208892822D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(3D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox51.Name = "textBox51"; this.textBox51.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.49989971518516541D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox51.Style.Font.Name = "Verdana"; this.textBox51.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox51.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; this.textBox51.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox51.Value = "Inventario"; // // textBox43 // this.textBox43.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(16.690097808837891D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.54688358306884766D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox43.Name = "textBox43"; this.textBox43.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.6999015808105469D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox43.Style.Font.Name = "Verdana"; this.textBox43.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(7D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox43.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox43.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox43.Value = "= \"Página \" + PageNumber + \" de \" + PageCount"; // // detail // this.detail.Height = new Telerik.Reporting.Drawing.Unit(1.2002004384994507D, Telerik.Reporting.Drawing.UnitType.Cm); this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { this.textBox1, this.textBox2, this.textBox3, this.textBox4, this.textBox5, this.textBox6, this.textBox7, this.textBox8}); this.detail.Name = "detail"; // // textBox1 // this.textBox1.Format = "{0:N2}"; this.textBox1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.7993674278259277D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox1.Name = "textBox1"; this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox1.Style.Font.Name = "Verdana"; this.textBox1.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox1.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox1.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox1.Value = "= Fields.Producto_Inventario"; // // textBox2 // this.textBox2.Format = "{0:N2}"; this.textBox2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.699366569519043D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox2.Name = "textBox2"; this.textBox2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox2.Style.Font.Name = "Verdana"; this.textBox2.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox2.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox2.Value = "= Fields.Producto_Venta"; // // textBox3 // this.textBox3.Format = "{0:N2}"; this.textBox3.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(11.599366188049316D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox3.Name = "textBox3"; this.textBox3.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox3.Style.Font.Name = "Verdana"; this.textBox3.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox3.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox3.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox3.Value = "= Fields.Producto_Rotacion"; // // textBox4 // this.textBox4.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox4.Name = "textBox4"; this.textBox4.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.50770902633667D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox4.Style.Font.Bold = true; this.textBox4.Style.Font.Name = "Verdana"; this.textBox4.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox4.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox4.Value = "Producto:"; // // textBox5 // this.textBox5.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.600200355052948D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox5.Name = "textBox5"; this.textBox5.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.50770902633667D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox5.Style.Font.Bold = true; this.textBox5.Style.Font.Name = "Verdana"; this.textBox5.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox5.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox5.Value = "Sistema propietario:"; // // textBox6 // this.textBox6.Format = "{0:N2}"; this.textBox6.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.6930937767028809D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.600200355052948D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox6.Name = "textBox6"; this.textBox6.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox6.Style.Font.Name = "Verdana"; this.textBox6.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox6.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox6.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox6.Value = "= Fields.SisP_Venta"; // // textBox7 // this.textBox7.Format = "{0:N2}"; this.textBox7.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.7930943965911865D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.600200355052948D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox7.Name = "textBox7"; this.textBox7.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox7.Style.Font.Name = "Verdana"; this.textBox7.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox7.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox7.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox7.Value = "= Fields.SisP_Inventario"; // // textBox8 // this.textBox8.Format = "{0:N2}"; this.textBox8.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(11.593092918395996D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.600200355052948D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox8.Name = "textBox8"; this.textBox8.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8999991416931152D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox8.Style.Font.Name = "Verdana"; this.textBox8.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox8.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox8.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox8.Value = "= Fields.SisP_Rotacion"; // // sqlDataAdapter1 // this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "spRepRotacionInv_formato1", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("Producto_Inventario", "Producto_Inventario"), new System.Data.Common.DataColumnMapping("Producto_Venta", "Producto_Venta"), new System.Data.Common.DataColumnMapping("Producto_Rotacion", "Producto_Rotacion"), new System.Data.Common.DataColumnMapping("SisP_Inventario", "SisP_Inventario"), new System.Data.Common.DataColumnMapping("SisP_Venta", "SisP_Venta"), new System.Data.Common.DataColumnMapping("SisP_Rotacion", "SisP_Rotacion")})}); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "dbo.spRepRotacionInv_formato1"; this.sqlSelectCommand1.CommandTimeout = 600; this.sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure; this.sqlSelectCommand1.Connection = this.sqlConnection2; this.sqlSelectCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, null), new System.Data.SqlClient.SqlParameter("@Id_Emp", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, ""), new System.Data.SqlClient.SqlParameter("@Id_Cd", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, ""), new System.Data.SqlClient.SqlParameter("@Fecha", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, ""), new System.Data.SqlClient.SqlParameter("@Id_PrdStr", System.Data.SqlDbType.NVarChar, 2147483647, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, "")}); // // sqlConnection2 // this.sqlConnection2.FireInfoMessageEventOnUserErrors = false; // // sqlConnection1 // this.sqlConnection1.ConnectionString = "Data Source=EGBKSVR;Initial Catalog=SIANWEBPruebas;Persist Security Info=True;Use" + "r ID=sa;Password=sistemas"; this.sqlConnection1.FireInfoMessageEventOnUserErrors = false; // // reportFooterSection1 // this.reportFooterSection1.Height = new Telerik.Reporting.Drawing.Unit(0.9999995231628418D, Telerik.Reporting.Drawing.UnitType.Cm); this.reportFooterSection1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { this.textBox9, this.textBox10, this.textBox11, this.textBox12}); this.reportFooterSection1.Name = "reportFooterSection1"; // // textBox9 // this.textBox9.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19229142367839813D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.19999989867210388D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox9.Name = "textBox9"; this.textBox9.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.50770902633667D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000008344650269D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox9.Style.Font.Bold = true; this.textBox9.Style.Font.Name = "Verdana"; this.textBox9.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox9.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox9.Value = "Inventario final:"; // // textBox10 // this.textBox10.Format = "{0:N2}"; this.textBox10.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.8033335208892822D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.19999989867210388D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox10.Name = "textBox10"; this.textBox10.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8897600173950195D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox10.Style.Font.Name = "Verdana"; this.textBox10.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox10.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox10.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox10.Value = "=Producto_Inventario+SisP_Inventario"; // // textBox11 // this.textBox11.Format = "{0:N2}"; this.textBox11.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(7.6930937767028809D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.19999989867210388D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox11.Name = "textBox11"; this.textBox11.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8897600173950195D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox11.Style.Font.Name = "Verdana"; this.textBox11.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox11.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox11.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox11.Value = "=Producto_Venta+ SisP_Venta"; // // textBox12 // this.textBox12.Format = "{0:N2}"; this.textBox12.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(11.582853317260742D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.19999989867210388D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox12.Name = "textBox12"; this.textBox12.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.8897600173950195D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.60000002384185791D, Telerik.Reporting.Drawing.UnitType.Cm)); this.textBox12.Style.Font.Name = "Verdana"; this.textBox12.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point); this.textBox12.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; this.textBox12.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle; this.textBox12.Value = "=IIf((Fields.Producto_Venta + Fields.SisP_Venta) <> 0, (Fields.Producto_Inventari" + "o + Fields.SisP_Inventario) / (Fields.Producto_Venta + Fields.SisP_Venta), 0)"; // // Rep_InvRotacion // this.DataSource = this.sqlDataAdapter1; this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { this.pageHeader, this.detail, this.reportFooterSection1}); this.PageSettings.Landscape = false; this.PageSettings.Margins.Bottom = new Telerik.Reporting.Drawing.Unit(0.5D, Telerik.Reporting.Drawing.UnitType.Cm); this.PageSettings.Margins.Left = new Telerik.Reporting.Drawing.Unit(0.5D, Telerik.Reporting.Drawing.UnitType.Cm); this.PageSettings.Margins.Right = new Telerik.Reporting.Drawing.Unit(0.5D, Telerik.Reporting.Drawing.UnitType.Cm); this.PageSettings.Margins.Top = new Telerik.Reporting.Drawing.Unit(0.5D, Telerik.Reporting.Drawing.UnitType.Cm); this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter; reportParameter1.Name = "Conexion"; reportParameter2.Name = "Id_Emp"; reportParameter3.Name = "Id_Cd"; reportParameter4.Name = "Id_Prd"; reportParameter5.Name = "Tipo"; reportParameter6.Name = "Fecha"; reportParameter7.Name = "Usuario"; reportParameter8.Name = "NombreEmpresa"; reportParameter9.Name = "NombreSucursal"; reportParameter10.Name = "FechaActual"; this.ReportParameters.Add(reportParameter1); this.ReportParameters.Add(reportParameter2); this.ReportParameters.Add(reportParameter3); this.ReportParameters.Add(reportParameter4); this.ReportParameters.Add(reportParameter5); this.ReportParameters.Add(reportParameter6); this.ReportParameters.Add(reportParameter7); this.ReportParameters.Add(reportParameter8); this.ReportParameters.Add(reportParameter9); this.ReportParameters.Add(reportParameter10); this.Style.BackgroundColor = System.Drawing.Color.White; this.Width = new Telerik.Reporting.Drawing.Unit(20.589998245239258D, Telerik.Reporting.Drawing.UnitType.Cm); this.NeedDataSource += new System.EventHandler(this.Rep_InvRotacion_NeedDataSource); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }
public void RunAdoNetExamples() { // -------------------------------------------------------------------------------------------- // - ADO.NET https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ // // - SqlConnection class https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlconnection // // Creating the abstract base classes string path = Path.Combine(Environment.CurrentDirectory, "database.mdf"); DbConnection connection = new System.Data.SqlClient.SqlConnection( string.Format(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename={0};Integrated Security=True", path)); connection.Open(); DbProviderFactory factory = DbProviderFactories.GetFactory(connection); // -------------------------------------------------------------------------------------------- // ExecuteNonQuery using (DbCommand createCommand = factory.CreateCommand()) { createCommand.Connection = connection; createCommand.CommandText = "CREATE TABLE [Words] ([Id] INT NOT NULL PRIMARY KEY, [Word] NVARCHAR(50) NOT NULL, [Count] INT NOT NULL)"; createCommand.ExecuteNonQuery(); } // -------------------------------------------------------------------------------------------- // ExecuteNonQuery with parameters using (DbCommand insertCommand = factory.CreateCommand()) { DateTime current = DateTime.UtcNow; insertCommand.Connection = connection; insertCommand.CommandText = "INSERT INTO [Words] ([Id], [Word], [Count]) VALUES (@id, @word, @count)"; DbParameter idParameter = factory.CreateParameter(); idParameter.DbType = System.Data.DbType.Int32; idParameter.ParameterName = "@id"; idParameter.Size = 4; idParameter.Value = 0; insertCommand.Parameters.Add(idParameter); DbParameter wordParameter = factory.CreateParameter(); wordParameter.DbType = System.Data.DbType.String; wordParameter.ParameterName = "@word"; wordParameter.Size = 100; wordParameter.Value = 0; insertCommand.Parameters.Add(wordParameter); DbParameter countParameter = factory.CreateParameter(); countParameter.DbType = System.Data.DbType.Int32; countParameter.Size = 4; countParameter.ParameterName = "@count"; countParameter.Value = 0; insertCommand.Parameters.Add(countParameter); insertCommand.Prepare(); int id = 0; string text = StringData.CreateMediumString(); string[] words = text.Split(new char[] { ' ', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (string word in words.Distinct()) { idParameter.Value = id++; wordParameter.Value = word; countParameter.Value = words.Count(a => a == word); insertCommand.ExecuteNonQuery(); } Console.WriteLine("[DbCommand.Parameters] Inserted {0} rows in {1:0.000}s", id + 1, (DateTime.UtcNow - current).TotalSeconds); } // -------------------------------------------------------------------------------------------- // ExecuteScalar // TODO using (DbCommand countCommand = factory.CreateCommand()) { DateTime current = DateTime.UtcNow; countCommand.Connection = connection; countCommand.CommandText = "SELECT COUNT(*) FROM [Words]"; int count = (int)countCommand.ExecuteScalar(); Console.WriteLine("[DbCommand.ExecuteScalar] Result Count = {0} in {1:0.000}s", count, (DateTime.UtcNow - current).TotalSeconds); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.comboBoxBase1 = new Syncfusion.Windows.Forms.Tools.ComboBoxBase(); this.gridListControl1 = new Syncfusion.Windows.Forms.Grid.GridListControl(); this.dataSet11 = new ComboBoxBaseGridDemo.DataSet1(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.textLog = new System.Windows.Forms.TextBox(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxBase1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridListControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.comboBoxBase1); this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.Location = new System.Drawing.Point(106, 64); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(459, 56); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "ComboBoxBase"; // // comboBoxBase1 // this.comboBoxBase1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.comboBoxBase1.BackColor = System.Drawing.Color.White; this.comboBoxBase1.BeforeTouchSize = new System.Drawing.Size(427, 21); this.comboBoxBase1.DropDownWidth = 400; this.comboBoxBase1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comboBoxBase1.ListControl = this.gridListControl1; this.comboBoxBase1.Location = new System.Drawing.Point(16, 24); this.comboBoxBase1.Name = "comboBoxBase1"; this.comboBoxBase1.Size = new System.Drawing.Size(427, 21); this.comboBoxBase1.Style = Syncfusion.Windows.Forms.VisualStyle.Metro; this.comboBoxBase1.TabIndex = 0; this.comboBoxBase1.DropDownCloseOnClick += new Syncfusion.Windows.Forms.Tools.MouseClickCancelEventHandler(this.comboBoxBase1_DropDownCloseOnClick); this.comboBoxBase1.DropDown += new System.EventHandler(this.comboBoxBase1_DropDown); this.comboBoxBase1.SelectionChangeCommitted += new System.EventHandler(this.comboBoxBase1_SelectionChangeCommitted); this.comboBoxBase1.TextChanged += new System.EventHandler(this.comboBoxBase1_TextChanged); this.comboBoxBase1.Validating += new System.ComponentModel.CancelEventHandler(this.comboBoxBase1_Validating); this.comboBoxBase1.Validated += new System.EventHandler(this.comboBoxBase1_Validated); // // gridListControl1 // this.gridListControl1.Grid.DpiAware = true; this.gridListControl1.AlphaBlendSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(94)))), ((int)(((byte)(171)))), ((int)(((byte)(222))))); this.gridListControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.gridListControl1.BackColor = System.Drawing.Color.White; this.gridListControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.gridListControl1.DataSource = this.dataSet11.Products; this.gridListControl1.DisplayMember = "ProductName"; this.gridListControl1.ItemHeight = 22; this.gridListControl1.Location = new System.Drawing.Point(-67, -75); this.gridListControl1.MultiColumn = true; this.gridListControl1.Name = "gridListControl1"; this.gridListControl1.Properties.BackgroundColor = System.Drawing.SystemColors.Window; this.gridListControl1.Properties.GridLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(212)))), ((int)(((byte)(212))))); this.gridListControl1.SelectedIndex = -1; this.gridListControl1.Size = new System.Drawing.Size(552, 200); this.gridListControl1.SupportsTransparentBackColor = true; this.gridListControl1.TabIndex = 3; this.gridListControl1.ThemesEnabled = true; this.gridListControl1.TopIndex = 0; this.gridListControl1.ValueMember = "ProductID"; // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("en-US"); this.dataSet11.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.gridListControl1); this.groupBox2.Controls.Add(this.textLog); this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox2.Location = new System.Drawing.Point(106, 228); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(459, 144); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "Event Log"; // // textLog // this.textLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textLog.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textLog.Location = new System.Drawing.Point(3, 18); this.textLog.Multiline = true; this.textLog.Name = "textLog"; this.textLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.textLog.Size = new System.Drawing.Size(453, 123); this.textLog.TabIndex = 0; // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice" + ", UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued FROM Products"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlConnection1 // this.sqlConnection1.ConnectionString = "Network Address=66.135.59.108,49489;initial catalog=NORTHWIND;password=Sync_sampl" + "es;persist security info=True;user id=sa;packet size=4096;Pooling=true"; this.sqlConnection1.FireInfoMessageEventOnUserErrors = false; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = resources.GetString("sqlInsertCommand1.CommandText"); this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@ProductName", System.Data.SqlDbType.NVarChar, 40, "ProductName"), new System.Data.SqlClient.SqlParameter("@SupplierID", System.Data.SqlDbType.Int, 4, "SupplierID"), new System.Data.SqlClient.SqlParameter("@CategoryID", System.Data.SqlDbType.Int, 4, "CategoryID"), new System.Data.SqlClient.SqlParameter("@QuantityPerUnit", System.Data.SqlDbType.NVarChar, 20, "QuantityPerUnit"), new System.Data.SqlClient.SqlParameter("@UnitPrice", System.Data.SqlDbType.Money, 8, "UnitPrice"), new System.Data.SqlClient.SqlParameter("@UnitsInStock", System.Data.SqlDbType.SmallInt, 2, "UnitsInStock"), new System.Data.SqlClient.SqlParameter("@UnitsOnOrder", System.Data.SqlDbType.SmallInt, 2, "UnitsOnOrder"), new System.Data.SqlClient.SqlParameter("@ReorderLevel", System.Data.SqlDbType.SmallInt, 2, "ReorderLevel"), new System.Data.SqlClient.SqlParameter("@Discontinued", System.Data.SqlDbType.Bit, 1, "Discontinued") }); // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = resources.GetString("sqlUpdateCommand1.CommandText"); this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@ProductName", System.Data.SqlDbType.NVarChar, 40, "ProductName"), new System.Data.SqlClient.SqlParameter("@SupplierID", System.Data.SqlDbType.Int, 4, "SupplierID"), new System.Data.SqlClient.SqlParameter("@CategoryID", System.Data.SqlDbType.Int, 4, "CategoryID"), new System.Data.SqlClient.SqlParameter("@QuantityPerUnit", System.Data.SqlDbType.NVarChar, 20, "QuantityPerUnit"), new System.Data.SqlClient.SqlParameter("@UnitPrice", System.Data.SqlDbType.Money, 8, "UnitPrice"), new System.Data.SqlClient.SqlParameter("@UnitsInStock", System.Data.SqlDbType.SmallInt, 2, "UnitsInStock"), new System.Data.SqlClient.SqlParameter("@UnitsOnOrder", System.Data.SqlDbType.SmallInt, 2, "UnitsOnOrder"), new System.Data.SqlClient.SqlParameter("@ReorderLevel", System.Data.SqlDbType.SmallInt, 2, "ReorderLevel"), new System.Data.SqlClient.SqlParameter("@Discontinued", System.Data.SqlDbType.Bit, 1, "Discontinued"), new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_CategoryID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Discontinued", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Discontinued", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ProductName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ProductName", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_QuantityPerUnit", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "QuantityPerUnit", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ReorderLevel", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ReorderLevel", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_SupplierID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "SupplierID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitPrice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitPrice", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitsInStock", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitsInStock", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitsOnOrder", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitsOnOrder", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@ProductID", System.Data.SqlDbType.Int, 4, "ProductID") }); // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = resources.GetString("sqlDeleteCommand1.CommandText"); this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_CategoryID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Discontinued", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Discontinued", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ProductName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ProductName", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_QuantityPerUnit", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "QuantityPerUnit", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_ReorderLevel", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ReorderLevel", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_SupplierID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "SupplierID", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitPrice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitPrice", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitsInStock", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitsInStock", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_UnitsOnOrder", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "UnitsOnOrder", System.Data.DataRowVersion.Original, null) }); // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Products", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("ProductID", "ProductID"), new System.Data.Common.DataColumnMapping("ProductName", "ProductName"), new System.Data.Common.DataColumnMapping("SupplierID", "SupplierID"), new System.Data.Common.DataColumnMapping("CategoryID", "CategoryID"), new System.Data.Common.DataColumnMapping("QuantityPerUnit", "QuantityPerUnit"), new System.Data.Common.DataColumnMapping("UnitPrice", "UnitPrice"), new System.Data.Common.DataColumnMapping("UnitsInStock", "UnitsInStock"), new System.Data.Common.DataColumnMapping("UnitsOnOrder", "UnitsOnOrder"), new System.Data.Common.DataColumnMapping("ReorderLevel", "ReorderLevel"), new System.Data.Common.DataColumnMapping("Discontinued", "Discontinued") }) }); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(687, 464); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox2); this.MinimumSize = new System.Drawing.Size(600, 400); this.Name = "Form1"; this.Text = "&"; this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.comboBoxBase1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridListControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.LineItem object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <PetShop.Business.LineItem> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "LineItem"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("OrderId", typeof(int)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("LineNum", typeof(int)); col1.AllowDBNull = false; DataColumn col2 = dataTable.Columns.Add("ItemId", typeof(string)); col2.AllowDBNull = false; DataColumn col3 = dataTable.Columns.Add("Quantity", typeof(int)); col3.AllowDBNull = false; DataColumn col4 = dataTable.Columns.Add("UnitPrice", typeof(decimal)); col4.AllowDBNull = false; bulkCopy.ColumnMappings.Add("OrderId", "OrderId"); bulkCopy.ColumnMappings.Add("LineNum", "LineNum"); bulkCopy.ColumnMappings.Add("ItemId", "ItemId"); bulkCopy.ColumnMappings.Add("Quantity", "Quantity"); bulkCopy.ColumnMappings.Add("UnitPrice", "UnitPrice"); foreach (PetShop.Business.LineItem entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["OrderId"] = entity.OrderId; row["LineNum"] = entity.LineNum; row["ItemId"] = entity.ItemId; row["Quantity"] = entity.Quantity; row["UnitPrice"] = entity.UnitPrice; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (PetShop.Business.LineItem entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
private DbConnection GetProfiledConnection() { var dbConnection = new System.Data.SqlClient.SqlConnection(ConfigurationProvider.Get("ConnectionStrings:AcademicoRDS")); return(new StackExchange.Profiling.Data.ProfiledDbConnection(dbConnection, MiniProfiler.Current)); }
void ReloadTime_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime startLoad = DateTime.Now; System.Xml.XmlDocument mv_schema_xml_temp = new System.Xml.XmlDocument(); System.Xml.XmlDocument import_attribute_flow_xml_temp = new System.Xml.XmlDocument(); System.Data.DataTable mms_management_agent_temp = new System.Data.DataTable("mms_metaverse_multivalue"); System.Data.DataTable mms_metaverse_temp = new System.Data.DataTable("mms_metaverse"); System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings["FIMSynchronizationService"]); connection.Open(); //Load XML schema //mv_schema_xml System.Data.SqlClient.SqlCommand SqlCommand = new System.Data.SqlClient.SqlCommand("select mv_schema_xml from mms_server_configuration (nolock)", connection); System.Xml.XmlReader XmlReader = SqlCommand.ExecuteXmlReader(); mv_schema_xml_temp.Load(XmlReader); XmlReader.Dispose(); SqlCommand.Dispose(); //import_attribute_flow_xml SqlCommand = new System.Data.SqlClient.SqlCommand("select import_attribute_flow_xml from mms_server_configuration (nolock)", connection); XmlReader = SqlCommand.ExecuteXmlReader(); import_attribute_flow_xml_temp.Load(XmlReader); XmlReader.Dispose(); SqlCommand.Dispose(); // ////Load Tabell schema //SqlCommand = new System.Data.SqlClient.SqlCommand("select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'mms_metaverse'", connection); //System.Data.DataTable INFORMATION_SCHEMA = new System.Data.DataTable("INFORMATION_SCHEMA"); //System.Data.SqlClient.SqlDataAdapter DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand); //int count = DataAdapter.Fill(INFORMATION_SCHEMA); //DataAdapter.Dispose(); //SqlCommand.Dispose(); System.Data.SqlClient.SqlDataAdapter DataAdapter; int count; //Load mms_metaverse attributes SqlCommand = new System.Data.SqlClient.SqlCommand("select top 1 * from mms_metaverse (nolock)", connection); DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand); count = DataAdapter.Fill(mms_metaverse_temp); DataAdapter.Dispose(); SqlCommand.Dispose(); //Load mms_management_agent SqlCommand = new System.Data.SqlClient.SqlCommand("select * from mms_management_agent (nolock)", connection); DataAdapter = new System.Data.SqlClient.SqlDataAdapter(SqlCommand); count = DataAdapter.Fill(mms_management_agent_temp); DataAdapter.Dispose(); SqlCommand.Dispose(); connection.Close(); connection.Dispose(); mv_schema_xml = mv_schema_xml_temp; import_attribute_flow_xml = import_attribute_flow_xml_temp; //mms_management_agent Dictionary <Guid, LD.IdentityManagement.API.Models.managementagent> Schema_managementagent_temp = new Dictionary <Guid, LD.IdentityManagement.API.Models.managementagent>(); foreach (DataRow row in mms_management_agent_temp.Rows) { LD.IdentityManagement.API.Models.managementagent ma = new LD.IdentityManagement.API.Models.managementagent(); ma.name = (string)row["ma_name"]; ma.guid = (Guid)row["ma_id"]; ma.description = (string)row["ma_description"]; ma.type = (string)row["ma_type"]; Schema_managementagent_temp.Add(ma.guid, ma); //import-flow foreach (System.Xml.XmlNodeList flowrule in import_attribute_flow_xml.SelectNodes(string.Format("/import-attribute-flow/import-flow-set/import-flows/import-flow[@src-ma='{0}']", ma.guid))) { flowObject temp = new flowObject() { type = "", mvclassobjectname = "", csclassobjectname = "", attribute = new flowAttribute[0] }; } } Schema_managementagent = Schema_managementagent_temp; System.Xml.XmlNamespaceManager ns = new System.Xml.XmlNamespaceManager(mv_schema_xml.NameTable); ns.AddNamespace("dsml", "http://www.dsml.org/DSML"); //Create Schema Attributes list Dictionary <string, LD.IdentityManagement.API.Models.Attribute> Schema_Attributes_temp = new Dictionary <string, LD.IdentityManagement.API.Models.Attribute>(); Dictionary <string, LD.IdentityManagement.API.Models.Attribute> Schema_Private_Attributes_temp = new Dictionary <string, LD.IdentityManagement.API.Models.Attribute>(); foreach (System.Xml.XmlNode Node in mv_schema_xml.SelectNodes("dsml:dsml/dsml:directory-schema/dsml:attribute-type", ns)) { LD.IdentityManagement.API.Models.Attribute NewAttribute = new LD.IdentityManagement.API.Models.Attribute(); NewAttribute.name = Node["dsml:name"].InnerText.ToLower(); NewAttribute.mulitvalue = Node.Attributes["single-value"] != null ? false : true; NewAttribute.indexable = Node.Attributes["ms-dsml:indexable"] == null || Node.Attributes["ms-dsml:indexable"].Value == "false" ? false : true; NewAttribute.indexed = Node.Attributes["ms-dsml:indexed"] == null || Node.Attributes["ms-dsml:indexed"].Value == "false" ? false : true; NewAttribute.syntax = Node["dsml:syntax"].InnerText; //syntax to type switch (NewAttribute.syntax) { case "1.3.6.1.4.1.1466.115.121.1.5": //Binary NewAttribute.type = typeof(byte[]); break; case "1.3.6.1.4.1.1466.115.121.1.7": //Boolean NewAttribute.type = typeof(bool); break; case "1.3.6.1.4.1.1466.115.121.1.12": //DN (string) NewAttribute.type = typeof(string); break; case "1.3.6.1.4.1.1466.115.121.1.15": //DirectoryString NewAttribute.type = typeof(string); break; case "1.3.6.1.4.1.1466.115.121.1.27": //Integer NewAttribute.type = typeof(int); break; default: //NewAttribute.type = typeof(string); break; } if (!Schema_private.Contains(NewAttribute.name)) { if (NewAttribute.mulitvalue || mms_metaverse_temp.Columns.Contains(NewAttribute.name)) { //logger.Debug("{0} {1}", NewAttribute.name, NewAttribute.mulitvalue); Schema_Attributes_temp.Add(NewAttribute.name, NewAttribute); } } else { Schema_Private_Attributes_temp.Add(NewAttribute.name, NewAttribute); } } Schema_Attributes = Schema_Attributes_temp; Schema_Private_Attributes = Schema_Private_Attributes_temp; //Create Schema Object list Dictionary <string, LD.IdentityManagement.API.Models.classobject> Schema_Object_temp = new Dictionary <string, LD.IdentityManagement.API.Models.classobject>(); foreach (System.Xml.XmlNode Node in mv_schema_xml.SelectNodes("dsml:dsml/dsml:directory-schema/dsml:class", ns)) { LD.IdentityManagement.API.Models.classobject newClassObject = new LD.IdentityManagement.API.Models.classobject(); newClassObject.name = Node["dsml:name"].InnerText.ToLower(); List <LD.IdentityManagement.API.Models.objectattribute> ObjectAttributeList = new List <LD.IdentityManagement.API.Models.objectattribute>(); foreach (System.Xml.XmlNode attributeNodes in Node.SelectNodes("dsml:attribute", ns)) { LD.IdentityManagement.API.Models.objectattribute NewObjectAttribute = new LD.IdentityManagement.API.Models.objectattribute(); NewObjectAttribute.required = attributeNodes.Attributes["required"].Value == "true" ? true : false; LD.IdentityManagement.API.Models.Attribute Attribute; string attname = attributeNodes.Attributes["ref"].Value.Substring(1); if (Schema_Attributes.TryGetValue(attname, out Attribute) || Schema_Private_Attributes.TryGetValue(attname, out Attribute)) { NewObjectAttribute.attribute = Attribute; ObjectAttributeList.Add(NewObjectAttribute); } } newClassObject.objectattributes = ObjectAttributeList.ToArray(); Schema_Object_temp.Add(newClassObject.name, newClassObject); } Schema_Object = Schema_Object_temp; TimeSpan time = DateTime.Now - startLoad; ReloadTime.Enabled = true; }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the EmployeeDB.BLL.Employee object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <EmployeeDB.BLL.Employee> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "Employee"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("EmployeeId", typeof(System.Int32)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("EmployeeCode", typeof(System.String)); col1.AllowDBNull = true; DataColumn col2 = dataTable.Columns.Add("FullName", typeof(System.String)); col2.AllowDBNull = true; DataColumn col3 = dataTable.Columns.Add("FirstName", typeof(System.String)); col3.AllowDBNull = true; DataColumn col4 = dataTable.Columns.Add("MiddlesName", typeof(System.String)); col4.AllowDBNull = true; DataColumn col5 = dataTable.Columns.Add("LastName", typeof(System.String)); col5.AllowDBNull = true; DataColumn col6 = dataTable.Columns.Add("DOB", typeof(System.DateTime)); col6.AllowDBNull = true; DataColumn col7 = dataTable.Columns.Add("Email", typeof(System.String)); col7.AllowDBNull = true; DataColumn col8 = dataTable.Columns.Add("Bio", typeof(System.String)); col8.AllowDBNull = true; DataColumn col9 = dataTable.Columns.Add("CreatedOn", typeof(System.DateTime)); col9.AllowDBNull = true; bulkCopy.ColumnMappings.Add("EmployeeId", "EmployeeId"); bulkCopy.ColumnMappings.Add("EmployeeCode", "EmployeeCode"); bulkCopy.ColumnMappings.Add("FullName", "FullName"); bulkCopy.ColumnMappings.Add("FirstName", "FirstName"); bulkCopy.ColumnMappings.Add("MiddlesName", "MiddlesName"); bulkCopy.ColumnMappings.Add("LastName", "LastName"); bulkCopy.ColumnMappings.Add("DOB", "DOB"); bulkCopy.ColumnMappings.Add("Email", "Email"); bulkCopy.ColumnMappings.Add("Bio", "Bio"); bulkCopy.ColumnMappings.Add("CreatedOn", "CreatedOn"); foreach (EmployeeDB.BLL.Employee entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["EmployeeId"] = entity.EmployeeId; row["EmployeeCode"] = entity.EmployeeCode; row["FullName"] = entity.FullName; row["FirstName"] = entity.FirstName; row["MiddlesName"] = entity.MiddlesName; row["LastName"] = entity.LastName; row["DOB"] = entity.DOB.HasValue ? (object)entity.DOB : System.DBNull.Value; row["Email"] = entity.Email; row["Bio"] = entity.Bio; row["CreatedOn"] = entity.CreatedOn.HasValue ? (object)entity.CreatedOn : System.DBNull.Value; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (EmployeeDB.BLL.Employee entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.authorsDataSet1 = new AdoNetTest.DataBinding.AuthorsDataSet(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.btnBack = new System.Windows.Forms.Button(); this.btnNext = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.authorsDataSet1)).BeginInit(); this.SuspendLayout(); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM" + " authors"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = @"INSERT INTO authors(au_id, au_lname, au_fname, phone, address, city, state, zip, contract) VALUES (@au_id, @au_lname, @au_fname, @phone, @address, @city, @state, @zip, @contract); SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors WHERE (au_id = @au_id)"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@phone", System.Data.SqlDbType.VarChar, 12, "phone")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@address", System.Data.SqlDbType.VarChar, 40, "address")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zip", System.Data.SqlDbType.VarChar, 5, "zip")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@contract", System.Data.SqlDbType.Bit, 1, "contract")); // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = @"UPDATE authors SET au_id = @au_id, au_lname = @au_lname, au_fname = @au_fname, phone = @phone, address = @address, city = @city, state = @state, zip = @zip, contract = @contract WHERE (au_id = @Original_au_id) AND (address = @Original_address OR @Original_address IS NULL AND address IS NULL) AND (au_fname = @Original_au_fname) AND (au_lname = @Original_au_lname) AND (city = @Original_city OR @Original_city IS NULL AND city IS NULL) AND (contract = @Original_contract) AND (phone = @Original_phone) AND (state = @Original_state OR @Original_state IS NULL AND state IS NULL) AND (zip = @Original_zip OR @Original_zip IS NULL AND zip IS NULL); SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors WHERE (au_id = @au_id)"; this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@phone", System.Data.SqlDbType.VarChar, 12, "phone")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@address", System.Data.SqlDbType.VarChar, 40, "address")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zip", System.Data.SqlDbType.VarChar, 5, "zip")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@contract", System.Data.SqlDbType.Bit, 1, "contract")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_id", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_address", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "address", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_fname", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_lname", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "city", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_contract", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "contract", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_phone", System.Data.SqlDbType.VarChar, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "phone", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "state", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_zip", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "zip", System.Data.DataRowVersion.Original, null)); // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = @"DELETE FROM authors WHERE (au_id = @Original_au_id) AND (address = @Original_address OR @Original_address IS NULL AND address IS NULL) AND (au_fname = @Original_au_fname) AND (au_lname = @Original_au_lname) AND (city = @Original_city OR @Original_city IS NULL AND city IS NULL) AND (contract = @Original_contract) AND (phone = @Original_phone) AND (state = @Original_state OR @Original_state IS NULL AND state IS NULL) AND (zip = @Original_zip OR @Original_zip IS NULL AND zip IS NULL)"; this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_id", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_address", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "address", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_fname", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_lname", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "city", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_contract", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "contract", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_phone", System.Data.SqlDbType.VarChar, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "phone", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "state", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_zip", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "zip", System.Data.DataRowVersion.Original, null)); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id=INWORXDEV;packet size=4096;integrated security=SSPI;data source=IN" + "WORXDEV;persist security info=True;initial catalog=pubs"; this.sqlConnection1.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(this.sqlConnection1_InfoMessage); // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "authors", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("au_id", "au_id"), new System.Data.Common.DataColumnMapping("au_lname", "au_lname"), new System.Data.Common.DataColumnMapping("au_fname", "au_fname"), new System.Data.Common.DataColumnMapping("phone", "phone"), new System.Data.Common.DataColumnMapping("address", "address"), new System.Data.Common.DataColumnMapping("city", "city"), new System.Data.Common.DataColumnMapping("state", "state"), new System.Data.Common.DataColumnMapping("zip", "zip"), new System.Data.Common.DataColumnMapping("contract", "contract") }) }); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; this.sqlDataAdapter1.RowUpdated += new System.Data.SqlClient.SqlRowUpdatedEventHandler(this.sqlDataAdapter1_RowUpdated); // // authorsDataSet1 // this.authorsDataSet1.DataSetName = "AuthorsDataSet"; this.authorsDataSet1.Locale = new System.Globalization.CultureInfo("es-AR"); // // textBox1 // this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.authorsDataSet1, "authors.au_lname")); this.textBox1.Location = new System.Drawing.Point(48, 32); this.textBox1.Name = "textBox1"; this.textBox1.TabIndex = 0; this.textBox1.Text = "textBox1"; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(56, 72); this.textBox2.Name = "textBox2"; this.textBox2.TabIndex = 1; this.textBox2.Text = "textBox2"; // // btnBack // this.btnBack.Location = new System.Drawing.Point(48, 120); this.btnBack.Name = "btnBack"; this.btnBack.TabIndex = 2; this.btnBack.Text = "<"; this.btnBack.Click += new System.EventHandler(this.btnBack_Click); // // btnNext // this.btnNext.Location = new System.Drawing.Point(128, 120); this.btnNext.Name = "btnNext"; this.btnNext.TabIndex = 3; this.btnNext.Text = ">"; this.btnNext.Click += new System.EventHandler(this.btnNext_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.btnNext); this.Controls.Add(this.btnBack); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.authorsDataSet1)).EndInit(); this.ResumeLayout(false); }
public Stream printer(string printerId, string parameters) { var request = WebOperationContext.Current.IncomingRequest; var headers = request.Headers; var JSONString = string.Empty; try { //var httpToken = headers["Authorization"].Trim().Replace("Bearer ", ""); //using (SecureData sd = new SecureData(false, httpToken)) //{ using (var connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["Oraculus"].ConnectionString)) { connection.Open(); var dt = new DataTable(); var command = new System.Data.SqlClient.SqlCommand("select PrinterId, rtrim(PrinterName) as PrinterPath, PrinterResolution, rtrim(PrinterMethod) as PrinterMethod from printers where PrinterId = " + int.Parse(printerId), connection); var da = new System.Data.SqlClient.SqlDataAdapter(command); da.Fill(dt); if (dt.Rows.Count > 0) { var dtr = dt.Rows[0]; var printerPath = dtr.Field <string>("PrinterPath"); var printerMethod = dtr.Field <string>("PrinterMethod"); if (string.IsNullOrEmpty(parameters)) { parameters = "^XA\r\n^LH20,20 ^BY2,3\r\n^FO40,10 ^BXN,8,200 ^FD280810^FS\r\n^FO10,5 ^ADR,18^FD280810^FS\r\n^FO175,10 ^ADR,18^FDCOL Number^FS\r\n^FO200,5 ^ADR,18^FDCIP 460630^FS\r\n^LH20,110\r\n^FO130,10 ^ADR,18 ^FDCultvrname ^FS\r\n^FO100,10 ^ADR,18 ^FDCultvrname ^FS\r\n^FO70,10 ^ADR,18 ^FDTypeCrossName^FS\r\n^FO40,10 ^ADR,18 ^FD2017^FS\r\n^FO40,85 ^ADR,18 ^FDSPP ^FS\r\n^XZ"; } JSONString = JsonConvert.SerializeObject(dt, Formatting.Indented); if (printerMethod.Equals("Shared")) { var FILE_NAME = System.Web.Hosting.HostingEnvironment.MapPath("~/ZPLII.txt"); //var directory = System.Web.Hosting.HostingEnvironment.MapPath("~/uploads/logs"); //File.Create(FILE_NAME.Replace("ZPLII","ZPL2")); File.WriteAllText(FILE_NAME, parameters); File.Copy(FILE_NAME, printerPath); } else if (printerMethod.Equals("IP")) { const int port = 9100; using (System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient()) { client.Connect(printerPath, port); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream())) { writer.Write(parameters); } } } } da.Dispose(); connection.Close(); } //} } catch (Exception e) { WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.InternalServerError; //500 JSONString = JsonConvert.SerializeObject(e.Message); } WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(Encoding.UTF8.GetBytes(JSONString))); }
/// <summary> /// Lets you efficiently bulk insert many entities to the database. /// </summary> /// <param name="transactionManager">The transaction manager.</param> /// <param name="entities">The entities.</param> /// <remarks> /// After inserting into the datasource, the Nettiers.AdventureWorks.Entities.TestIssue117Tablea object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> public override void BulkInsert(TransactionManager transactionManager, TList <Nettiers.AdventureWorks.Entities.TestIssue117Tablea> entities) { //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); System.Data.SqlClient.SqlBulkCopy bulkCopy = null; if (transactionManager != null && transactionManager.IsOpen) { System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection; System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction; bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null); } else { bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null); } bulkCopy.BulkCopyTimeout = 360; bulkCopy.DestinationTableName = "TestIssue117TableA"; DataTable dataTable = new DataTable(); DataColumn col0 = dataTable.Columns.Add("TestIssue117TableAId", typeof(System.Int32)); col0.AllowDBNull = false; DataColumn col1 = dataTable.Columns.Add("DumbField", typeof(System.Boolean)); col1.AllowDBNull = true; bulkCopy.ColumnMappings.Add("TestIssue117TableAId", "TestIssue117TableAId"); bulkCopy.ColumnMappings.Add("DumbField", "DumbField"); foreach (Nettiers.AdventureWorks.Entities.TestIssue117Tablea entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } DataRow row = dataTable.NewRow(); row["TestIssue117TableAId"] = entity.TestIssue117TableAid; row["DumbField"] = entity.DumbField.HasValue ? (object)entity.DumbField : System.DBNull.Value; dataTable.Rows.Add(row); } // send the data to the server bulkCopy.WriteToServer(dataTable); // update back the state foreach (Nettiers.AdventureWorks.Entities.TestIssue117Tablea entity in entities) { if (entity.EntityState != EntityState.Added) { continue; } entity.AcceptChanges(); } }
public object Execute(object param) { try { Dictionary<string, object> paramMap = param as Dictionary<string, object>; if (paramMap == null || paramMap.Count < 1) { throw (new Exception("No parameter in SetDrawerDAO!")); } try { DataSet ds = paramMap["DataSet"] as DataSet; object objSign = ds.Tables[0].Rows[0]["DrawerSign"]; string strTakeFilmDept = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmDept"]); string strTakeFilmRegion = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmRegion"]); string strTakeFilmComment = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmComment"]); //object objReportTextApprovedSign = ds.Tables[0].Rows[0]["ReportTextApprovedSign"]; //object objReportTextSubmittedSign = ds.Tables[0].Rows[0]["ReportTextSubmittedSign"]; //object objCombinedForCertification = ds.Tables[0].Rows[0]["CombinedForCertification"]; //object objSignCombinedForCertification = ds.Tables[0].Rows[0]["SignCombinedForCertification"]; using (RisDAL oKodak = new RisDAL()) { using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(oKodak.ConnectionString)) { conn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.CommandTimeout = 0; cmd.Connection = conn; foreach (DataRow dr in ds.Tables[0].Rows) { string strReportGuid = Convert.ToString(dr["ReportGuid"]); cmd.CommandText = string.Format( "update tReport set IsDraw=" + ((objSign is System.DBNull) ? "0" : "1") + ",TakeFilmDept=@dept," + " TakeFilmRegion=@region,TakeFilmComment=@comments," + " DrawerSign=@file,DrawTime=getdate() " + " where ReportGuid='{0}'", strReportGuid); cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@dept", strTakeFilmDept); cmd.Parameters.AddWithValue("@region", strTakeFilmRegion); cmd.Parameters.AddWithValue("@comments", strTakeFilmComment); //cmd.Parameters.AddWithValue("@file", objSign); cmd.Parameters.Add("@file", SqlDbType.VarBinary, -1); cmd.Parameters["@file"].Value = (objSign is System.DBNull) ? System.DBNull.Value : objSign; cmd.ExecuteNonQuery(); //cmd.CommandText = string.Format("update tReport set " // + " ReportTextApprovedSign=@objReportTextApprovedSign" // + " where ReportGuid='{0}'", strReportGuid); //cmd.Parameters.Add("@objReportTextApprovedSign", SqlDbType.VarBinary, -1); //cmd.Parameters["@objReportTextApprovedSign"].Value // = (objReportTextApprovedSign is System.DBNull) ? System.DBNull.Value : objReportTextApprovedSign; //cmd.ExecuteNonQuery(); //cmd.CommandText = string.Format("update tReport set " // + " ReportTextSubmittedSign=@objReportTextSubmittedSign" // + " where ReportGuid='{0}'", strReportGuid); //cmd.Parameters.Add("@objReportTextSubmittedSign", SqlDbType.VarBinary, -1); //cmd.Parameters["@objReportTextSubmittedSign"].Value // = (objReportTextSubmittedSign is System.DBNull) ? System.DBNull.Value : objReportTextSubmittedSign; //cmd.ExecuteNonQuery(); //cmd.CommandText = string.Format("update tReport set " // + " CombinedForCertification=@objCombinedForCertification" // + " where ReportGuid='{0}'", strReportGuid); //cmd.Parameters.Add("@objCombinedForCertification", SqlDbType.VarBinary, -1); //cmd.Parameters["@objCombinedForCertification"].Value // = (objCombinedForCertification is System.DBNull) ? System.DBNull.Value : objCombinedForCertification; //cmd.ExecuteNonQuery(); //cmd.CommandText = string.Format("update tReport set " // + " SignCombinedForCertification=@objSignCombinedForCertification" // + " where ReportGuid='{0}'", strReportGuid); //cmd.Parameters.Add("@objSignCombinedForCertification", SqlDbType.VarBinary, -1); //cmd.Parameters["@objSignCombinedForCertification"].Value // = (objSignCombinedForCertification is System.DBNull) ? System.DBNull.Value : objSignCombinedForCertification; //cmd.ExecuteNonQuery(); //Send to gateway eventtype=34 tagReportInfo rptInfo = ServerPubFun.GetReportInfo(strReportGuid); string strSql = OnDeliverReport(rptInfo); if (strSql != null && strSql.Trim().Length > 0) { cmd.Parameters.Clear(); cmd.CommandText = strSql; cmd.ExecuteNonQuery(); } } } } } catch (Exception ex) { //dal.RollbackTransaction(); System.Diagnostics.Debug.Assert(false, ex.Message); ServerPubFun.RISLog_Error(0, "SetDrawerDAO=" + ex.Message, (new System.Diagnostics.StackFrame()).GetFileName(), (new System.Diagnostics.StackFrame()).GetFileLineNumber()); throw (ex); } } catch (Exception ex) { System.Diagnostics.Debug.Assert(false, ex.Message); ServerPubFun.RISLog_Error(0, "SetDrawerDAO=" + ex.Message, (new System.Diagnostics.StackFrame()).GetFileName(), (new System.Diagnostics.StackFrame()).GetFileLineNumber()); return false; } return true; }
public async Task <Guid> Insert(BuyerInfo model) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(_options.Value.DefaultConnection)) { var sql = "dbo.InsertPerson"; var param = new DynamicParameters(); param.Add("@Name", model.Name); param.Add("@Address", model.Address); param.Add("@Id", null, DbType.Guid, ParameterDirection.Output); var sql2 = $"dbo.InsertUnit"; var param2 = new DynamicParameters(); param2.Add("@ProjectName", model.ProjectName); param2.Add("@CondoUnit", model.CondoUnit); param2.Add("@LoanAmount", model.LoanAmount); param2.Add("@Term", model.Term); param2.Add("@StartOfPayment", model.StartOfPayment); param2.Add("@InterestRate", model.InterestRate); param2.Add("@Id", null, DbType.Guid, ParameterDirection.Output); connection.Open(); using (var trans = connection.BeginTransaction()) { try { // insert Person await connection.ExecuteAsync(sql, param, trans, commandType : CommandType.StoredProcedure).ConfigureAwait(false); var personId = param.Get <Guid>("@Id"); // insert Unit await connection.ExecuteAsync(sql2, param2, trans, commandType : CommandType.StoredProcedure).ConfigureAwait(false); var unitId = param2.Get <Guid>("@Id"); // setup PersonUnit var sql3 = $"dbo.InsertPersonUnit"; var param3 = new DynamicParameters(); param3.Add("@PersonId", personId); param3.Add("@UnitId", unitId); param3.Add("@Id", null, DbType.Guid, ParameterDirection.Output); // insert PersonUnit await connection.ExecuteAsync(sql3, param3, trans, commandType : CommandType.StoredProcedure).ConfigureAwait(false); var result = param3.Get <Guid>("@Id"); trans.Commit(); return(result); } catch (Exception) { trans.Rollback(); } } return(Guid.Empty); } }