private void ParseHTML() { string fileName = ConfigurationManager.AppSettings["DataPath"].Replace("~", HostingEnvironment.ApplicationPhysicalPath); var doc = new HtmlDocument(); doc.Load(fileName); int mainPrev = 0; int subPrev = 0; var value = doc.DocumentNode.SelectNodes("//select/option"); foreach (var val in value) { var id = Convert.ToInt32(val.Attributes[0].Value); var text = val.InnerHtml; int Count = Regex.Matches(text, " ").Count; text = text.Replace(" ", ""); if (Count == 4) { mainPrev = id; _dal.ExecuteNonQuery(@"Insert into MainSector values(" + id + ", '" + text + "')", null, CommandType.Text); } else if (Count == 8) { subPrev = id; _dal.ExecuteNonQuery(@"Insert into SubSector values(" + id + ", '" + text + "', " + mainPrev + ")", null, CommandType.Text); } else if (Count == 12) { _dal.ExecuteNonQuery(@"Insert into DetailSector values(" + id + ", '" + text + "', " + subPrev + ")", null, CommandType.Text); } } }
public void EditCustomer(string CustomerName, List <int> SectorIds) { var ids = String.Join(",", SectorIds.Select(x => x.ToString()).ToArray()); var param = new DynamicParameters(); param.Add("CustomerName", CustomerName); param.Add("Sectors", ids); _dal.ExecuteNonQuery("EditCustomer", param, CommandType.StoredProcedure); }