public ActionResult Edit(CLB giai, HttpPostedFileBase btnSelectImage) { var path = ""; var filename = ""; if (ModelState.IsValid) { if (btnSelectImage != null) { filename = btnSelectImage.FileName; path = Path.Combine(Server.MapPath("~/Content/upload/files"), filename); btnSelectImage.SaveAs(path); giai.Logo = filename; } var clb = new ClubsDao(); bool result = clb.Update(giai); if (result) { return(RedirectToAction("Index", "Clubs")); } else { ModelState.AddModelError("", "Cập nhật Club thất bại"); } } return(RedirectToAction("Index")); }
public ActionResult Create(CLB id, HttpPostedFileBase btnSelectImage) { var path = ""; var filename = ""; if (ModelState.IsValid) { if (btnSelectImage != null) { filename = btnSelectImage.FileName; path = Path.Combine(Server.MapPath("~/Content/upload/files"), filename); btnSelectImage.SaveAs(path); id.Logo = filename; } var dao = new ClubsDao(); long result = dao.Insert(id); if (result > 0) { return(RedirectToAction("Index", "Clubs")); } else { ModelState.AddModelError("", "Thêm CLB thất bại"); } } return(View("Index")); }
private void btnSuaCLB_Click(object sender, EventArgs e) { int[] SelectedRowCollection = gvCLB.GetSelectedRows(); CLB clb = bdCLB.Current as CLB; if (SelectedRowCollection.Length > 0) { txtTenCLB.Enabled = true; txtTenCLB.Text = clb.TenCLB; txtTenCLB.Tag = clb.MaCLB; btnComfirmEdit.Enabled = true; btnCOmfirmThem.Enabled = false; } else { MessageBox.Show("Chưa chọn gì sao mà sửa"); } }
private string fill4Celpip13() { string scores2; if (txtCLBLevel.Text != "") { scores2 = CLB.CLBtoCELPIPG13(int.Parse(txtCLBLevel.Text)); } else { scores2 = "0"; } txtReading.Text = scores2; txtWriting.Text = scores2; txtListening.Text = scores2; txtSpeaking.Text = scores2; return(scores2); }
public int CLBConvert() { switch (cmbTestType.SelectedIndex) { case 0: return(0); case 1: //LELTS return(CLB.IELTSGtoCLB(float.Parse(txtReading.Text), float.Parse(txtWriting.Text), float.Parse(txtListening.Text), float.Parse(txtSpeaking.Text))); case 2: // CELPIP G 14 return(CLB.CELPIPGtoCLB(int.Parse(txtReading.Text), int.Parse(txtWriting.Text), int.Parse(txtListening.Text), int.Parse(txtSpeaking.Text))); case 3: //CELPIP G 13 return(CLB.CELPIPG13toCLB(txtReading.Text, txtWriting.Text, txtListening.Text, txtSpeaking.Text)); default: return(0); } }
public bool Update(CLB entity) { try { var item = db.CLBs.Find(entity.IDclb); item.IDGiai = entity.IDGiai; item.TenClb = entity.TenClb; item.Logo = entity.Logo; item.NguoiSangLap = entity.NguoiSangLap; item.NamThanhLap = entity.NamThanhLap; item.ViTri = entity.ViTri; item.GioiThieu = entity.GioiThieu; item.meta = entity.meta; item.hide = entity.hide; item.order = entity.order; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
private List <float> fill4Ielts() { List <float> scores; if (txtCLBLevel.Text != "") { scores = CLB.CLBtoIELTSG(int.Parse(txtCLBLevel.Text)); } else { scores = new List <float> { 0f, 0f, 0f, 0f } }; if (scores[0] != 0f && scores[1] != 0f && scores[2] != 0f && scores[3] != 0f) { txtReading.Text = scores[0].ToString("0.0"); txtWriting.Text = scores[1].ToString("0.0"); txtListening.Text = scores[2].ToString("0.0"); txtSpeaking.Text = scores[3].ToString("0.0"); } return(scores); }
private List <int> fill4Celpip() { List <int> scores1; if (txtCLBLevel.Text != "") { scores1 = CLB.CLBtoCELPIPG(int.Parse(txtCLBLevel.Text)); } else { scores1 = new List <int> { 0, 0, 0, 0 } }; if (scores1[0] != 0f && scores1[1] != 0f && scores1[2] != 0f && scores1[3] != 0f) { txtReading.Text = scores1[0].ToString(); txtWriting.Text = scores1[1].ToString(); txtListening.Text = scores1[2].ToString(); txtSpeaking.Text = scores1[3].ToString(); } return(scores1); }
public static unsafe char* FindLastNot(char* start, char* end, CLB.TmphString.TmphAsciiMap valueMap) { return findLastNotAscii(start, end, valueMap.Map); }
public static unsafe int AsciiCount(char* start, char* end, CLB.TmphString.TmphAsciiMap valueMap, char value) { return AsciiCount(start, end, valueMap.Map, value); }
public static unsafe char* Find(char* start, char* end, CLB.TmphString.TmphAsciiMap valueMap, char value) { return FindAscii(start, end, valueMap.Map, value); }
public long Insert(CLB entity) { db.CLBs.Add(entity); db.SaveChanges(); return(entity.IDclb); }