Exemple #1
0
        public string AddRule(string ruleid, string rulename, string descr, string device, string layer)
        {
            try
            {
                using (BFdbContext db = new BFdbContext())
                {
                    var rs = db.CMNRULE.Count(s => s.RULENAME == rulename) > 0;
                    if (rs)
                    {
                        return("-1");
                    }

                    CMNRULE ent = new CMNRULE();
                    ent.DESCRP      = descr;
                    ent.DEVICE      = device;
                    ent.ID          = ruleid;
                    ent.LAYER       = layer;
                    ent.RULENAME    = rulename;
                    ent.CREATEDDATE = Int64.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));
                    return(db.Insert <CMNRULE>(ent).ToString());
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw GetFault(ex);
            }
        }
Exemple #2
0
        public string DelRule(string ruleid)
        {
            try
            {
                using (BFdbContext db = new BFdbContext())
                {
                    CMNRULE ent = new CMNRULE();
                    ent.ID = ruleid;

                    return(db.Delete <CMNRULE>(ent).ToString());
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw GetFault(ex);
            }
        }