private void PurgeZeroCarts(int portalId, int purgedays) { if (purgedays > 0) { var objCtrl = new NBrightBuyController(); var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner; var d = DateTime.Now.AddDays(purgedays * -1); var strDate = d.ToString("s"); var stmt = ""; stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + portalId.ToString("") + " and typecode = 'CART' and isnull([XMLdata].value('(genxml/appliedtotal)[1]','nvarchar(max)'),'0') = '0' and ModifiedDate < '" + strDate + "' "; objCtrl.ExecSql(stmt); } }
private void PurgeCarts(int portalId, int purgedays) { if (purgedays > 0) { var objCtrl = new NBrightBuyController(); var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner; var d = DateTime.Now.AddDays(purgedays * -1); var strDate = d.ToString("s"); var stmt = ""; stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + portalId.ToString("") + " and typecode = 'CART' and ModifiedDate < '" + strDate + "' "; objCtrl.ExecSql(stmt); } }
private void PurgeCarts() { var objCtrl = new NBrightBuyController(); var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner; if (Utils.IsNumeric(GenXmlFunctions.GetField(rpData, "purgecartsdays"))) { var days = Convert.ToInt32(GenXmlFunctions.GetField(rpData, "purgecartsdays")); var d = DateTime.Now.AddDays(days * -1); var strDate = d.ToString("s"); var stmt = ""; stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CART' and ModifiedDate < '" + strDate + "' "; objCtrl.ExecSql(stmt); } }
private void DoClearDown() { var pass = GenXmlFunctions.GetField(rpData, "txtclearpass"); if (pass == StoreSettings.Current.Get("adminpin") && pass != "") { var done = false; var objCtrl = new NBrightBuyController(); var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner; var stmt = ""; if (GenXmlFunctions.GetField(rpData, "clearproducts") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRD' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRDLANG' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'AMY' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'AMYLANG' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRDXREF' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'USERPRDXREF' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATCASCADE' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATXREF' "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearcategories") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') = 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearpropertiesonly") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') != 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearproperties") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') != 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'GROUP' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'GROUPLANG' "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearorders") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'ORDER' "; objCtrl.ExecSql(stmt); done = true; } DataCache.ClearCache(); if (done) { NBrightBuyUtils.SetNotfiyMessage(ModuleId, "deletecompleted", NotifyCode.ok); } } else { NBrightBuyUtils.SetNotfiyMessage(ModuleId, "nopin", NotifyCode.fail); } }