private void LoadObjectToScreen() { SqlDataReader dr; DataRow d; miCurrProj = moTrans.ProjectID; MoveObjectToScreen(); // get the send to list dr = CBTransmittalSendTo.GetList(moTrans.ID, false); while (dr.Read()) { d = dsSendToList.Tables[0].NewRow(); d["ID"] = dr["ID"]; d["Name"] = dr["Name"]; d["TypeID"] = dr["TypeID"]; d["Quantity"] = dr["Quantity"]; dsSendToList.Tables[0].Rows.Add(d); } dr.Close(); // get the copy to list dr = CBTransmittalSendTo.GetList(moTrans.ID, true); while (dr.Read()) { d = dsCCList.Tables[0].NewRow(); d["ID"] = dr["ID"]; d["Name"] = dr["Name"]; d["TypeID"] = dr["TypeID"]; d["Quantity"] = dr["Quantity"]; dsCCList.Tables[0].Rows.Add(d); } dr.Close(); // load document list dr = CBTransmittalReleaseDoc.GetList(moTrans.ID); while (dr.Read()) { d = mdsRelDocs.Tables["ReleaseDocs"].NewRow(); d["ID"] = dr["DocID"]; d["ReleaseDocID"] = dr["ID"]; d["DocNum"] = dr["DocNum"]; d["Description"] = dr["Description"]; d["Revision"] = dr["Revision"]; d["DateRel"] = dr["DateReleased"]; mdsRelDocs.Tables["ReleaseDocs"].Rows.Add(d); } dr.Close(); tlbbListDrwgs.Enabled = true; }
private void SaveIssueRelease() { CBTransmittalSendTo oSend; MoveScreenToObject(); moTrans.Save(); // save send to foreach (DataRow d in dsSendToList.Tables[0].Rows) { oSend = new CBTransmittalSendTo(); if (d["ID"] == DBNull.Value) { oSend.ID = 0; } else { oSend.ID = Convert.ToInt32(d["ID"]); } oSend.TransRelID = moTrans.ID; oSend.Name = d["Name"].ToString(); oSend.TypeID = Convert.ToInt32(d["TypeID"]); oSend.IsOther = false; oSend.Quantity = Convert.ToInt32(d["Quantity"]); d["ID"] = oSend.Save(); } // save cc foreach (DataRow d in dsCCList.Tables[0].Rows) { oSend = new CBTransmittalSendTo(); if (d["ID"] == DBNull.Value) { oSend.ID = 0; } else { oSend.ID = Convert.ToInt32(d["ID"]); } oSend.TransRelID = moTrans.ID; oSend.Name = d["Name"].ToString(); oSend.TypeID = Convert.ToInt32(d["TypeID"]); oSend.IsOther = true; oSend.Quantity = Convert.ToInt32(d["Quantity"]); d["ID"] = oSend.Save(); } // save document list CBTransmittalReleaseDoc relDoc; foreach (DataRow d in mdsRelDocs.Tables["ReleaseDocs"].Rows) { relDoc = new CBTransmittalReleaseDoc(); relDoc.ID = Convert.ToInt32(d["ReleaseDocID"]); relDoc.DocID = Convert.ToInt32(d["ID"]); relDoc.TransRelID = moTrans.ID; relDoc.DocNum = d["DocNum"].ToString(); relDoc.Description = d["Description"].ToString(); relDoc.Revision = Convert.ToInt32(d["Revision"]); relDoc.DateReleased = Convert.ToDateTime(d["DateRel"]); relDoc.Save(); } // remove any documents that were deleted foreach (DataRow d in mdsRelDeletes.Tables["ReleaseDocs"].Rows) { CBTransmittalReleaseDoc.Delete(Convert.ToInt32(d["ReleaseDocID"])); } tlbbSave.Enabled = false; //tlbbPrint.Enabled = true; }