예제 #1
0
        //调拨单页面对应commit操作,将传进的参数分别插入到调拨单主表和从表中去
        public Boolean CommitAction(DataTable dataTable)
        {
            //将dataTable中的每行数据插入数据库中
            foreach (DataRow datarow in dataTable.Rows)
            {
                //将每行数据插入数据库中
                Exchange_headerDC exchange_headerDC = new Exchange_headerDC();
                Exchange_lineDC   exchange_lineDC   = new Exchange_lineDC();

                //将数据插入调拨单主表
                Boolean flag_header = exchange_headerDC.insertExchange_header(datarow.ItemArray[5].ToString(), int.Parse(datarow.ItemArray[3].ToString()), int.Parse(datarow.ItemArray[2].ToString()), DateTime.Now, DateTime.Now, datarow.ItemArray[4].ToString());

                //通过invoice_No获取调拨单主表ID,这样将主表ID插入从表,使主从表有关联
                int Exchange_header_id = exchange_headerDC.getExchange_header_idByinvoice_no(datarow.ItemArray[5].ToString());
                //将数据插入调拨单从表
                Boolean flag_line = exchange_lineDC.insertExchange_line(Exchange_header_id, datarow.ItemArray[0].ToString(), int.Parse(datarow.ItemArray[1].ToString()), DateTime.Now, datarow.ItemArray[4].ToString(), datarow.ItemArray[6].ToString());

                //若插入失败时,则返回false
                if (flag_header == false || flag_line == false)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        //调拨单操作页面对应commit操作,将传进的参数分别插入到调拨单主表和从表中去
        public Boolean CommitAction(string invoice_no, string item_name, int required_qty)
        {
            Exchange_headerDC exchange_headerDC = new Exchange_headerDC();
            Exchange_lineDC   exchange_lineDC   = new Exchange_lineDC();

            //将数据插入调拨单主表
            Boolean flag_header = exchange_headerDC.insertExchange_header(invoice_no);

            //通过invoice_No获取调拨单主表ID,这样将主表ID插入从表,使主从表有关联
            int Exchange_header_id = exchange_headerDC.getExchange_header_idByinvoice_no(invoice_no);
            //将数据插入调拨单从表
            Boolean flag_line = exchange_lineDC.insertExchange_line(Exchange_header_id, item_name, required_qty);

            //若插入失败时,则返回false
            if (flag_header == false || flag_line == false)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }