public void Add_IgnoreStringsBoundByWrongDelimiter_Returns3() { var addclass = new AddClass(); var result = addclass.Add("//[$]\n1%2,3"); Assert.AreEqual(3, result); }
/// <summary> /// 显示购物车数据 /// </summary> protected void cart() { string number = Request.Cookies["userSett"]["number"]; string emid = Q("emid"), count = Q("count"); string[] gdInfo = DBHelp.frS_string("select [emid],[title],[price],[ImgS] from [e_goods] where [emid]='" + emid + "'"); string[] Text = { "Number", "upid", "emid", "title", "price", "ImgS", "count" }; string[] value = { IdNumber.NumberSec("e_cart", "ca"), number, emid, gdInfo[1], gdInfo[2], gdInfo[3], count }; string ck = DBHelp.fr_string("select [Number] from [e_cart] where [emid]='" + emid + "'"); if (!string.IsNullOrEmpty(ck)) { if (UpdateClass.fromUpdate("e_cart", Text, value, "[emid]='" + emid + "'")) { Write("Xerror|2|已加入购物车"); } else { Write("Xerror|0|加入购物车出错"); } } else { if (AddClass.fromAdd("e_cart", Text, value)) { Write("Xerror|1|已加入购物车"); } else { Write("Xerror|0|加入购物车出错"); } } }
public void Add_MultipleDelimitersThatHaveMultipleChar_Returns6() { var addclass = new AddClass(); var result = addclass.Add("//[**][%%]\n1**2%%3"); Assert.AreEqual(6, result); }
/// <summary> /// 用户注册 /// </summary> private void register() { string name = R("regname"), npwd = R("nregpwd"); string number = IdNumber.NumberSec("e_member", "m"); //密码加密 string pass = ask.Web.EncryptHelper.Encrypt(npwd); //自动获取用户IP string ip = HttpContext.Current.Request.ServerVariables.Get("REMOTE_ADDR"); if (string.IsNullOrEmpty(ip) || ip == "::1") { ip = HttpContext.Current.Request.UserHostAddress; } string[] key = { "Number", "Name", "Password", "NickName", "LogIp" }; string[] value = { number, name, pass, name, ip }; if (AddClass.fromAdd("e_member", key, value)) { HttpCookie myuser = new HttpCookie("userSett"); myuser.Expires = DateTime.Now.AddDays(3); myuser["number"] = number; myuser["username"] = HttpUtility.UrlEncode(name); myuser["password"] = pass; myuser["nickname"] = HttpUtility.UrlEncode(name); Response.Cookies.Add(myuser); Write("Xerror|1|注册成功!"); } else { Write("Xerror|0|注册出错,请重试!"); } }
public void Add_MultipleCharDelimiter_Returns6() { var addclass = new AddClass(); var result = addclass.Add("//[***]\n1***2***3"); Assert.AreEqual(6, result); }
public void Add_EmptyString_Returns0() { var addclass = new AddClass(); var result = addclass.Add(""); Assert.AreEqual(0, result); }
public void Add_NumbersNewLineAndSeparatedByComma_Returns6() { var addclass = new AddClass(); var result = addclass.Add("1\n2,3"); Assert.AreEqual(6, result); }
public void Add_IgnoreNegativeNumbers_Returns1() { var addclass = new AddClass(); var result = addclass.Add("//;\n-1,1"); Assert.AreEqual(1, result); }
/// <summary> /// 收货地址 /// </summary> private void vipAddr() { string number = Q("m"); string recName = R("recName"), ddlCity = R("ddlCity"), adrDetail = R("adr-detail"), postcode = R("postcode"), mobile = R("mobile"), phone = R("phone"); string check = DBHelp.fr_string("select [receN] from [e_address] where [upid]='" + number + "'"); string[] Text = { "Number", "upid", "receN", "receA", "receAD", "Code", "Mobile", "Phone" }; string[] Value = { IdNumber.NumberSec("e_address", "ar"), number, recName, ddlCity, adrDetail, postcode, mobile, phone }; if (!string.IsNullOrEmpty(check)) { if (UpdateClass.fromUpdate("e_address", Text, Value, "[upid]='" + number + "'")) { Write("Xerror|1|保存成功"); } else { Write("Xerror|0|保存失败"); } } else { if (AddClass.fromAdd("e_address", Text, Value)) { Write("Xerror|1|保存成功"); } else { Write("Xerror|0|保存失败"); } } }
public void Add_Zero_Returns0() { var addclass = new AddClass(); var result = addclass.Add("0"); Assert.AreEqual(0, result); }
public void TestMethod1() { AddClass obj = new AddClass(); var sum = obj.AddClassm(2, 3); Assert.AreEqual(5, sum); }
/// <summary> /// 购物车结算 /// </summary> private void vipCart() { string number = Q("m"); string gdid = Q("gdid"); if (!string.IsNullOrEmpty(gdid)) { string[] value = gdid.Split('|'); foreach (string id in value) { string[] Info = DBHelp.frS_string("select [upid],[title],[price],[ImgS],[count] from [e_cart] where [emid]='" + id + "'"); string[] Text = { "Number", "upid", "emid", "title", "price", "ImgS", "count" }; string[] Value = { IdNumber.NumberSec("e_order", "or"), number, id, Info[1], Info[2], Info[3], Info[4] }; if (AddClass.fromAdd("e_order", Text, Value)) { if (Delet.DeletintW("e_cart", "[upid]='" + number + "' and [emid] in (" + gdid.Replace("|", ",") + ")") > 0) { Write("Xerror|1|购买成功"); } else { Write("Xerror|0|购买失败"); } } else { Write("Xerror|0|购买失败"); } } } }
public bool AddAddClass(XElement element) { var obj = new AddClass(Mod); obj.SetXml(element); return(AddAddClass(obj)); }
/// <summary> /// 增加和修改 /// </summary> protected void Bu_Click() { if (!string.IsNullOrEmpty(this.lblID.Text)) { if (UpdateClass.fromUpdate("e_navigation", "title|sitetitle|Keywords|Description|url", this.form1, " [Number]='" + this.lblID.Text + "'")) { jsFontcion.Cleload(); } else { jsFontcion.ResponseW("修改操作出错"); } } else { int stat = config.Sort_max("select max(Stat) from [e_navigation]"); string Number = IdNumber.NumberSman("e_navigation", "N"); string upid = this.title.Text == "首页" ? "1" : "0"; string[] Text = { "Number", "upid", "Stat" }; string[] Value = { Number, upid, stat.ToString() }; if (AddClass.fromAdd("e_navigation", "title|sitetitle|Keywords|Description|url", Text, Value, this.form1)) { jsFontcion.Cleload(); } else { jsFontcion.ResponseW("添加操作出错"); } } }
public object createclass(AddClass Lvm) { try { FRSEntities db = new FRSEntities(); Class Ru = new Class(); if (Ru.ClassID == 0) { Ru.ClassID = Lvm.ClassID; Ru.FlightID = Lvm.FlightID; Ru.BusinessCost = Lvm.BusinessCost; Ru.NoOfBusinessSeats = Lvm.NoOfBusinessSeats; Ru.EconomyCost = Lvm.EconomyCost; Ru.NoOfEconomySeats = Lvm.NoOfEconomySeats; db.Classes.Add(Ru); db.SaveChanges(); return(new Response { Status = "Success", Message = "SuccessFully Saved." }); } } catch (Exception) { throw; } return(new Response { Status = "Error", Message = "Invalid Data." }); }
//public ObservableCollection<Member> CastingOperation() //{ // md.strsql = "select * from Members where Members.Membership_Number not in(select MemberClasses.Membership_Number from MemberClasses)"; // ObservableCollection<Member> list = new ObservableCollection<Member>(); // foreach (DataRow row in md.ShowData().Rows) // { // Member mem = new Member(); // mem.FirstName = row["FirstName"].ToString(); // mem.LastName = row["LastName"].ToString(); // mem.Membership_Number = row["Membership_Number"].ToString(); // mem.Melli_Code = row["Melli_Code"].ToString(); // list.Add(mem); // } // return list; //} private void _btnNewClass_Click(object sender, RoutedEventArgs e) { AddClass win = new AddClass(); win.ShowDialog(); _datagridClasses.ItemsSource = db.Classes.ToList(); }
/// <summary> /// Создания прокси без DI /// </summary> public static void CleanCreate() { // объект создания прокси var generator = new ProxyGenerator(); // интерфейс (обязательно!!! иначе ругается метод CreateInterfaceProxyWithTarget), который будет что-то делать IAddInterface addClass = new AddClass(); /* * динамические перехватчики * совершают промежуточные действия перед(после) вызова самого метода */ IInterceptor addInterceptor = new AddInterceptor(); IInterceptor substractInterceptor = new SubstractInterceptor(); /* * добавление перехватчиков к классу * можно реализовать try catch в перехватчике * можно реализовать логирование * можно оборачивать в транзакцию * и тд */ var addClassWithInterceptors = generator.CreateInterfaceProxyWithTarget(addClass, addInterceptor, substractInterceptor); // вызов метода класса (перехватчики будут работать в любом методе класса) addClassWithInterceptors.Add(); }
public void Add_FwdSlashFwdSlash_Returns0() { var addclass = new AddClass(); var result = addclass.Add("//"); Assert.AreEqual(0, result); }
static void Main(string[] args) { System.Console.WriteLine("Call methods from MathLibrary.DLL:"); if (args.Length != 2) { System.Console.WriteLine("Usage: TestCode <num1> <num2>"); return; } long num1 = long.Parse(args[0]); long num2 = long.Parse(args[1]); long sum = AddClass.Add(num1, num2); long product = MultiplyClass.Multiply(num1, num2); long difference = SubtractionClass.Subtract(num1, num2); long final = DivisionClass.Divide(num1, num2); System.Console.WriteLine("Addition: {0} + {1} = {2}", num1, num2, sum); System.Console.WriteLine("Multiplication: {0} * {1} = {2}", num1, num2, product); System.Console.WriteLine("Subtraction: {0} - {1} = {2}", num1, num2, difference); System.Console.WriteLine("Division: {0} / {1} = {2}", num1, num2, final); }
public void Add_NumbersSeparatedByComma_Returns3() { var addclass = new AddClass(); var result = addclass.Add("0,1,2"); Assert.AreEqual(3, result); }
public void RunAddClass(Character character) { character.Init += character.DexMod; AddClass.AddSpellsKnown(character); AddClass.AddSpellSlots(character); AddClass.NewClass(character); if (character.DemigodDomain == "Knowledge") { Console.WriteLine("Pick a skill to gain Expertise in"); var prof = new List <string>(); prof.AddRange(character.SkillProficiencies); string expertise = CLIHelper.PrintChoices(prof); BEHelper.AddSkillExpertise(expertise, character); } if (character.Feats.ContainsKey("Weapon Master")) { Feats.WeaponMaster(character); } AddClass.ModifySkills(character); BEHelper.AddSpellDesc(character); AddClass.DetermineAC(character); AddClass.DetermineHP(character); Console.Clear(); Console.WriteLine("\nYou've finished adding your character's class!\n"); }
public void Add_SemicolonDelimiterSpecified_Returns3() { var addclass = new AddClass(); var result = addclass.Add("//;\n1;2"); Assert.AreEqual(3, result); }
static void Main(string[] args) { long result1 = AddClass.Add(2, 3); long result2 = MultiClass.Multi(2, 3); Console.WriteLine($"result1={result1},result2={ result2}"); }
public void Add_IgnoreNumbersGreaterThan1000_Returns2() { var addclass = new AddClass(); var result = addclass.Add("//;\n1001;2"); Assert.AreEqual(2, result); }
public void Add_TrimSpaceAndCombineCharactersThatConnect_Returns16() { var addclass = new AddClass(); var result = addclass.Add("//[$]\n1 2$3,1"); Assert.AreEqual(16, result); }
public void TestMultiply() { using (var calc = new AddClass()) { var ret = calc.Multiply(a, b); Assert.AreEqual(mulRet, ret); } }
public void TestMinus() { using (var calc = new AddClass()) { var ret = calc.minus(a, b); Assert.AreEqual(miRet, ret); } }
public void TestAdd() { using (var calc = new AddClass()) { var ret = calc.add(a, b); Assert.AreEqual(addRet, ret); } }
public bool AddAddClass(AddClass obj) { if (AddClasses == null) { AddClasses = new List <AddClass>(); } AddClasses.Add(obj); return(true); }
public ActionResult AddClass(AddClass item) { using (entity) { entity.AddClasses.Add(item); entity.SaveChanges(); var result = "Successfully Added!"; return(Json(result, JsonRequestBehavior.AllowGet)); } }
public bool AddAddClass(XElement element) { AddClass obj = new AddClass(this.Mod); obj.SetXML(element); return AddAddClass(obj); }
public bool AddAddClass(AddClass obj) { if (this.AddClasses == null) this.AddClasses = new List<AddClass>(); this.AddClasses.Add(obj); return true; }
public void RemoveAddClass(AddClass obj) { this.AddClasses.Remove(obj); }