Esempio n. 1
0
        protected void productToCheck(string accessOrNot)
        {
            DataRow sessionDr           = Session["seldProductStock"] as DataRow;
            string  strProductInCheckId = sessionDr["productInCheckId"].ToString();

            //if (inputCheck())
            //{
            byte[] FileArray     = UpLoadFile(fuCheck);
            string checkTextName = fuCheck.FileName;
            //得到上传文件的客户端MIME类型
            string strContentType = fuCheck.PostedFile.ContentType;

            //DataSet dst = new DataSet();
            //ProductStockProcess psp = new ProductStockProcess(dst);

            Xm_db xmDataCont = Xm_db.GetInstance();

            int productInCheckId = int.Parse(strProductInCheckId);

            try
            {
                xmDataCont.ProductIn_Check(productInCheckId, accessOrNot, FileArray, checkTextName, strContentType);
                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                mailDetail(accessOrNot, sessionDr, xmDataCont);
            }
            catch (System.Data.Linq.ChangeConflictException cce)
            {
                string strEx = cce.Message;
                foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts)
                {
                    //No database values are merged into current.
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                }

                xmDataCont.ProductIn_Check(productInCheckId, accessOrNot, FileArray, checkTextName, strContentType);
                xmDataCont.SubmitChanges();

                mailDetail(accessOrNot, sessionDr, xmDataCont);
            }
            //psp.ProductInCheck(strProductInCheckId, accessOrNot, FileArray, checkTextName, strContentType);

            //mailDetail(accessOrNot, sessionDr, xmDataCont);

            //}
            //else
            //{
            //    Xm_db xmDataCont = Xm_db.GetInstance();

            //    int productInCheckId = int.Parse(strProductInCheckId);

            //    var productInCheckEdit =
            //        (from productInCheck in xmDataCont.Tbl_productInCheck
            //         where productInCheck.ProductInCheckId == productInCheckId
            //         select productInCheck).First();

            //    productInCheckEdit.ProductCheck = accessOrNot;
            //    //productInCheckEdit.ProductCheckResult == ""

            //    try
            //    {
            //        //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_mainContract);
            //        //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_projectTagInfo);
            //        xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

            //        mailDetail(accessOrNot, sessionDr, xmDataCont);
            //    }
            //    catch (System.Data.Linq.ChangeConflictException cce)
            //    {
            //        string strEx = cce.Message;
            //        foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts)
            //        {
            //            //No database values are merged into current.
            //            occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
            //        }

            //        xmDataCont.SubmitChanges();

            //        mailDetail(accessOrNot, sessionDr, xmDataCont);
            //    }
            //}

            Response.Redirect("~/Main/stockInfoManager/productCheckView.aspx");
        }