示例#1
0
        public static void Read(string path)
        {
            ILog         log = LogManager.GetLogger("J3Price.Logging");//获取一个日志记录器
            StreamReader sr  = new StreamReader(path, Encoding.Default);
            String       line;

            while ((line = sr.ReadLine()) != null)
            {
                string   name         = line.Split(':')[0];
                string[] info         = line.Split(':')[1].Split(' ');
                string   serviceName  = info[0];
                string   price        = info[1];
                string   saletypeName = info[2];
                string   product      = info[3];
                DateTime time         = DateTime.Parse(info[4]);
                try
                {
                    ServiceMst mst      = DAL.GetServiceMstByName(serviceName);
                    int        salecode = DAL.GetSaleCodeByName(saletypeName);
                    string     mess     = DAL.CreateQuote((int)mst.RegionID, mst.ServiceID, salecode, product, price, time, null, name, false);
                    log.Info(name + ':' + serviceName + ' ' + price + ' ' + saletypeName + ' ' + product + ' ' + time + ' ' + mess);
                }
                catch (Exception ex)
                {
                    log.Info(name + ':' + serviceName + ' ' + price + ' ' + saletypeName + ' ' + product + ' ' + time + " 录入失败 " + ex);
                }
            }
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ServiceMst serviceMst = db.ServiceMsts.Find(id);

            db.ServiceMsts.Remove(serviceMst);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "ID,ServiceName")] ServiceMst serviceMst)
 {
     if (ModelState.IsValid)
     {
         db.Entry(serviceMst).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(serviceMst));
 }
示例#4
0
        public ActionResult Create([Bind(Include = "ID,ServiceName")] ServiceMst serviceMst)
        {
            if (ModelState.IsValid)
            {
                db.ServiceMsts.Add(serviceMst);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(serviceMst));
        }
示例#5
0
        // GET: ServiceMsts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceMst serviceMst = db.ServiceMsts.Find(id);

            if (serviceMst == null)
            {
                return(HttpNotFound());
            }
            return(View(serviceMst));
        }