Exemplo n.º 1
0
        /// <summary>
        /// 新建单据
        /// </summary>
        /// <param name="isolation">不合格品隔离处置单信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        bool InsertNewDate(S_IsolationManageBill isolation, out string error)
        {
            error = null;
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                var varData = from a in dataContxt.S_IsolationManageBill
                              where a.DJH == isolation.DJH
                              select a;

                if (varData.Count() == 0)
                {
                    if (!m_serverStore.ChangeStockStatus(dataContxt, isolation, 3, out error))
                    {
                        return(false);
                    }

                    dataContxt.S_IsolationManageBill.InsertOnSubmit(isolation);
                    dataContxt.SubmitChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }