public bool EditTaskEntryData(TaskEntryData ted, TaskCodeNameData tcnd, int entryID) { ted.TaskEntryID = entryID; ted.TaskCode = tcnd.TaskCode; ted.TaskName = tcnd.TaskName; ted.CostType = ""; ted.OfficeCode = tcnd.OfficeCode; ted.Department = tcnd.Department; TaskIndData tid = new TaskIndData(); tid = tid.SelectTaskIndData(tcnd.TaskCode); ted.LeaderMCode = tid.LeaderMCode; TaskData td = new TaskData(); td = td.SelectTaskData(tid.TaskID); ted.PartnerCode = td.PartnerCode; ted.SalesMCode = td.SalesMCode; ted.ContractDate = td.IssueDate; ted.StartDate = td.StartDate; ted.EndDate = td.EndDate; ted.TaskID = td.TaskID; ted.TaskIndID = tid.TaskIndID; PartnersData pd = new PartnersData(); ted.PartnerName = pd.SelectPartnerName(td.PartnerCode); ted.TaskPlace = string.IsNullOrEmpty(td.TaskPlace) ? "" : td.TaskPlace; return(true); }
public bool UpdateTaskEntryData(TaskEntryData ted) { if (ted == null) { return(false); } using (TransactionScope tran = new TransactionScope()) using (SqlConnection conn = new SqlConnection(ConnectionString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand(updSql, conn); cmd = addSqlDbType(cmd); cmd = addValue(cmd, ted); if (TryExecute(conn, cmd) < 0) { return(false); } } catch (SqlException sqle) { MessageBox.Show("SQLエラー errorno " + Convert.ToString(sqle.Number) + " " + sqle.Message); conn.Close(); return(false); } conn.Close(); tran.Complete(); } return(true); }
public int InsertTaskEntryData(TaskEntryData ted) { if (ted == null) { return(-1); } Int32 newProdID = -1; using (TransactionScope tran = new TransactionScope()) using (SqlConnection conn = new SqlConnection(ConnectionString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand(insSql, conn); cmd = addSqlDbType(cmd); cmd = addValue(cmd, ted); newProdID = TryExScalar(conn, cmd); } catch (SqlException sqle) { MessageBox.Show("SQLエラー errorno " + Convert.ToString(sqle.Number) + " " + sqle.Message); conn.Close(); return(-1); } conn.Close(); tran.Complete(); } return(( int )newProdID); }
//public string OfficeName { get; set; } //public string DepartName { get; set; } //public int EstimateID { get; set; } //--------------------------------------------------------// // Method //--------------------------------------------------------// i public object Clone() { TaskEntryData cloneData = new TaskEntryData(); cloneData.TaskEntryID = this.TaskEntryID; cloneData.TaskCode = this.TaskCode; cloneData.TaskName = this.TaskName; cloneData.TaskPlace = this.TaskPlace; cloneData.CostType = this.CostType; cloneData.PartnerCode = this.PartnerCode; cloneData.OfficeCode = this.OfficeCode; cloneData.Department = this.Department; cloneData.LeaderMCode = this.LeaderMCode; cloneData.SalesMCode = this.SalesMCode; cloneData.ContractDate = this.ContractDate; cloneData.StartDate = this.StartDate; cloneData.EndDate = this.EndDate; cloneData.TaskID = this.TaskID; cloneData.TaskIndID = this.TaskIndID; cloneData.Publisher = this.Publisher; cloneData.PartnerName = this.PartnerName; cloneData.OfficeName = this.OfficeName; cloneData.DepartName = this.DepartName; //cloneData.EstimateID = this.EstimateID; return(cloneData); }
public TaskEntryData SelectTaskEntryData(int taskEntryID) { TaskEntryData ted = new TaskEntryData(); SqlHandling sh = new SqlHandling("D_TaskEntry"); DataTable dt = sh.SelectAllData("WHERE TaskEntryID = " + taskEntryID); if (dt == null || dt.Rows.Count < 1) { return(null); } ted = new TaskEntryData(dt.Rows[0]); return(ted); }
public TaskEntryData[] SelectTaskEntryData(string param) { SqlHandling sh = new SqlHandling("D_TaskEntry"); DataTable dt = sh.SelectAllData(param); if (dt == null || dt.Rows.Count < 1) { return(null); } TaskEntryData[] tedA = new TaskEntryData[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { tedA[i] = new TaskEntryData(dt.Rows[i]); } return(tedA); }
private SqlCommand addValue(SqlCommand cmd, TaskEntryData ted) { cmd.Parameters["@tEID"].Value = ted.TaskEntryID; cmd.Parameters["@tNam"].Value = ted.TaskName; cmd.Parameters["@tPla"].Value = ted.TaskPlace; cmd.Parameters["@pCod"].Value = ted.PartnerCode; cmd.Parameters["@oCod"].Value = ted.OfficeCode; cmd.Parameters["@dept"].Value = ted.Department; cmd.Parameters["@cTyp"].Value = ted.CostType; cmd.Parameters["@tCod"].Value = ted.TaskCode; cmd.Parameters["@lCod"].Value = ted.LeaderMCode; cmd.Parameters["@sCod"].Value = ted.SalesMCode; cmd.Parameters["@cDat"].Value = ted.ContractDate; cmd.Parameters["@sDat"].Value = ted.StartDate; cmd.Parameters["@eDat"].Value = ted.EndDate; cmd.Parameters["@tID"].Value = ted.TaskID; cmd.Parameters["@tIID"].Value = ted.TaskIndID; return(cmd); }
public Calculation(TaskEntryData ted) { this.ted = ted; }