Esempio n. 1
0
        public string UpdateUrlList(string weburl, string insertby, DateTime insertdate, int tscnt, string url)
        {
            string Msg = "";

            try
            {
                PCMS_DbContext context  = new PCMS_DbContext();
                pcms_rules     objRules = new pcms_rules();
                objRules.RULE_APPLIED_URL = Cryptographys.Encrypt(url);
                objRules.INSERTED_BY      = insertby;
                objRules.INSERTED_DATE    = insertdate;
                objRules.WEBSITE_URL      = Cryptographys.Encrypt(weburl);
                objRules.TS_CNT           = tscnt;
                objRules.RULE_PK          = Guid.NewGuid();
                context.AddTopcms_rules(objRules);
                context.SaveChanges();
                Msg = "Inserted";
                return(Msg);
            }
            catch (Exception ex)
            {
                Utilities objUtilities = new Utilities();
                objUtilities.LogError(ex);
                Msg = "Something went wrong";
                return(null);
            }
        }
Esempio n. 2
0
        public string SaveURL(string usr, string url, string usrby)
        {
            string Msg = "";

            try
            {
                using (PCMS_DbContext _pcmsDbContext = new PCMS_DbContext())
                {
                    pcms_rules objRules = new pcms_rules();
                    objRules.WEBSITE_URL      = Cryptographys.Encrypt(usr);
                    objRules.RULE_APPLIED_URL = Cryptographys.Encrypt(url);
                    objRules.INSERTED_BY      = usrby;
                    objRules.INSERTED_DATE    = DateTime.Now;
                    objRules.TS_CNT           = 1;
                    objRules.RULE_PK          = Guid.NewGuid();
                    _pcmsDbContext.AddTopcms_rules(objRules);
                    _pcmsDbContext.SaveChanges();
                    Msg = "Inserted";
                    return(Msg);
                }
            }
            catch (Exception ex)
            {
                return(Msg = ex.Message);
            }
        }
Esempio n. 3
0
        public string AddWebsite(pcms_List list)
        {
            string Msg = "";

            try
            {
                using (PCMS_DbContext _pcmsDbContext = new PCMS_DbContext())
                {
                    string url = list.url[0].WEBSITE_URL;
                    if (_pcmsDbContext.pcms_website.Any(u => u.WEBSITE_URL == url))
                    {
                        return(Msg = "Duplicate");
                    }
                    else
                    {
                        pcms_website objWebsite = new pcms_website();
                        objWebsite.WEBSITE_URL         = list.url[0].WEBSITE_URL;
                        objWebsite.WEBSITE_SITEMAP_URL = list.url[0].WEBSITE_SITEMAP_URL != null ? list.url[0].WEBSITE_SITEMAP_URL : "";
                        objWebsite.SDK_VERIFIED        = Convert.ToBoolean(list.url[0].SDK_VERIFIED);
                        objWebsite.INSERTED_BY         = list.url[0].INSERTED_BY;
                        objWebsite.INSERTED_DATE       = list.url[0].INSERTED_DATE;
                        objWebsite.TS_CNT     = list.url[0].TS_CNT;
                        objWebsite.WEBSITE_PK = Guid.NewGuid();
                        pcms_rules objRules = new pcms_rules();
                        string     webmap   = list.url[0].WEBSITE_URL != null?Cryptographys.Encrypt(list.url[0].WEBSITE_URL) : "";

                        objRules.RULE_APPLIED_URL = webmap;
                        objRules.INSERTED_BY      = list.url[0].INSERTED_BY;
                        objRules.INSERTED_DATE    = list.url[0].INSERTED_DATE;
                        objRules.WEBSITE_URL      = Cryptographys.Encrypt(list.url[0].WEBSITE_URL);
                        objRules.TS_CNT           = list.url[0].TS_CNT;
                        objRules.RULE_PK          = Guid.NewGuid();
                        _pcmsDbContext.AddTopcms_website(objWebsite);
                        _pcmsDbContext.AddTopcms_rules(objRules);
                        _pcmsDbContext.SaveChanges();
                        Msg = "Inserted";
                        return(Msg);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities objUtilities = new Utilities();
                objUtilities.LogError(ex);
                Msg = "Something went wrong";
                return(null);
            }
        }
Esempio n. 4
0
        public string updateRules(pcms_rules Rule)
        {
            string Msg = "";

            try
            {
                PCMS_DbContext context = new PCMS_DbContext();
                if (!context.pcms_rules.Any(u => u.RULE_NAME == Rule.RULE_NAME))
                {
                    pcms_rules pu = new pcms_rules();
                    pu.RULE_NAME                = Cryptographys.Encrypt(Rule.RULE_NAME);
                    pu.RULE_LOCATION            = Rule.RULE_LOCATION;
                    pu.RULE_USER_TYPE           = Rule.RULE_USER_TYPE;
                    pu.RULE_PK                  = Guid.NewGuid();
                    pu.RULE_PARAMETER_KEY_VALUE = Rule.RULE_PARAMETER_KEY_VALUE;
                    pu.RULE_APPLIED_URL         = Cryptographys.Encrypt(Rule.RULE_APPLIED_URL);
                    pu.RULE_ISDELETED           = Rule.RULE_ISDELETED;
                    pu.INSERTED_BY              = Rule.INSERTED_BY;
                    pu.INSERTED_DATE            = Rule.INSERTED_DATE;
                    pu.WEBSITE_URL              = Cryptographys.Encrypt(Rule.WEBSITE_URL);
                    pu.TS_CNT = Rule.TS_CNT;
                    context.AddTopcms_rules(pu);
                    context.SaveChanges();
                    Msg = "Inserted";
                }
                else
                {
                    Msg = "Duplicate";
                }
                return(Msg);
            }
            catch (Exception ex)
            {
                Utilities objUtilities = new Utilities();
                objUtilities.LogError(ex);
                Msg = "Something went wrong";
                return(null);
            }
        }