Esempio n. 1
0
        private void ListCoilGetDetail()
        {
            this.listCoilDetailList.RaiseListChangedEvents = false;
            this.listCoilDetailList.Clear();
            if (this.CoilID >= 0)
            {
                ListCoilDTS.ListCoilDetailDataTable detailDataTable = this.DetailTableAdapter.GetData(this.CoilID);

                if (detailDataTable.Count > 0)
                {
                    foreach (ListCoilDTS.ListCoilDetailRow detailRow in detailDataTable.Rows)
                    {
                        this.listCoilDetailList.Add(new ListCoilDetail(detailRow.CommonID, detailRow.CommonValue, detailRow.Remarks));
                    }
                }
            }
            this.listCoilDetailList.RaiseListChangedEvents = true;
            this.listCoilDetailList.ResetBindings();
        }
Esempio n. 2
0
        private bool SaveDetail(int coilID)
        {
            int serialID = 0; int rowsAffected = 0;


            #region <Save collection>

            serialID = 0;

            ListCoilDTS.ListCoilDetailDataTable detailDataTable = new ListCoilDTS.ListCoilDetailDataTable();

            foreach (ListCoilDetail listCoilDetail in this.ListCoilDetailList)
            {
                ListCoilDTS.ListCoilDetailRow detailRow = detailDataTable.NewListCoilDetailRow();

                detailRow.CoilID   = coilID;
                detailRow.SerialID = ++serialID;

                detailRow.CommonID    = listCoilDetail.CommonID;
                detailRow.CommonValue = listCoilDetail.CommonValue;

                detailRow.Remarks = listCoilDetail.Remarks;

                detailDataTable.AddListCoilDetailRow(detailRow);
            }

            rowsAffected = this.DetailTableAdapter.Update(detailDataTable);
            if (rowsAffected != this.listCoilDetailList.Count)
            {
                throw new System.ArgumentException("Insufficient save", "Save detail");
            }


            #endregion <Save collection>


            return(true);
        }