//SendFromLocalToAccess public static EJackPanelWeekCell SelectByXCode(Guid XCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; SqlConnection connection = new SqlConnection(Atend.Control.ConnectionString.LocalcnString); SqlCommand command = new SqlCommand("E_JackPanelWeekCell_SelectByXCode", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("iXCode", XCode)); connection.Open(); SqlDataReader reader = command.ExecuteReader(); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekXCode = new Guid(reader["JackPanelWeekXCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); jpwc.XCode = new Guid(reader["XCode"].ToString()); //ed.WriteMessage("Cell Only aws found \n"); } else { jpwc.Code = -1; } reader.Close(); connection.Close(); return(jpwc); }
//ASHKTORAB public static EJackPanelWeekCell SelectByCodeForServer(int Code) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; SqlConnection connection = new SqlConnection(Atend.Control.ConnectionString.ServercnString); connection.Open(); SqlCommand command = new SqlCommand("E_JackPanelWeekCell_Select", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("iCode", Code)); //command.Transaction = sqlTransaction; SqlDataReader reader = command.ExecuteReader(); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); //jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekCode = Convert.ToInt32(reader["JackPanelWeekCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); ed.WriteMessage("\nhhhhh\n"); jpwc.XCode = new Guid(reader["XCode"].ToString()); ed.WriteMessage("\nbbbbb\n"); } reader.Close(); connection.Close(); return(jpwc); }
//MEDHAT //ShareOnServer public static EJackPanelWeekCell ServerSelectByCode(int Code, SqlConnection ServerConnection, SqlTransaction ServerTransaction) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; SqlConnection connection = ServerConnection; SqlCommand command = new SqlCommand("E_JackPanelWeekCell_Select", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("iCode", Code)); command.Transaction = ServerTransaction; SqlDataReader reader = command.ExecuteReader(); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekCode = Convert.ToInt32(reader["JackPanelWeekCode"].ToString()); //jpwc.JackPanelWeekXCode = new Guid(reader["JackPanelWeekXCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); jpwc.XCode = new Guid(reader["XCode"].ToString()); } else { jpwc.Code = -1; ed.WriteMessage("ServerSelectByCode found no row in : jack panel cell\n"); } reader.Close(); return(jpwc); }
//ASHKTORAB public static EJackPanelWeekCell ServerSelectByXCode(SqlTransaction sqlTransaction, SqlConnection _connection, Guid XCode) { SqlConnection connection = _connection;// new SqlConnection(Atend.Control.ConnectionString.cnString); SqlCommand command = new SqlCommand("E_JackPanelWeekCell_SelectByXCode", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("iXCode", XCode)); command.Transaction = sqlTransaction; SqlDataReader reader = command.ExecuteReader(); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekXCode = new Guid(reader["JackPanelWeekXCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); jpwc.XCode = new Guid(reader["XCode"].ToString()); } reader.Close(); return(jpwc); }
//MOUSAVI public static EJackPanelWeekCell AccessSelectByXCode(Guid XCode, OleDbTransaction _transaction, OleDbConnection _connection) { OleDbConnection connection = _connection; OleDbCommand command = new OleDbCommand("E_JackPanelWeekCell_SelectByXCode", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new OleDbParameter("iXCode", XCode)); command.Transaction = _transaction; OleDbDataReader reader = command.ExecuteReader(); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekXCode = new Guid(reader["JackPanelWeekXCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); jpwc.XCode = new Guid(reader["XCode"].ToString()); } else { jpwc.Code = -1; } reader.Close(); return(jpwc); }
public static EJackPanelWeekCell SelectByCodeForLocal(int Code, SqlTransaction LocalTransaction, SqlConnection LocalConnection) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; SqlConnection connection = LocalConnection; SqlCommand command = new SqlCommand("E_JackPanelWeekCell_SelectByXCode", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("iCode", Code)); EJackPanelWeekCell jpwc = new EJackPanelWeekCell(); try { command.Transaction = LocalTransaction; SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { jpwc.Code = Convert.ToInt32(reader["Code"].ToString()); jpwc.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString()); jpwc.IsNightLight = Convert.ToBoolean(reader["IsNightLight"].ToString()); jpwc.JackPanelWeekCode = 0; jpwc.JackPanelWeekXCode = new Guid(reader["JackPanelWeekXCode"].ToString()); jpwc.Num = Convert.ToInt32(reader["Num"].ToString()); jpwc.XCode = new Guid(reader["XCode"].ToString()); //ed.WriteMessage("Cell Only aws found \n"); } else { jpwc.Code = -1; } reader.Close(); } catch (Exception ex) { //Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; ed.WriteMessage("Error EJackPanelWeekCell.In SelectByCode4Design.TransAction:{0}\n", ex.Message); } return(jpwc); }