Esempio n. 1
0
        private void ListOwnerGetDetail()
        {
            this.listOwnerDetailList.RaiseListChangedEvents = false;
            this.listOwnerDetailList.Clear();
            if (this.OwnerID >= 0)
            {
                ListOwnerDTS.ListOwnerDetailDataTable detailDataTable = this.DetailTableAdapter.GetData(this.OwnerID);

                if (detailDataTable.Count > 0)
                {
                    foreach (ListOwnerDTS.ListOwnerDetailRow detailRow in detailDataTable.Rows)
                    {
                        this.listOwnerDetailList.Add(new ListOwnerDetail(detailRow.CommonID, detailRow.CommonValue, detailRow.Remarks));
                    }
                }
            }
            this.listOwnerDetailList.RaiseListChangedEvents = true;
            this.listOwnerDetailList.ResetBindings();
        }
Esempio n. 2
0
        private bool SaveDetail(int ownerID)
        {
            int serialID = 0; int rowsAffected = 0;


            #region <Save collection>

            serialID = 0;

            ListOwnerDTS.ListOwnerDetailDataTable detailDataTable = new ListOwnerDTS.ListOwnerDetailDataTable();

            foreach (ListOwnerDetail listOwnerDetail in this.ListOwnerDetailList)
            {
                ListOwnerDTS.ListOwnerDetailRow detailRow = detailDataTable.NewListOwnerDetailRow();

                detailRow.OwnerID  = ownerID;
                detailRow.SerialID = ++serialID;

                detailRow.CommonID    = listOwnerDetail.CommonID;
                detailRow.CommonValue = listOwnerDetail.CommonValue;

                detailRow.Remarks = listOwnerDetail.Remarks;

                detailDataTable.AddListOwnerDetailRow(detailRow);
            }

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


            #endregion <Save collection>


            return(true);
        }