protected void btnlogin_Click(object sender, EventArgs e) { if (txtEmail.Text.Trim() == "") { Alert.Show("กรุณากรอก Email ด้วย !!!"); txtEmail.Focus(); return; } if (txtPassword.Text.Trim() == "") { Alert.Show("กรุณากรอก รหัสผ่าน ด้วย !!!"); txtPassword.Focus(); return; } FruitService service = new FruitService(); MemberFruit user = service.CheckLogin(txtEmail.Text.Trim() , txtPassword.Text.Trim()); if (user != null) { Session[SessionKey.USERLOGIN] = user; Response.Redirect("index.aspx"); } else { Session[SessionKey.USERLOGIN] = null; Response.Redirect("index.aspx"); } }
public void GetCosts_Input_InvalidFormula_Throws_EvaluationException() { var fruitData = new List <Dictionary <string, object> >() { new Dictionary <string, object>() { { Constants.Country, "MX" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } }, new Dictionary <string, object>() { { Constants.Country, "BR" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } } }; _fruitDao.Setup(x => x.GetFruitData(It.IsAny <string>())).Returns(fruitData); var fruitService = new FruitService(_fruitDao.Object); Assert.Throws <NCalc.EvaluationException>(() => fruitService.GetCosts("mango", "[fixed_overhead] */ [variable_overhead]", 0, 0)); }
public void GetCosts_Input_EmptyFormula_Throws_ArgumentException() { var fruitData = new List <Dictionary <string, object> >() { new Dictionary <string, object>() { { Constants.Country, "MX" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } }, new Dictionary <string, object>() { { Constants.Country, "BR" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } } }; _fruitDao.Setup(x => x.GetFruitData(It.IsAny <string>())).Returns(fruitData); var fruitService = new FruitService(_fruitDao.Object); Assert.Throws <ArgumentException>(() => fruitService.GetCosts(string.Empty, string.Empty, 0, 0)); }
public void GetCosts_Returns_Estimates() { var fruitData = new List <Dictionary <string, object> >() { new Dictionary <string, object>() { { Constants.Country, "MX" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } }, new Dictionary <string, object>() { { Constants.Country, "BR" }, { Constants.Commodity, "mango" }, { Constants.FixedOverhead, "32.00" }, { Constants.VariableOverhead, "1.24" } } }; _fruitDao.Setup(x => x.GetFruitData(It.IsAny <string>())).Returns(fruitData); var fruitService = new FruitService(_fruitDao.Object); var costEstimates = fruitService.GetCosts("mango", "(([price_per_volume] + [variable_overhead]) * [volume]) + [fixed_overhead]", 0, 0); Assert.NotEmpty(costEstimates); }
public void GetCosts_Input_EmptyFruitName_Throws_ArgumentException() { _fruitDao.Setup(x => x.GetFruitData(It.IsAny <string>())).Returns(new List <Dictionary <string, object> >()); var fruitService = new FruitService(_fruitDao.Object); Assert.Throws <ArgumentException>(() => fruitService.GetCosts(string.Empty, string.Empty, 0, 0)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { FruitService service = new FruitService(); List<Content> contents = new List<Content>(); contents = service.getAll(); dgvcontents.DataSource = contents; dgvcontents.DataBind(); } }
public override void execute(BRemote __byps__remote, BAsyncResultIF <Object> __byps__asyncResult) { // checkpoint byps.gen.cs.GenApiClass:413 try { FruitService __byps__remoteT = (FruitService)__byps__remote; BAsyncResultSendMethod <String> __byps__outerResult = new BAsyncResultSendMethod <String>(__byps__asyncResult, new byps.test.api.BResult_10()); __byps__remoteT.Squeeze(BAsyncResultHelper.ToDelegate(__byps__outerResult)); } catch (Exception e) { __byps__asyncResult.setAsyncResult("", e); } }
protected void Page_Load(object sender, EventArgs e) { qid = Request.QueryString["qid"]; if (!Page.IsPostBack) { FruitService service = new FruitService(); Content c = service.getByID(qid); lblsubject.Text = c.PostsContent; lbldetail.Text = c.ContentDetails; } }
public void GetCosts_Returns_EmptyList() { var fruitData = new List <Dictionary <string, object> >(); _fruitDao.Setup(x => x.GetFruitData(It.IsAny <string>())).Returns(fruitData); var fruitService = new FruitService(_fruitDao.Object); var costEstimates = fruitService.GetCosts("mango", "(([price_per_volume] + [variable_overhead]) * [volume]) + [fixed_overhead]", 0, 0); Assert.Empty(costEstimates); }
protected void btnlogin_Click(object sender, EventArgs e) { if (txtsubject .Text.Trim() == "") { Alert.Show("กรุณากรอกห้วข้อบทความด้วย !!! "); txtsubject.Focus(); return; } if (txtUser.Text.Trim() == "") { Alert.Show("กรุณากรอกชื่อผู้เขียนบทความด้วย !!! "); txtUser.Focus(); return; } if (txtcontents .Text.Trim() == "") { Alert.Show("กรุณากรอกบทความด้วย !!! "); txtcontents.Focus(); return; } if (Session["update"].ToString() == ViewState["update"].ToString()) { try { FruitService service = new FruitService(); Content c = new Content(); c.PostsContent = txtsubject.Text.Trim(); c.PostsBy = _userlogin.FullName; c.ContentDetails = txtcontents.Text.Trim(); if (service.CreateContent(c)) { Clear(); Alert.Show("บันทึกเรียบร้อยแล้ว"); } Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); } catch (Exception ex) { Alert.Show(ex.Message); } } }
protected void btnlogin_Click(object sender, EventArgs e) { if (txtUserName.Text.Trim() == "") { Alert.Show("กรุณากรอกชื่อผู้เข้าใช้ด้วย "); txtUserName.Focus(); return; } if (txtpassword.Text.Trim() == "") { Alert.Show("กรุณากรอกรหัสผู้เข้าใช้ด้วย "); txtpassword.Focus(); return; } if (txtconfirmpass.Text.Trim() == "") { Alert.Show("กรุณายืนยันรหัสผู้เข้าใช้ด้วย "); txtconfirmpass.Focus(); return; } if (!txtpassword.Text.Trim().Equals(txtconfirmpass.Text.Trim())) { Alert.Show("รหัสผ่านไม่ตรงกัน "); txtpassword.Focus(); return; } if (txtEmail.Text.Trim() == "") { Alert.Show("กรุณากรอก Email ด้วย "); txtEmail.Focus(); return; } if (this.isEmail(txtEmail.Text.Trim()) == false) { Alert.Show("รูปแบบ Email ไม่ถูกต้อง "); txtEmail.Focus(); return; } if (Session["update"].ToString() == ViewState["update"].ToString()) { try { FruitService service = new FruitService(); MemberFruit mb = new MemberFruit(); mb.FullName = txtUserName.Text.Trim(); mb.Password = txtpassword.Text.Trim(); mb.Email = txtEmail.Text.Trim(); if (service.CreateMember(mb)) { Clear(); Alert.Show("บันทึกเรียบร้อยแล้ว"); } Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); Response.Redirect("login.aspx"); } catch (Exception ex) { Alert.Show("ไม่สามารถบันทึกได้ เนื่องจาก " + ex.Message); } } }
public FruitController(FruitService fruitService) { _fruitService = fruitService; }