Beispiel #1
0
 public bool Save()
 {
     try
     {
         ClassificationDataContext context = new ClassificationDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["ClassificationConnectionStringProd"].ConnectionString);
         if (this.ID == -1)
         {
             tbl_Rule item = new tbl_Rule();
             UpdateEntity(item);
             item.ModifiedBy   = "jllorin";
             item.ModifiedDate = DateTime.Now;
             item.Status       = true;
             context.tbl_Rules.InsertOnSubmit(item);
             context.SubmitChanges();
             this.ID = item.record_id;
         }
         else
         {
             var query = from entity in context.tbl_Rules
                         where entity.record_id == this.ID
                         select entity;
             foreach (var item in query)
             {
                 UpdateEntity(item);
             }
             context.SubmitChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Solr.Utilities.SolrException.WriteError(ex);
     }
     return(false);
 }
Beispiel #2
0
 private void UpdateEntity(tbl_Rule item)
 {
     item.RuleName         = this.RuleName;
     item.IsQueryShow      = this.IsQueryShow;
     item.IsClassifyShow   = this.IsClassifyShow;
     item.IsSimilarityShow = this.IsSimilarityShow;
     item.QueryString      = this.QueryString;
     item.Sort             = this.Sort;
     item.Fields           = this.Fields;
     item.Start            = this.Start;
     item.Rows             = this.Rows;
 }