public void SaveKeywordList(int EntityCode, string KeywordCodeList, int EntityTypeCode) { string[] KeywordCodeListArray = KeywordCodeList.Split(','); if (KeywordCodeList != "") { BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); for (int i = 0; i < KeywordCodeListArray.Length; i++) { EntityKeywordsBOL.KeywordCode = Convert.ToInt32(KeywordCodeListArray[i]); EntityKeywordsBOL.EntityCode = EntityCode; EntityKeywordsBOL.HCEntityTypeCode = EntityTypeCode; EntityKeywordsBOL.Deleted = false; int keywordEntity = GetKeywordEntity(EntityKeywordsBOL.KeywordCode, EntityKeywordsBOL.EntityCode, EntityKeywordsBOL.HCEntityTypeCode); if (keywordEntity == 0) { EntityKeywordsBOL.SaveChanges(keywordEntity == 0); } } } }
protected void DoSave(object sender, ImageClickEventArgs e) { if (!ValidateInputs()) { return; } BOLEntityKeywords CurObj = new BOLEntityKeywords(); if (!NewMode) { CurObj.Code = Convert.ToInt32(Code); } CurObj.KeywordCode = Convert.ToInt32(lkpKeywordCode.Code); //CurObj.HCEntityTypeCode = (int)cboHCEntityTypeCode.Value; //CurObj.EntityCode = (int)lkpEntityCode.Code; CurObj.HCEntityTypeCode = Convert.ToInt32(hflHCEntityTypeCode.Value); CurObj.EntityCode = Convert.ToInt32(hflEntityCode.Value); CurObj.SaveChanges(NewMode); GoToList(null, null); }
protected void Page_Load(object sender, EventArgs e) { string RealBaseID; BOLClass = new BOLEntityKeywords(); Label MasterPageTitle = (Label)Master.FindControl("lblTitle"); MasterPageTitle.Text = BOLClass.PageLable; if (Code == null) { if (!NewMode) { return; } } if (!Page.IsPostBack) { string InstanceName = Request["InstanceName"]; ViewState["InstanceName"] = InstanceName; // cboHCEntityTypeCode.DataSource = new BOLHardCode().GetHCDataTable("HCEntities"); RealBaseID = Request["BaseID"]; SavedBaseID = RealBaseID; if (!NewMode) { LoadData((int)Code); } else { int MasterCode = Convert.ToInt32(Request["MasterCode"]); hflEntityCode.Value = MasterCode.ToString(); RealBaseID = RealBaseID.Replace("Keywords", ""); if (!RealBaseID.EndsWith("s")) { if (RealBaseID.EndsWith("y")) { RealBaseID = RealBaseID.Substring(0, RealBaseID.Length - 1) + "ies"; } else if (RealBaseID.EndsWith("es")) { RealBaseID = RealBaseID.Substring(0, RealBaseID.Length - 2) + "es"; } else { RealBaseID = RealBaseID + "s"; } } if (RealBaseID == "Thesis") { RealBaseID = "Thesises"; } BOLHardCode HardCodeBOL = new BOLHardCode(); SearchFilterCollection sfc = new SearchFilterCollection(); sfc.Add(new SearchFilter("Name", SqlOperators.Equal, RealBaseID)); HardCodeBOL.TableOrViewName = "HCEntities"; DataTable dt = HardCodeBOL.GetDataSource(sfc, "Code", 10, 1); if (dt.Rows.Count > 0) { hflHCEntityTypeCode.Value = dt.Rows[0]["Code"].ToString(); } } } }
protected void Button1_Click(object sender, EventArgs e) { //BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); //ReqUtils Utils = new ReqUtils(); //ContentsDataContext dc = new ContentsDataContext(); //var ContentList = dc.Contents; //foreach (var item in ContentList) //{ // try // { // string CurDesc = item.ContentText; // CurDesc = Utils.RemoveTags(CurDesc); // CurDesc = Tools.PersianTextCorrection(CurDesc); // ExtractKeywords(CurDesc); // string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); // EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 4); // } // catch // { // } //} //BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); //TabirDataContext dc = new TabirDataContext(); //ReqUtils Utils = new ReqUtils(); //var TabirList = dc.Tabirs; //foreach (var item in TabirList) //{ // try // { // string CurDesc = item.Meaning; // CurDesc = Utils.RemoveTags(CurDesc); // CurDesc = Tools.PersianTextCorrection(CurDesc); // ExtractKeywords(CurDesc); // string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); // EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 5); // } // catch // { // } //} BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); ProductsDataContext dc = new ProductsDataContext(); ReqUtils Utils = new ReqUtils(); var ProductList = dc.Products; foreach (var item in ProductList) { try { string CurDesc = item.Description; CurDesc = Utils.RemoveTags(CurDesc); CurDesc = Tools.PersianTextCorrection(CurDesc); ExtractKeywords(CurDesc); string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 6); } catch { } } }