Exemple #1
0
        /// <summary>
        /// AddAndReturnID
        /// </summary>
        /// <param name="pobjMasterVO"></param>
        /// <param name="pdstDetail"></param>
        /// <returns></returns>
        /// <author>Trada</author>
        /// <date>Monday, Feb 27 2006</date>

        public int AddAndReturnID(cst_FreightMasterVO pobjMasterVO, DataSet pdstDetail)
        {
            int intMasterID = 0;
            cst_FreightMasterDS dscst_FreightMaster = new cst_FreightMasterDS();

            intMasterID = dscst_FreightMaster.AddAndReturnID(pobjMasterVO);
            //save detail
            foreach (DataRow drow in pdstDetail.Tables[0].Rows)
            {
                if (drow.RowState == DataRowState.Deleted)
                {
                    continue;
                }
                drow[cst_FreightDetailTable.FREIGHTMASTERID_FLD] = intMasterID;
            }
            cst_FreightDetailDS dscst_FreightDetail = new cst_FreightDetailDS();

            //Update dataset
            dscst_FreightDetail.UpdateDataSet(pdstDetail);
            return(intMasterID);
        }
Exemple #2
0
        /// <summary>
        /// UpdateMasterAndDetail
        /// </summary>
        /// <param name="pobjMasterVO"></param>
        /// <param name="pdstDetail"></param>
        /// <author>Trada</author>
        /// <date>Tuesday, Feb 28 2006</date>

        public void UpdateMasterAndDetail(cst_FreightMasterVO pobjMasterVO, DataSet pdstDetail)
        {
            cst_FreightMasterDS dsFreightMaster = new cst_FreightMasterDS();
            cst_FreightDetailDS dsFreightDetail = new cst_FreightDetailDS();

            if (pobjMasterVO.FreightMasterID > 0)
            {
                foreach (DataRow drow in pdstDetail.Tables[0].Rows)
                {
                    if (drow.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    if (int.Parse(drow[cst_FreightMasterTable.FREIGHTMASTERID_FLD].ToString()) == 0)
                    {
                        drow[cst_FreightMasterTable.FREIGHTMASTERID_FLD] = pobjMasterVO.FreightMasterID;
                    }
                }
            }
            //Update master
            dsFreightMaster.Update(pobjMasterVO);
            //Update Detail
            dsFreightDetail.UpdateDataSet(pdstDetail);
        }