/// <summary> /// Initializes a new instance of the <see cref="FeatureExpression"/> class. /// </summary> /// <param name="featureType">The type of the feature.</param> /// <param name="name">The name of the feature.</param> /// <param name="valueExpressionFactory">Factory to extract the value for a given feature from the example object (input argument).</param> /// <param name="valueValidExpressionFactories">Factories to provide validation before invoking the expression created through <see cref="ValueExpressionFactory"/>.</param> /// <param name="featureExpressionFactory">The expression must create new Feature instances.</param> /// <param name="namespace">The namespace this feature belongs to.</param> /// <param name="featureGroup">The feature group this feature belongs to.</param> /// <param name="enumerize">If true the marshaller enumerates the feature (as in creates a 1-hot encoding).</param> /// <param name="variableName">The variable name to be used in the generated code.</param> /// <param name="order">Used to order feature serialization.</param> /// <param name="addAnchor">True if an anchor element should be added at the beginning of a dense feature array.</param> /// <param name="stringProcessing">Configures string pre-processing for this feature.</param> /// <param name="overrideSerializeMethod">An optional method overriding the otherwise auto-resolved serialization method.</param> /// <param name="dictify">True if a dictionary should be build for this feature.</param> /// <param name="parent">The parent feature expression.</param> public FeatureExpression(Type featureType, string name, Func<Expression, Expression> valueExpressionFactory, List<Func<Expression, Expression>> valueValidExpressionFactories = null, NewFeatureExpressionDelegate featureExpressionFactory = null, string @namespace = null, char? featureGroup = null, bool enumerize = false, string variableName = null, int? order = null, bool addAnchor = false, StringProcessing stringProcessing = StringProcessing.Split, MethodInfo overrideSerializeMethod = null, bool? dictify = null, FeatureExpression parent = null) { if (featureType == null) throw new ArgumentNullException("featureType"); if (valueExpressionFactory == null) throw new ArgumentNullException("valueExpressionFactory"); Contract.EndContractBlock(); if(featureType.IsGenericType && featureType.GetGenericTypeDefinition() == typeof(Nullable<>)) { this.IsNullable = true; this.FeatureType = featureType.GetGenericArguments()[0]; } else { this.IsNullable = false; this.FeatureType = featureType; } this.Name = name; this.ValueExpressionFactory = valueExpressionFactory; this.ValueValidExpressionFactories = valueValidExpressionFactories; this.FeatureExpressionFactory = featureExpressionFactory; this.Namespace = @namespace; this.FeatureGroup = featureGroup; this.Enumerize = enumerize; this.VariableName = variableName ?? name; this.Order = order ?? 1; this.AddAnchor = addAnchor; this.Dictify = dictify ?? false; this.StringProcessing = stringProcessing; this.OverrideSerializeMethod = overrideSerializeMethod; this.Dictify = dictify ?? false; this.Parent = parent; this.DenseFeatureValueElementType = InspectionHelper.GetEnumerableElementType(featureType); if (!InspectionHelper.IsNumericType(this.DenseFeatureValueElementType)) this.DenseFeatureValueElementType = null; }
public IActionResult Login([Bind("Ten_dang_nhap", "Mat_khau")] TaiKhoanModel taikhoan) { var r = _context.TaiKhoanModel.Where(m => (m.Ten_dang_nhap == taikhoan.Ten_dang_nhap && m.Mat_khau == StringProcessing.CreateMD5Hash(taikhoan.Mat_khau))).ToList(); if (r.Count == 0) { return(View("Error")); } var str = JsonConvert.SerializeObject(taikhoan); HttpContext.Session.SetString("user", str); if (r[0].Loai_tai_khoan == 0) { var url = Url.RouteUrl("areas", new { Controller = "Home", action = "Index", area = "admin" }); return(Redirect(url)); } return(RedirectToAction("Index", "Home")); }
// сохранение списка копий книг в xml-файл private void saveCopiesListToXml(ref BackgroundWorker bw, ref DoWorkEventArgs e, int GroupCountForList, string ToDirName, int CompareMode, string CompareModeName) { if (!Directory.Exists(ToDirName)) { Directory.CreateDirectory(ToDirName); } int ThroughGroupCounterForXML = 0; // "сквозной" счетчик числа групп для каждого создаваемого xml файла копий int GroupCounterForXML = 0; // счетчик (в границых CompareModeName) числа групп для каждого создаваемого xml файла копий int XmlFileNumber = 0; // номер файла - для формирования имени создаваемого xml файла копий // копии fb2 книг по группам if (m_listViewFB2Files.Groups.Count > 0) { ProgressBar.Maximum = m_listViewFB2Files.Items.Count; XDocument doc = createXMLStructure(CompareMode, CompareModeName); int BookInGroups = 0; // число книг (books) в Группах (Groups) int GroupCountInGroups = 0; // число Групп (Group count) в Группах (Groups) bool one = false; foreach (ListViewGroup lvGroup in m_listViewFB2Files.Groups) { if ((bw.CancellationPending)) { e.Cancel = true; return; } addAllBookInGroup(ref bw, ref e, ref doc, lvGroup, ref BookInGroups, ref GroupCountInGroups); ++GroupCounterForXML; ++ThroughGroupCounterForXML; doc.Root.Element("SelectedItem").SetValue( (m_LastSelectedItem <= GroupCountForList && ThroughGroupCounterForXML <= GroupCountForList) ? m_LastSelectedItem.ToString() : "0" ); if (GroupCountForList <= m_listViewFB2Files.Groups.Count) { if (GroupCounterForXML >= GroupCountForList) { setDataForNode(ref doc, GroupCountInGroups, BookInGroups); doc.Save( Path.Combine(ToDirName, StringProcessing.makeNNNStringOfNumber(++XmlFileNumber) + ".dup_lbc") ); doc.Root.Element("Groups").Elements().Remove(); GroupCountInGroups = 0; GroupCounterForXML = 0; BookInGroups = 0; } else { // последний диаппазон Групп if (ThroughGroupCounterForXML == m_listViewFB2Files.Groups.Count) { setDataForNode(ref doc, GroupCountInGroups, BookInGroups); doc.Save( Path.Combine(ToDirName, StringProcessing.makeNNNStringOfNumber(++XmlFileNumber) + ".dup_lbc") ); } } } else { setDataForNode(ref doc, GroupCountInGroups, BookInGroups); one = true; } } // по всем Группам if (one) { doc.Save(Path.Combine(ToDirName, "001.dup_lbc")); } } }
public IActionResult Login([Bind("Name,Email,Password,Phone,Total_Spending,Status")] Customer customer) { var login = _context.Customers.Where(s => (s.Email.Equals(customer.Email) && s.Password.Equals(StringProcessing.CreateMD5(customer.Password)))); if (login.ToList().Count == 0) { return(View("Index")); } var str = JsonConvert.SerializeObject(login.First()); HttpContext.Session.SetString("customer", str); return(Redirect("/")); }
public IActionResult Index([Bind("TaiKhoan", "MatKhau")] AdminModel member) { var r = _context.tb_Admin.Where(m => (m.TaiKhoan.Equals(member.TaiKhoan) && m.MatKhau.Equals(StringProcessing.CreateMD5Hash(member.MatKhau))) && m.TrangThai == true).ToList(); if (r.Count > 0) { var str = JsonConvert.SerializeObject(member); HttpContext.Session.SetString("user", str); JObject us = JObject.Parse(HttpContext.Session.GetString("user")); AdminModel mem = new AdminModel(); mem.TaiKhoan = us.SelectToken("TaiKhoan").ToString(); mem.MatKhau = us.SelectToken("MatKhau").ToString(); return(View(mem)); } return(RedirectToAction("Login", "HomePage")); }
/// <summary> /// Initializes a new instance of the <see cref="FeatureExpression"/> class. /// </summary> /// <param name="featureType">The type of the feature.</param> /// <param name="name">The name of the feature.</param> /// <param name="valueExpressionFactory">Factory to extract the value for a given feature from the example object (input argument).</param> /// <param name="valueValidExpressionFactories">Factories to provide validation before invoking the expression created through <see cref="ValueExpressionFactory"/>.</param> /// <param name="featureExpressionFactory">The expression must create new Feature instances.</param> /// <param name="namespace">The namespace this feature belongs to.</param> /// <param name="featureGroup">The feature group this feature belongs to.</param> /// <param name="enumerize">If true the marshaller enumerates the feature (as in creates a 1-hot encoding).</param> /// <param name="variableName">The variable name to be used in the generated code.</param> /// <param name="order">Used to order feature serialization.</param> /// <param name="addAnchor">True if an anchor element should be added at the beginning of a dense feature array.</param> /// <param name="stringProcessing">Configures string pre-processing for this feature.</param> /// <param name="overrideSerializeMethod">An optional method overriding the otherwise auto-resolved serialization method.</param> /// <param name="dictify">True if a dictionary should be build for this feature.</param> public FeatureExpression(Type featureType, string name, Func <Expression, Expression> valueExpressionFactory, List <Func <Expression, Expression> > valueValidExpressionFactories = null, NewFeatureExpressionDelegate featureExpressionFactory = null, string @namespace = null, char?featureGroup = null, bool enumerize = false, string variableName = null, int?order = null, bool addAnchor = false, StringProcessing stringProcessing = StringProcessing.Split, MethodInfo overrideSerializeMethod = null, bool?dictify = null) { if (featureType == null) { throw new ArgumentNullException("featureType"); } if (valueExpressionFactory == null) { throw new ArgumentNullException("valueExpressionFactory"); } Contract.EndContractBlock(); if (featureType.IsGenericType && featureType.GetGenericTypeDefinition() == typeof(Nullable <>)) { this.IsNullable = true; this.FeatureType = featureType.GetGenericArguments()[0]; } else { this.IsNullable = false; this.FeatureType = featureType; } this.Name = name; this.ValueExpressionFactory = valueExpressionFactory; this.ValueValidExpressionFactories = valueValidExpressionFactories; this.FeatureExpressionFactory = featureExpressionFactory; this.Namespace = @namespace; this.FeatureGroup = featureGroup; this.Enumerize = enumerize; this.VariableName = variableName ?? name; this.Order = order ?? 1; this.AddAnchor = addAnchor; this.Dictify = dictify ?? false; this.StringProcessing = stringProcessing; this.OverrideSerializeMethod = overrideSerializeMethod; this.Dictify = dictify ?? false; this.DenseFeatureValueElementType = InspectionHelper.GetEnumerableElementType(featureType); if (!InspectionHelper.IsNumericType(this.DenseFeatureValueElementType)) { this.DenseFeatureValueElementType = null; } }