public Assignment_submit Marks() { Assignment_submit asb = new Assignment_submit(); asb.Marks = Convert.ToDouble(txtmark.Text); return(asb); }
private void btnsubmit_Click_1(object sender, EventArgs e) { name = comboBox2.SelectedItem.ToString(); fid = facmng.getfac(name); var tuple = stumng.getsubmitassign(Convert.ToInt32(accmng.readkey())); if (tuple.Item1 != 0 && tuple.Item2 != 0) { lblque.Text = "Already Submitted"; } else { try { Upload up = new Upload(); Assignment_submit asb = new Assignment_submit(); asb.Fac_id = fid; asb.Date = asb.Date; up.Name = txtfilename.Text; string path = @"E:\cscolor\Sir " + name + "\\assignments\\" + up.Name; asb.Answer = path; asb.ID = Convert.ToInt32(accmng.readkey()); File.Move(txtpath.Text, path); stumng.Add(asb); lblque.Text = "Uploaded Successfully"; } catch (Exception ex) { lblque.Text = ex.Message; } } }
public List <Assignment_submit> checkmarks(int id) { Assignment_submit asb; List <Assignment_submit> mylist = new List <Assignment_submit>(); strQuery = "select * from assignment_submit where stu_id=" + id; SqlDataReader dr; try { conobj.openconnect(); cmd = conobj.execute(this.strQuery); dr = cmd.ExecuteReader(); while (dr.Read()) { asb = new Assignment_submit(); asb.Date = dr.GetDateTime(1); asb.Marks = dr.GetDouble(2); asb.Answer = dr.GetString(3); asb.Fac_id = dr.GetInt32(4); asb.ID = dr.GetInt32(5); mylist.Add(asb); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { conobj.closeconnect(); } return(mylist); }
private void addmark_Click(object sender, EventArgs e) { try { asb = Marks(); stumng.updatemarks(sid, asb); lbladdm.Text = "Added Successfully"; pmark.Visible = false; dtmarks.DataSource = facmng.getmarks(Convert.ToInt32(accmng.readkey())); } catch (Exception ex) { lbladdm.Text = ex.Message; } }
public void Add(Assignment_submit obj) { try { conobj.openconnect(); strQuery = "insert into assignment_submit (sub_date,marks,answer,fac_id,stu_id) values ('" + obj.Date + "'," + 0.1 + ",'" + obj.Answer + "'," + obj.Fac_id + "," + obj.ID + ");"; cmd = conobj.execute(this.strQuery); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Exception(ex.Message); } finally { conobj.closeconnect(); } }
public void updatemarks(int id, Assignment_submit ass) { try { conobj.openconnect(); strQuery = "update assignment_submit set marks=" + ass.Marks + " where stu_id=" + id; cmd = conobj.execute(this.strQuery); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { conobj.closeconnect(); } }