Esempio n. 1
0
        public Result Delete()
        {
            Result result = new Result();

            result.IsOK = true; try
            {
                XNetEntities db = new XNetEntities();
                IQueryable <MTMS_BarCodeSNTB> barCodeSNTB = db.MTMS_BarCodeSNTB.Where(a => a.BarCodeSN == "1").OrderBy(a => a.BarCodeSN);
                foreach (var item in barCodeSNTB)
                {
                    db.DeleteObject(item);
                }
                result.IsOK = Convert.ToBoolean(db.SaveChanges());

                //  MTMS_BarCodeSNTB mB = CreateQuery<MTMS_BarCodeSNTB>();
                //user.UserEmail = "*****@*****.**";);
                // IQueryable<MTMS_BarCodeSNTB> barCodeSNTB = from p in db.MTMS_BarCodeSNTB select p;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.InnerException.Message);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }
Esempio n. 2
0
        public Result Add()
        {
            Result result = new Result();

            result.IsOK = true;
            try
            {
                MTMS_BarCodeSNTB b = new MTMS_BarCodeSNTB();
                b.BarCodeSN     = "1";
                b.MaterialCode  = "xxx";
                b.SummonsNumber = "111111";
                //   string str = System.Configuration.ConfigurationManager.ConnectionStrings["XNet"].ConnectionString;
                XNetEntities e = new XNetEntities();
                e.AddToMTMS_BarCodeSNTB(b);
                result.IsOK = Convert.ToBoolean(e.SaveChanges());
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.InnerException.Message);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }