public int updateRecord(Guid _ID, string _name, string _surname, string _phoneNumber1, string _phoneNumber2, string _phoneNumber3, string _adress, string _emailAdress, string _text) { int result = 0; if (_ID != Guid.Empty && !string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(_surname) && !string.IsNullOrEmpty(_phoneNumber1)) { GuideRecord record = new GuideRecord(); record._ID = _ID; record._name = _name; record._surname = _surname; record._phoneNumber1 = _phoneNumber1; record._phoneNumber2 = _phoneNumber2; record._phoneNumber3 = _phoneNumber3; record._adress = _adress; record._emailAdress = _emailAdress; record._text = _text; result = DLL.UpdateRecord(record); } else { result = -100;// eksik parametr xetasi. } return(result); }
public int UpdateRecord(GuideRecord G) { int result = 0; try { GetGuideRecords(); int Index = records.FindIndex(I => I._ID == G._ID); if (Index > -1) { records[Index]._name = G._name; records[Index]._surname = G._surname; records[Index]._phoneNumber1 = G._phoneNumber1; records[Index]._phoneNumber2 = G._phoneNumber2; records[Index]._phoneNumber3 = G._phoneNumber3; records[Index]._adress = G._adress; records[Index]._emailAdress = G._emailAdress; records[Index]._text = G._text; } JsonUpdate(); result = 1; } catch (Exception ex) { throw; } return(result); }
/// <summary> /// 添加一条指导记录 /// </summary> /// <param name="guide">指导记录对象</param> /// <returns>成功返回Result.添加成功,失败返回Result.添加失败</returns> public Result Insert(GuideRecord guide) { int row = gdao.Insert(guide); if (row > 0) { return(Result.添加成功); } return(Result.添加失败); }
private void ListBox1_DoubleClick(object sender, EventArgs e) { ListBox L = (ListBox)sender; GuideRecord selectedValue = (GuideRecord)L.SelectedItem; Ad_txt.Text = selectedValue._name; soyad_txt.Text = selectedValue._surname; telefon1_text.Text = selectedValue._phoneNumber1; telefon2_txt.Text = selectedValue._phoneNumber2; telefon3_txt.Text = selectedValue._phoneNumber3; adress_txt.Text = selectedValue._adress; email_txt.Text = selectedValue._emailAdress; aciqlama_txt.Text = selectedValue._text; groupBox2.Text = "Guide record update"; }
/// <summary> /// 教师提交论文指导意见 /// </summary> /// <param name="guideRecord">指导记录实体</param> /// <returns>受影响行数</returns> public int Insert(GuideRecord guideRecord) { try { string cmdText = "insert into T_GuideRecord(titleRecordId,opinion,pathId,dateTime) values(@titleRecordId,@opinion,@pathId,@dateTime)"; string[] param = { "@titleRecordId", "@opinion", "@pathId", "@dateTime" }; object[] values = { guideRecord.titleRecord.TitleRecordId, guideRecord.opinion, guideRecord.path.pathId, guideRecord.dateTime }; int row = db.ExecuteNoneQuery(cmdText.ToString(), param, values); return(row); } catch (Exception ex) { throw ex; } }
public int newRecord(GuideRecord gr) { int final = 0; try { GetGuideRecords(); records.Add(gr); JsonUpdate(); final = 1; } catch (Exception ex) { final = 0; //log operation throw; } return(final); }
public int DeleteRecord(Guid ID) { int result = 0; try { GetGuideRecords(); GuideRecord deletedValue = records.Find(I => I._ID == ID); if (deletedValue != null) { records.Remove(deletedValue); } JsonUpdate(); result = 1; } catch (Exception ex) { throw; } return(result); }
private void Button2_Click(object sender, EventArgs e) { if (listBox1.SelectedItem != null) { GuideRecord g = (GuideRecord)listBox1.SelectedItem; int result = Bll.updateRecord(g._ID, Ad_txt.Text, soyad_txt.Text, telefon1_text.Text, telefon2_txt.Text, telefon3_txt.Text, adress_txt.Text, email_txt.Text, aciqlama_txt.Text); if (result > 0) { MessageBox.Show("Qeyd yenilendi"); Fill(); } else if (result == -100) { MessageBox.Show("Eksik parametr xetasi"); } else { MessageBox.Show("Xeta bas verdi"); } } }
protected void Page_Load(object sender, EventArgs e) { tea = (Teacher)Session["loginuser"]; TitleRecordBll trbll = new TitleRecordBll(); PathBll pathBll = new PathBll(); Teacher teacher = (Teacher)Session["loginuser"]; string teaAccount = teacher.TeaAccount; collegeId = teacher.college.ColID; string addop = Context.Request.Form["op"]; string type = Request.QueryString["type"]; op = Request["op"]; try { if (op == "add") { string stuAccount = Request["stuAccount"]; string opinion = Request["opinion"]; GuideRecordBll guideBll = new GuideRecordBll(); GuideRecord guide = new GuideRecord(); DataSet dsTR = trbll.GetByAccount(stuAccount); int i = dsTR.Tables[0].Rows.Count - 1; guide.opinion = opinion; TitleRecord titleRecord = new TitleRecord(); titleRecord.TitleRecordId = Convert.ToInt32(dsTR.Tables[0].Rows[i]["titleRecordId"].ToString()); guide.titleRecord = titleRecord; guide.dateTime = DateTime.Now; path = pathBll.Select(titleRecord.TitleRecordId, stuAccount); guide.path = path; path.titleRecord = titleRecord; path.state = 1; path.type = 0; Result result = pathBll.updateState(path); if (result == Result.更新成功) { Result row = guideBll.Insert(guide); if (row == Result.添加成功) { StudentBll studentBll = new StudentBll(); Student stu = studentBll.GetModel(stuAccount); LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 教师添加 - " + stuAccount + " - " + stu.RealName + " - 学生的指导记录"); Response.Write("提交成功"); Response.End(); } else { Response.Write("提交失败"); Response.End(); } } else { Response.Write("提交失败"); Response.End(); } } else if (op == "download") { download = "download"; string account = Request["stuAccount"]; Path getTitleRecordId = pathBll.getTitleRecordId(account); int titleRecordId = getTitleRecordId.titleRecord.TitleRecordId; paperPath = pathBll.Select(titleRecordId, account); //Response.Redirect(paperPath.paperPath); Response.Write("<script>$('#loadHref').href = '" + paperPath.paperPath + "';</script>"); //Response.End(); } if (!IsPostBack) { Search(); getPage(Search()); } } catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } }