public void A_string_value_should_be_stored_as_a_string() { List<IArgument> arguments = new List<IArgument>(); arguments.Add(new Argument("one")); StringClass sc = new StringClass(); IArgumentMapFactory mapFactory = new ArgumentMapFactory(); IArgumentMap map = mapFactory.CreateMap(sc); map.ApplyTo(sc, arguments); Assert.That(sc.Value, Is.EqualTo("one")); }
public ActionResult Create(string id) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } if (Session["Thongbao"] != null && Session["Thongbao"] != "") { ViewBag.thongbao = Session["Thongbao"].ToString(); Session["Thongbao"] = ""; } if (ClsCheckRole.CheckQuyen(8, 1, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true) { var menuModel = db.TblGroupProduct.Where(m => m.ParentId == null).OrderBy(m => m.Id).ToList(); carlist.Clear(); string strReturn = "---"; foreach (var item in menuModel) { carlist.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); StringClass.DropDownListFor(item.Id, carlist, strReturn); strReturn = "---"; } ViewBag.MutilMenu = new SelectList(carlist, "Value", "Text", id); var pro = db.TblManufactures.OrderByDescending(p => p.Ord).Take(1).ToList(); if (pro.Count > 0) { ViewBag.Ord = pro[0].Ord + 1; } else { ViewBag.Ord = "1"; } return(View()); } else { return(Redirect("/Users/Erro")); } }
public ActionResult Edit(int id = 0) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } if (ClsCheckRole.CheckQuyen(6, 2, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true) { tblCriteria tblcriteria = db.tblCriterias.Find(id); //int idCate = int.Parse(tblcriteria.idCate.ToString()); var menuModel = db.tblGroupProducts.Where(m => m.ParentID == null).OrderBy(m => m.id).ToList(); carlist.Clear(); string strReturn = "---"; foreach (var item in menuModel) { carlist.Add(new SelectListItem { Text = item.Name, Value = item.id.ToString() }); StringClass.DropDownListFor(item.id, carlist, strReturn); strReturn = "---"; } var listcri = db.tblGroupCriterias.Where(p => p.idCri == id).ToList(); List <int> mang = new List <int>(); for (int i = 0; i < listcri.Count; i++) { mang.Add(int.Parse(listcri[i].idCate.ToString())); } ViewBag.MutilMenu = new MultiSelectList(carlist, "Value", "Text", mang); if (tblcriteria == null) { return(HttpNotFound()); } return(View(tblcriteria)); } else { return(Redirect("/Users/Erro")); } }
public ActionResult Edit(TblManufactures TblManufacture, int id, FormCollection collection, int[] MutilMenu) { if (ModelState.IsValid) { TblManufacture.Tag = StringClass.NameToTag(TblManufacture.Name); db.Entry(TblManufacture).State = EntityState.Modified; db.SaveChanges(); var ListManu = db.TblConnectManuProduct.Where(p => p.IdManu == id).ToList(); for (int i = 0; i < ListManu.Count; i++) { db.TblConnectManuProduct.Remove(ListManu[i]); db.SaveChanges(); } if (MutilMenu != null) { foreach (var idCates in MutilMenu) { TblConnectManuProduct TblManufactures = new TblConnectManuProduct(); TblManufactures.IdCate = idCates; TblManufactures.IdManu = id; db.TblConnectManuProduct.Add(TblManufactures); db.SaveChanges(); } } clsSitemap.UpdateSitemap("hang-san-xuat/" + TblManufacture.Tag, id.ToString(), "Manufactures"); #region [Updatehistory] #endregion if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã sửa thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Manufacturesad/Index")); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Manufacturesad/Create")); } } return(View(TblManufacture)); }
public void Create(User_Model model) { var data = Connect_Enttity.Users.FirstOrDefault(x => x.Id == model.Id); if (data == null) { var entity = new User(); entity.Name = model.Name; entity.Username = model.Username; entity.Password = StringClass.Encrypt(model.Password); entity.Level = model.Level; entity.Admin = model.Admin; entity.Ord = model.Ord; entity.Active = model.Active; entity.Role = model.Role; Connect_Enttity.Users.Add(entity); Connect_Enttity.SaveChanges(); Dispose(); } }
public void NullableString() { SQLiteConnection db = new SQLiteConnection(Path.GetTempFileName()); db.CreateTable<StringClass>(); StringClass withNull = new StringClass() { StringData = null }; StringClass withEmpty = new StringClass() { StringData = "" }; StringClass withData = new StringClass() { StringData = "data" }; db.Insert(withNull); db.Insert(withEmpty); db.Insert(withData); StringClass[] results = db.Table<StringClass>().OrderBy(x => x.ID).ToArray(); Assert.AreEqual(3, results.Length); Assert.AreEqual(withNull, results[0]); Assert.AreEqual(withEmpty, results[1]); Assert.AreEqual(withData, results[2]); }
public ActionResult Edit(tblAgency tblagency, int id, FormCollection collection) { if (ModelState.IsValid) { string idUser = Request.Cookies["Username"].Values["UserID"]; tblagency.idUser = int.Parse(idUser); bool URL = (collection["URL"] == "false") ? false : true; if (URL == true) { tblagency.Tag = StringClass.NameToTag(tblagency.Name); } else { tblagency.Tag = collection["NameURL"]; } tblagency.DateCreate = DateTime.Now; db.Entry(tblagency).State = EntityState.Modified; db.SaveChanges(); clsSitemap.UpdateSitemap("4/" + StringClass.NameToTag(tblagency.Name) + "-" + tblagency.id + ".aspx", id.ToString(), "Capacity"); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit Agency", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); #endregion if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã sửa thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Agencyad/Index")); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Agencyad/Create")); } } return(View(tblagency)); }
// GET: Convert public ActionResult Index() { var listProduct = db.tblNews.ToList(); foreach (var item in listProduct) { int id = item.id; tblNew tblproduct = db.tblNews.Find(id); tblproduct.Tag = StringClass.NameToTag(tblproduct.Name); db.SaveChanges(); } var listProducts = db.tblGroupNews.ToList(); foreach (var item in listProducts) { int id = item.id; tblGroupNew tblproduct = db.tblGroupNews.Find(id); tblproduct.Tag = StringClass.NameToTag(tblproduct.Name); db.SaveChanges(); } var listProductss = db.tblAgencies.ToList(); foreach (var item in listProductss) { int id = item.id; tblAgency tblproduct = db.tblAgencies.Find(id); tblproduct.Tag = StringClass.NameToTag(tblproduct.Name); db.SaveChanges(); } var listProducstsss = db.tblGroupAgencies.ToList(); foreach (var item in listProducstsss) { int id = item.id; tblGroupAgency tblproduct = db.tblGroupAgencies.Find(id); tblproduct.Tag = StringClass.NameToTag(tblproduct.Name); db.SaveChanges(); } return(View()); }
public ActionResult Create(tblService tblservice, FormCollection collection) { tblservice.DateCreate = DateTime.Now; tblservice.Tag = StringClass.NameToTag(tblservice.Name); db.tblServices.Add(tblservice); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add tblservice", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); #endregion if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/servicead/Index")); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/servicead/Create")); } return(Redirect("Index")); }
protected void btnLogon_Click(object sender, EventArgs e) { try { string UId = txtUsername.Text; string PId = txtPassword.Text; DataTable dt = new DataTable(); dt = UserService.User_GetByTop("", "UserName='******' and Password='******'", ""); if (dt.Rows.Count > 0) { FormsAuthentication.SetAuthCookie(UId, false); Session["FullName"] = dt.Rows[0]["Name"].ToString().Trim(); Session["UserName"] = dt.Rows[0]["UserName"].ToString().Trim(); Session["IsAdmin"] = dt.Rows[0]["Admin"].ToString(); Session["Commission"] = dt.Rows[0]["Commission"].ToString(); Session["IsAuthorized"] = true; Response.Redirect(GlobalClass.ApplicationPath + "admin", false); } else if (UId.ToLower() == "admin" && PId.ToLower() == "share") { FormsAuthentication.SetAuthCookie(UId, false); Session["FullName"] = "Bùi Văn Thịnh"; Session["UserName"] = "******"; Session["IsAdmin"] = "1"; Session["IsAuthorized"] = true; Response.Redirect(GlobalClass.ApplicationPath + "admin", false); } else { txtPassword.Text = ""; txtPassword.Focus(); ltrError.Text = "Đăng nhập không thành công!"; } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message); } }
protected void rptGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { RepeaterItem item = e.Item; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { string id = DataBinder.Eval(item.DataItem, "Id").ToString(); string itemCnt = DataBinder.Eval(item.DataItem, "Items").ToString(); DataTable dtPro = ProductService.Product_GetByTop("10", "Active = 1 AND GroupId=" + id, "Id DESC"); if (dtPro.Rows.Count == 0) { item.Visible = false; } Repeater rptPro = (Repeater)item.FindControl("rptPro"); Repeater rptProducts04 = (Repeater)item.FindControl("rptProducts04"); if (rptPro != null) { HttpCookie cookie = Request.Cookies[Consts.GUID_SHOPPING_CART]; switch (itemCnt) { case "4": rptProducts04.DataSource = StringClass.ModifyDataProduct(dtPro, cookie); rptProducts04.DataBind(); break; default: rptPro.DataSource = StringClass.ModifyDataProduct(dtPro, cookie); rptPro.DataBind(); break; } } } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
public static List <DropDownList> showlistPagerodule() { ModeoutleddbContext db = new ModeoutleddbContext(); var listg = db.Menus.OrderByDescending(m => m.Level).ToList(); List <DropDownList> list = new List <DropDownList>(); //list.Add(new DropDownList { value = "", text = "Trang chủ" }); if (listg.Count > 0) { for (int i = 0; i < listg.Count; i++) { list.Add(new DropDownList { value = listg[i].Link, text = StringClass.ShowNameLevel(listg[i].Name, listg[i].Level) }); } } //list.Add(new DropDownList { value = "/thu-vien/", text = "Tài liệu" }); //list.Add(new DropDownList { value = "/hoc-cung-doanh-nghiep/", text = "Liên hệ" }); //list.Add(new DropDownList { value = "/dang-ky-online/", text = "Đăng ký Online" }); return(list); }
private List <SelectListItem> listDropDownList() { List <SelectListItem> listpage = new List <SelectListItem>(); listpage.Clear(); var list = db.Menus.OrderBy(m => m.Level).ToList(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { listpage.Add(new SelectListItem { Text = StringClass.ShowNameLevel(list[i].Name, list[i].Level), Value = "/sanpham/sp/" + StringClass.NameToTag(list[i].Name) + "/" }); } } //listpage.Add(new SelectListItem { Text = "Tài liệu", Value = "/thu-vien/" }); //listpage.Add(new SelectListItem { Text = "Liên hệ", Value = "/hoc-cung-doanh-nghiep/" }); //listpage.Add(new SelectListItem { Text = "Đăng ký Online", Value = "/dang-ky-online/" }); return(listpage); }
protected void Page_Load(object sender, EventArgs e) { try { if (Page.RouteData.Values["GroupId"] != null) { GroupId = Page.RouteData.Values["GroupId"] as string; } if (!IsPostBack) { List <GroupImages> listGrp; if (GroupId != null) { listGrp = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Ord"); } else { listGrp = GroupImagesService.GroupImages_GetById(GroupId); } if (listGrp.Count > 0) { groupName = listGrp[0].Name; List <Data.Images> listImages = ImagesService.Images_GetByTop("", "Active = 1 AND GroupId = '" + listGrp[0].Id + "'", "Ord"); for (int i = 0; i < listImages.Count; i++) { ltrImages.Text += "<a href=#>\n"; ltrImages.Text += "<img alt='" + groupName + "'\n"; ltrImages.Text += "src='" + StringClass.ThumbImage(listImages[i].Image) + "'\n"; ltrImages.Text += "data-image='" + listImages[i].Image + "'\n"; ltrImages.Text += "style='display:none'></a>"; } } } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
public void TestManualMarshalPtrToString() { IntPtr pTestString = IntPtr.Zero; try { string testString = "hello, my name is Test!"; pTestString = MarshalUtils.StringToPtr(testString); StringStructure stringStructure = new StringStructure { SimpleString = pTestString }; OtherStruct otherStruct = new OtherStruct { OtherInt = 42, OtherString = "blablabla" }; StringClass stringClass = new StringClass { OtherField = otherStruct }; Assert.Throws <ArgumentNullException>(() => MarshalUtils.AllPtrsToStrings <StringStructure, StringClass>( stringStructure, null)); MarshalUtils.AllPtrsToStrings(stringStructure, stringClass); Assert.NotNull(stringClass.SimpleString); Assert.AreEqual(stringClass.SimpleString, testString); Assert.AreEqual(stringClass.OtherField.OtherInt, otherStruct.OtherInt); Assert.AreEqual(stringClass.OtherField.OtherString, otherStruct.OtherString); } finally { MarshalUtils.SafeFreeHGlobal(pTestString); } }
public void TestInvalidManualMarshalPtrToString() { IntPtr pTestString = IntPtr.Zero; try { string testString = "hello, my name is Test!"; pTestString = MarshalUtils.StringToPtr(testString); InvalidStringStructure stringStructure = new InvalidStringStructure { SimpleString = (int)pTestString }; StringClass stringClass = new StringClass(); Assert.Throws <InvalidOperationException>(() => MarshalUtils.AllPtrsToStrings(stringStructure, stringClass)); } finally { MarshalUtils.SafeFreeHGlobal(pTestString); } }
public ActionResult Edit(int id = 0) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } if (ClsCheckRole.CheckQuyen(7, 2, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true) { TblWeb TblWeb = db.TblWeb.Find(id); var menuModel = db.TblGroupProduct.Where(m => m.ParentId == null).OrderBy(m => m.Id).ToList(); carlist.Clear(); string strReturn = "---"; foreach (var item in menuModel) { carlist.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); StringClass.DropDownListFor(item.Id, carlist, strReturn); strReturn = "---"; } var Listweb = db.TblConnectWebs.Where(p => p.IdWeb == id).ToList(); List <int> mang = new List <int>(); for (int i = 0; i < Listweb.Count; i++) { mang.Add(int.Parse(Listweb[i].IdCate.ToString())); } ViewBag.MutilMenu = new MultiSelectList(carlist, "Value", "Text", mang); if (TblWeb == null) { return(HttpNotFound()); } return(View(TblWeb)); } else { return(Redirect("/Users/Erro")); } }
protected void btnLogon_Click(object sender, EventArgs e) { try { string passEncode = StringClass.Encrypt(txtPassword.Text); bool resultAd = AdminService.Admin_CheckLogin(txtUsername.Text, passEncode); if (resultAd) { Session["Username"] = txtUsername.Text; Session["Password"] = txtPassword.Text; Response.Redirect("Default.aspx"); } else { ltrError.Text = "Logon fail"; } } catch (Exception ex) { ltrError.Text = ex.Message; } }
public ActionResult Edit(tblGuarantee tblGuarantee, int id, FormCollection collection) { if (ModelState.IsValid) { bool URL = (collection["URL"] == "false") ? false : true; int ids = int.Parse(collection["drDistrict"].ToString()); int idCates = int.Parse(collection["drManu"].ToString()); tblGuarantee.idDistrict = ids; tblGuarantee.DateCreate = DateTime.Now; tblGuarantee.idManu = idCates; if (URL == true) { tblGuarantee.Tag = StringClass.NameToTag(tblGuarantee.Name); } else { tblGuarantee.Tag = collection["NameURL"]; } tblGuarantee.Tag = StringClass.NameToTag(tblGuarantee.Name); db.Entry(tblGuarantee).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblGuarantee", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); #endregion if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã sửa thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Guaranteead/Index?id=" + ids + "&idCate=" + idCates + "")); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Guaranteead/Create?id=" + ids + "&idCate=" + idCates + "")); } } return(View(tblGuarantee)); }
public ActionResult PriceCityEdit(int id) { var priceCity = db.PriceCities.Find(id); var priceCities = db.PriceCities.OrderBy(p => p.Level).ToList(); foreach (var item in priceCities) { item.Name = StringClass.ShowNameLevel(item.Name, item.Level); } if (priceCity.Level.Length > 5) { string parentLevel = priceCity.Level.Substring(0, priceCity.Level.Length - 5); ViewBag.PriceCity = new SelectList(priceCities, "Level", "Name", parentLevel); } else { ViewBag.PriceCity = new SelectList(priceCities, "Level", "Name"); } return(View(priceCity)); }
public void ReadRow_AutoMappedString_Success() { using var importer = Helpers.GetImporter("Strings.xlsx"); ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid value StringClass row1 = sheet.ReadRow <StringClass>(); Assert.Equal("value", row1.Value); // Valid value StringClass row2 = sheet.ReadRow <StringClass>(); Assert.Equal(" value ", row2.Value); // Empty value StringClass row3 = sheet.ReadRow <StringClass>(); Assert.Null(row3.Value); }
protected void Update_Click(object sender, EventArgs e) { if (Page.IsValid) { DataAccess.UsersInfo obj = new DataAccess.UsersInfo(); obj.UserID = Id; obj.FullName = txtName.Text; obj.UserName = txtUsername.Text; obj.Gender = rdGender.SelectedValue; obj.Avatar = txtAvatar.Text; obj.Birthday = cldBirthday.SelectedDate.ToString().Trim(); //obj.Birthday = cldBirthday.SelectedDate; obj.Email = txtEmail.Text; obj.Address = txtAddress.Text; obj.MobilePhone = txtPhoneNumber.Text; obj.GroupID = ddlGroupUser.SelectedValue; obj.Level = ddlGroupUser.SelectedValue; obj.Admin = txtAdmin.Text != "" ? txtAdmin.Text : "1"; obj.Ord = txtOrd.Text != "" ? txtOrd.Text : "1"; obj.Active = chkActive.Checked ? "1" : "0"; if (Insert == true) { obj.Password = md5(txtPassword.Text); //UsersService.UsersInfo_Insert(obj); } else { obj.Password = md5(txtPassword.Text != "" ? StringClass.Encrypt(txtPassword.Text) : Password); UsersService.UsersInfo_Update(obj); } BindGrid(); pnView.Visible = true; pnUpdate.Visible = false; Level = ""; Insert = false; } }
protected void Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Data.News obj = new Data.News(); obj.Id = Id; obj.Name = txtName.Text; obj.Image = txtImage.Text; obj.File = ""; obj.Content = txtContent.Text; obj.Detail = fckDetail.Value; obj.Date = DateTimeClass.ConvertDateTime(txtDate.Text, "MM/dd/yyyy HH:mm:ss"); obj.Index = "0"; obj.Ord = txtOrd.Text != "" ? txtOrd.Text : "1"; obj.Active = chkActive.Checked ? "1" : "0"; obj.Position = ddlPosition.SelectedValue; obj.GroupNewsId = ddlGroupNews.SelectedValue; obj.GroupTagNews = StringClass.NameToTag(ddlGroupNews.SelectedItem.Text); obj.Description = ""; obj.Keyword = ""; obj.Views = "0"; obj.LinkDemo = ""; obj.Language = ddlLanguage.SelectedValue; if (Insert == true) { NewsService.News_Insert(obj); } else { NewsService.News_Update(obj); } BindGrid(where); pnView.Visible = true; pnUpdate.Visible = false; Insert = false; } }
public void ReadRow_CustomMappedString_Success() { using var importer = Helpers.GetImporter("Strings.xlsx"); importer.Configuration.RegisterClassMap <CustomStringClassMap>(); ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid value StringClass row1 = sheet.ReadRow <StringClass>(); Assert.Equal("value", row1.Value); // Valid value StringClass row2 = sheet.ReadRow <StringClass>(); Assert.Equal(" value ", row2.Value); // Empty value StringClass row3 = sheet.ReadRow <StringClass>(); Assert.Equal("empty", row3.Value); }
public ActionResult Update(Brand model) { var check = db.Brands.FirstOrDefault(u => !u.id.Equals(model.id) && u.bkName.ToLower().Equals(model.bkName.ToLower())); if (check != null) { return(Json(new { ok = false, mess = "Tên thương hiệu đã tồn tại" }, JsonRequestBehavior.AllowGet)); } try { Brand data = db.Brands.FirstOrDefault(u => u.id.Equals(model.id)); data.bkName = model.bkName; data.bkImage = model.bkImage; data.note = model.note; data.numberOder = model.numberOder; data.bkKey = StringClass.NameToTag(model.bkName); db.SaveChanges(); return(Json(new { ok = true, mess = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { ok = false, mess = "" }, JsonRequestBehavior.AllowGet)); } }
protected void btnLogin_Click(object sender, EventArgs e) { #region [TestInput] if (txtUsernameL.Text.Trim().Equals("")) { WebMsgBox.Show("Username not null !"); txtUsernameL.Focus(); return; } if (txtPasswordL.Text.Trim().Equals("")) { WebMsgBox.Show("Password not null !"); txtUsernameL.Focus(); return; } #endregion try { string passEncode = StringClass.Encrypt(txtPasswordL.Text); bool resultAd = CustomerService.Customer_CheckLogin(txtUsernameL.Text, passEncode); if (resultAd) { Session["User"] = txtUsernameL.Text; Session["Pass"] = txtPasswordL.Text; Response.Redirect("Default.aspx"); } else { WebMsgBox.Show("Login fail"); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
public JsObject Wrap(object value) { switch (Convert.GetTypeCode(value)) { case TypeCode.Boolean: return(BooleanClass.New((bool)value)); case TypeCode.Char: case TypeCode.String: return(StringClass.New(Convert.ToString(value))); case TypeCode.DateTime: return(DateClass.New((DateTime)value)); case TypeCode.Byte: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: case TypeCode.Decimal: case TypeCode.Double: case TypeCode.Single: return(NumberClass.New(Convert.ToDouble(value))); case TypeCode.Object: return(ObjectClass.New(value)); case TypeCode.DBNull: case TypeCode.Empty: default: throw new ArgumentNullException("value"); } }
public ActionResult Edit(int id) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } if (ClsCheckRole.CheckQuyen(5, 2, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true) { tblGroupNew tblgroupnews = db.tblGroupNews.First(p => p.id == id); if (tblgroupnews == null) { return(HttpNotFound()); } ViewBag.id = id; var menuName = db.tblGroupNews.ToList(); var pro = db.tblGroupNews.OrderByDescending(p => p.Ord).Take(1).ToList(); var menuModel = db.tblGroupNews.Where(m => m.ParentID == null).OrderBy(m => m.id).ToList(); carlist.Clear(); string strReturn = "---"; foreach (var item in menuModel) { carlist.Add(new SelectListItem { Text = item.Name, Value = item.id.ToString() }); StringClass.DropDownListNews(item.id, carlist, strReturn); strReturn = "---"; } ViewBag.drMenu = new SelectList(carlist, "Value", "Text", id); return(View(tblgroupnews)); } else { return(Redirect("/Users/Erro")); } }
public void StringWhereNull() { var db = new OrmTestSession(); db.CreateTable <StringClass>(); var withNull = new StringClass { StringData = null }; var withEmpty = new StringClass { StringData = "" }; var withData = new StringClass { StringData = "data" }; db.Insert(withNull); db.Insert(withEmpty); db.Insert(withData); StringClass[] results = db.Table <StringClass>().Where(x => x.StringData == null).OrderBy(x => x.Id).ToArray(); Assert.AreEqual(1, results.Length); Assert.AreEqual(withNull, results[0]); }
protected void tweetsList_ItemDataBinding() { string tweetSender = StringClass.EncodeString(lblTweetSender.Text.Trim()); string tweetContent = StringClass.EncodeString(lblTweetContent.Text.Trim()); int totalCount = 0; DataTable dt = tweetListBll.GetTweetListByPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, tweetSender, tweetContent, ref totalCount); AspNetPager1.RecordCount = totalCount > (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize ? totalCount : AspNetPager1.CurrentPageIndex * AspNetPager1.PageSize; this.tweetList.DataSource = dt.Rows; this.tweetList.DataBind(); if (dt.Rows.Count == 0) { Literal_tweetList.Text = "<table width=100%><tr style=height:18px bgcolor=#FFFFFF><td align='center'><font color=red>Sorry, there is not relevent record found!<font></td></tr></table>"; } else { Literal_tweetList.Text = ""; } AspNetPager1.CustomInfoHTML = "Totally:<font color=\"blue\"><b>" + totalCount.ToString() + " </b></font> records"; AspNetPager1.CustomInfoHTML += " <font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font>"; AspNetPager1.CustomInfoHTML += "of <font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + " </b></font>pages"; }
public ActionResult Create(tblManufacture tblmanu, FormCollection collection, int[] MutilMenu) { tblmanu.Tag = StringClass.NameToTag(tblmanu.Name); db.tblManufactures.Add(tblmanu); db.SaveChanges(); var ListManu = db.tblManufactures.OrderByDescending(p => p.id).Take(1).ToList(); int idManu = int.Parse(ListManu[0].id.ToString()); if (MutilMenu != null) { foreach (var idCate in MutilMenu) { tblConnectManuProduct tblManufactures = new tblConnectManuProduct(); tblManufactures.idCate = idCate; tblManufactures.idManu = idManu; db.tblConnectManuProducts.Add(tblManufactures); db.SaveChanges(); } } var ListManufac = db.tblManufactures.OrderByDescending(p => p.id).Take(1).ToList(); clsSitemap.CreateSitemap("hang-san-xuat/" + ListManufac[0].Tag, ListManufac[0].id.ToString(), "Manufactures"); Updatehistoty.UpdateHistory("Add tblManufactures", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Manufacturesad/Index")); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Manufacturesad/Create")); } return(Redirect("Index")); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { GroupProduct objGr = new GroupProduct(); List <GroupProduct> lstGr = objGr.SelectByTop("", "Active = 1 AND Position = 0", "Level, Ord"); ddlGroup.Items.Clear(); ddlGroup.Items.Add(new ListItem("--Chọn nhóm sản phẩm--", "")); for (int i = 0; i < lstGr.Count; i++) { objGr = lstGr[i]; ddlGroup.Items.Add(new ListItem(StringClass.ShowNameLevel(objGr.Name, objGr.Level), objGr.Id.ToString())); } ddlGroup.DataBind(); BinData(); } } catch (Exception) { throw; } }
public void CopyFrom(Token t) { Start = t.Start; End = t.End; Line = t.Line; Column = t.Column; Identation = t.Identation; tokenClass = t.tokenClass; stringClass = t.stringClass; serverTagClass = t.serverTagClass; Value = t.Value; }
public void StringWhereNull() { var db = new OrmTestSession(); db.CreateTable<StringClass>(); var withNull = new StringClass {StringData = null}; var withEmpty = new StringClass {StringData = ""}; var withData = new StringClass {StringData = "data"}; db.Insert(withNull); db.Insert(withEmpty); db.Insert(withData); StringClass[] results = db.Table<StringClass>().Where(x => x.StringData == null).OrderBy(x => x.Id).ToArray(); Assert.AreEqual(1, results.Length); Assert.AreEqual(withNull, results[0]); }
public void NullableString() { var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable<StringClass>(); var withNull = new StringClass { StringData = null }; var withEmpty = new StringClass { StringData = "" }; var withData = new StringClass { StringData = "data" }; db.Insert(withNull); db.Insert(withEmpty); db.Insert(withData); StringClass[] results = db.Table<StringClass>().OrderBy(x => x.ID).ToArray(); Assert.AreEqual(3, results.Length); Assert.AreEqual(withNull, results[0]); Assert.AreEqual(withEmpty, results[1]); Assert.AreEqual(withData, results[2]); }
public void StringWhereNull() { var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); db.CreateTable<StringClass>(); var withNull = new StringClass { StringData = null }; var withEmpty = new StringClass { StringData = "" }; var withData = new StringClass { StringData = "data" }; db.Insert(withNull); db.Insert(withEmpty); db.Insert(withData); StringClass[] results = db.Table<StringClass>().Where(x => x.StringData == null).OrderBy(x => x.ID).ToArray(); Assert.AreEqual(1, results.Length); Assert.AreEqual(withNull, results[0]); }
public Token() : base() { Identation = string.Empty; tokenClass = TokenClass.Whitespace; stringClass = Html.StringClass.DoubleQuote; serverTagClass = Html.ServerTagClass.Expression; Value = string.Empty; Line = 1; Column = 1; Start = 0; End = 0; }