protected void Button1_Click1(object sender, EventArgs e) { if (lblFieldid.Text.Length > 0) { try { EduFieldsRepository efir = new EduFieldsRepository(); if (efir.FindBytitle(TextBox1.Text) != null) { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatTitle, Color.Red); return; } EduField editfield = new EduField(); if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text)) { editfield.FieldTitle = TextBox1.Text; } editfield.FieldID = lblFieldid.Text.ToInt(); efir.SaveEdufield(editfield); ClearForm(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green); } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red); } } }
public void loadform() { try { FacultiesRepositpry fair = new FacultiesRepositpry(); DataTable dt = fair.GetAllFaculties(); ddlfacultuy.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlfacultuy.Items.Add(new ListItem(dr["FacultyTitle"].ToString(), dr["FacultyID"].ToString())); } EduFieldsRepository fieldir = new EduFieldsRepository(); DataTable dtfield = fieldir.GetAllEduFields(); foreach (DataRow dr in dtfield.Rows) { ddlfield.Items.Add(new ListItem(dr["FieldTitle"].ToString(), dr["FieldID"].ToString())); } VEduTendenciesRepository tenir = new VEduTendenciesRepository(); DataTable ten = tenir.GetAllTendency(); foreach (DataRow dr in ten.Rows) { ddltendency.Items.Add(new ListItem(dr["TendencyTitle"].ToString(), dr["TendencyID"].ToString())); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
protected void Button2_Click(object sender, EventArgs e) { try { List <int> selectedRows = new List <int>(); foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox2") as CheckBox).Checked == true) { selectedRows.Add(gvr.Cells[0].Text.ToInt()); } } if (selectedRows.Count > 0) { EduFieldsRepository efir = new EduFieldsRepository(); efir.DeleteEduField(selectedRows); LoadFieldData(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green); } } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red); } }
public void loadform() { EduFieldsRepository efir = new EduFieldsRepository(); DataTable dt = efir.GetAllEduFields(); ddlfield.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlfield.Items.Add(new ListItem(dr["FieldTitle"].ToString(), dr["FieldID"].ToString())); } }
public void LoadFieldData() { EduFieldsRepository efir = new EduFieldsRepository(); Session["FieldData"] = efir.GetAllEduFields(); GridView1.DataSource = Session["FieldData"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", efir.FieldCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["FieldData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount); }
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { lblmessage.Text = ""; if (txtsearch.Text.Length > 0) { if (DropDownList1.SelectedValue == "0") { try { EduFieldsRepository efir = new EduFieldsRepository(); Session["Fielddatafindid"] = efir.Searchid(txtsearch.Text.ToInt()); GridView1.DataSource = Session["Fielddatafindid"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", efir.FieldCount().ToString(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Fielddatafindid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount); } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red); lblrecordcount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount); } } if (DropDownList1.SelectedValue == "1") { try { EduFieldsRepository efir = new EduFieldsRepository(); Session["Fielddatafindtitle"] = efir.SearchTitle(txtsearch.Text.ToString()); GridView1.DataSource = Session["Fielddatafindtitle"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", efir.FieldCount().ToString(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Fielddatafindtitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount); } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red); lblrecordcount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount); } } } else { LoadFieldData(); } }
public DataTable GetEduField(string username, string password) { WebServiceAccountsRepository webir = new WebServiceAccountsRepository(); WebServiceAccount currentuser = webir.FindByUserName(username); if (currentuser != null) { if (currentuser.Password == password) { EduFieldsRepository depir = new EduFieldsRepository(); return(depir.GetAllEduFields()); } else { return(null); } } else { return(null); } }
public EduField FindByEduFieldID(string username, string password, int id) { WebServiceAccountsRepository webir = new WebServiceAccountsRepository(); WebServiceAccount currentuser = webir.FindByUserName(username); if (currentuser != null) { if (currentuser.Password == password) { EduFieldsRepository depir = new EduFieldsRepository(); return(depir.FindByid(id)); } else { return(null); } } else { return(null); } }
protected void Button1_Click(object sender, EventArgs e) { EduFieldsRepository edu = new EduFieldsRepository(); if (edu.FindBytitle(TextBox1.Text) != null) { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red); return; } bool successfullCreateAccount = true; try { EduField newfield = new EduField(); newfield.FieldTitle = TextBox1.Text.Trim(); EduFieldsRepository efir = new EduFieldsRepository(); efir.SaveEdufield(newfield); ClearForm(); } catch (System.Exception err) { successfullCreateAccount = false; PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red); } if (successfullCreateAccount) { // ClearForm(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green); } }
public void LoadFieldData(string Fieldid) { try { EduFieldsRepository efir = new EduFieldsRepository(); EduField field = efir.FindByid(Fieldid.ToInt()); if (field != null) { lbltitle.Text = field.FieldTitle; lblFieldid.Text = field.FieldID.ToString(); TextBox1.Text = field.FieldTitle; } else { Redirector.Goto(Redirector.PageName.errorpage); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
public void loadform(string stdi) { //try //{ FacultiesRepositpry fair = new FacultiesRepositpry(); DataTable dt = fair.GetAllFaculties(); ddlfacultuy.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlfacultuy.Items.Add(new ListItem(dr["FacultyTitle"].ToString(), dr["FacultyID"].ToString())); } EduLevelsRepository leveir = new EduLevelsRepository(); DataTable dtlevel = leveir.GetAllEduLevels(); foreach (DataRow dr in dtlevel.Rows) { ddllevel.Items.Add(new ListItem(dr["LevelTitle"].ToString(), dr["LevelID"].ToString())); } EduFieldsRepository fieldir = new EduFieldsRepository(); DataTable dtfield = fieldir.GetAllEduFields(); foreach (DataRow dr in dtfield.Rows) { ddlfield.Items.Add(new ListItem(dr["FieldTitle"].ToString(), dr["FieldID"].ToString())); } VEduTendenciesRepository tenir = new VEduTendenciesRepository(); DataTable ten = tenir.GetAllTendency(); foreach (DataRow dr in ten.Rows) { ddltendency.Items.Add(new ListItem(dr["TendencyTitle"].ToString(), dr["TendencyID"].ToString())); } VStudentsRepository vstir = new VStudentsRepository(); VStudent std = vstir.FindByid(stdi.ToInt()); if (std != null) { lblstdid.Text = std.StudentID.ToString(); txtstdcode.Text = std.StudentCode; txtname.Text = std.FirstName; txtlastname.Text = std.LastName; RadioButtonList1.SelectedValue = std.Gender.ToString(); txtnationalcode.Text = std.NationalCode; lblfaculty.Text = std.FacultyTitle; lbllevel.Text = std.LevelTitle; lblfield.Text = std.FieldTitle; lbltend.Text = std.TendencyTitle; RadioButtonList2.SelectedValue = std.EntryTerm.ToString(); lblusername.Text = std.Username; if (txtpass.Text != null) { txtpass.Text = std.Password; } // ImageButton1.ImageUrl = std.ImageFileName; Session["newfacultyid"] = std.FacultyID.ToString(); Session["newlevelid"] = std.LevelID.ToString(); Session["newfieldid"] = std.FieldID.ToString(); Session["newtenid"] = std.TendencyID.ToString(); Session["pass"] = std.Password; chkActiveAccount.Checked = (std.Status.Value == 0 ? true : false); Session["imageurl"] = std.ImageFileName; if (Session["imageurl"].ToString() != null) { ImageButton2.ImageUrl = "~/file/" + std.ImageFileName; } } else { Redirector.Goto(Redirector.PageName.errorpage); } //} //catch //{ // Redirector.Goto(Redirector.PageName.errorpage); //} }
public void loadform(string Leci) { try { FacultiesRepositpry fair = new FacultiesRepositpry(); DataTable dt = fair.GetAllFaculties(); ddlfacultuy.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlfacultuy.Items.Add(new ListItem(dr["FacultyTitle"].ToString(), dr["FacultyID"].ToString())); } EduFieldsRepository fieldir = new EduFieldsRepository(); DataTable dtfield = fieldir.GetAllEduFields(); foreach (DataRow dr in dtfield.Rows) { ddlfield.Items.Add(new ListItem(dr["FieldTitle"].ToString(), dr["FieldID"].ToString())); } VEduTendenciesRepository tenir = new VEduTendenciesRepository(); DataTable ten = tenir.GetAllTendency(); foreach (DataRow dr in ten.Rows) { ddltendency.Items.Add(new ListItem(dr["TendencyTitle"].ToString(), dr["TendencyID"].ToString())); } VLecturersRepository vstir = new VLecturersRepository(); VLecturer Lec = vstir.FindByid(Leci.ToInt()); if (Lec != null) { lbllecid.Text = Lec.LecturerID.ToString(); txtname.Text = Lec.FirstName; txtlastname.Text = Lec.LastName; RadioButtonList1.SelectedValue = Lec.Gender.ToString(); txtnationalcode.Text = Lec.NationalCode; lblfaculty.Text = Lec.FacultyTitle; lblfield.Text = Lec.FieldTitle; lbltend.Text = Lec.TendencyTitle; lblusername.Text = Lec.Username; if (txtpass.Text != null) { txtpass.Text = Lec.Password; } // ImageButton1.ImageUrl = Lec.ImageFileName; Session["newfacultyid"] = Lec.FacultyID.ToString(); Session["pass"] = Lec.Password.ToString(); Session["newfieldid"] = Lec.FieldID.ToString(); Session["newtenid"] = Lec.TendencyID.ToString(); chkActiveAccount.Checked = (Lec.Status.Value == 0 ? true : false); Session["imageurl"] = Lec.ImageFileName.ToString(); if (Session["imageurl"].ToString() != null) { ImageButton2.ImageUrl = "~/file/" + Lec.ImageFileName; } } else { Redirector.Goto(Redirector.PageName.errorpage); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }