protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lbtn_shflag = (Label)GridView1.Rows[e.RowIndex].FindControl("lbl_sh"); string str_sh = lbtn_shflag.Text; string str_sql = ""; DataView dv = (DataView)Session["dv_detail"]; string str_sfzh = dv.Table.Rows[e.RowIndex + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); if (str_sh != "通过") { str_sql = string.Format("update yxxwlw_cpry set sh_flag = '{0}' where sfzh = '{1}'", "通过", str_sfzh); //GridView1.Rows[e.RowIndex].Cells[6].Text = "通过"; } else { str_sql = string.Format("update yxxwlw_cpry set sh_flag = '{0}' where sfzh = '{1}'", "未通过", str_sfzh); //GridView1.Rows[e.RowIndex].Cells[6].Text = "未通过"; } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('修改成功!');</script>"); bindData(); } else { Response.Write("<script>alert('修改失败!');</script>"); } }
protected void lbtn_commit_Click(object sender, EventArgs e) { Save(); string str_sql = string.Format("update cpry set edit_flag = {0} where sfzh = '{1}'", false, Session["sfzh"].ToString()); //if (Hidden1.Value == "admin") //{ // str_sql = string.Format("update cpry set sh_flag = '{0}' where sfzh = '{1}'", // rbtnlist_sh.SelectedValue, Session["sfzh"].ToString()); //} if (DBFun.ExecuteUpdate(str_sql)) { str_sql = "select sbzw from cpry where sfzh='" + Session["sfzh"].ToString() + "'"; string str_sbzw = DBFun.ExecuteScalar(str_sql).ToString(); if (str_sbzw == "研究员") { str_sbzw = "PrintPreview_yjy.aspx"; } else { str_sbzw = "PrintPreview_zyjgg.aspx"; } Response.Write("<script>alert('提交成功!');location.href = '" + str_sbzw + "';</script>"); } else { Response.Write("<script>alert('提交失败!');</script>"); } }
protected void bindData() { string str_sql = "select * from zjry where flag = 1 and zj_sfzh='" + Session["admin_id"].ToString() + "' and cpry_sfzh='" + lbl_cpry_sfzh.Text + "'"; DataRow dr = DBFun.GetDataRow(str_sql); if (dr == null) { return; } str_sql = "select yourname from cpry where sfzh='" + lbl_cpry_sfzh.Text + "'"; lbl_xm.Text = DBFun.ExecuteScalar(str_sql).ToString(); rbtnlist_1.SelectedValue = dr["fs_pjys1"].ToString(); rbtnlist_2.SelectedValue = dr["fs_pjys2"].ToString(); rbtnlist_3.SelectedValue = dr["fs_pjys3"].ToString(); rbtnlist_4.SelectedValue = dr["fs_pjys4"].ToString(); rbtnlist_5.SelectedValue = dr["fs_pjys5"].ToString(); rbtnlist_6.SelectedValue = dr["fs_pjys6"].ToString(); lbl_sum.Text = dr["fs_pjys_sum"].ToString(); str_sql = "select tj_flag from pszj where flag = 1 and sfzh='" + Session["admin_id"].ToString() + "'"; bool tj_flag = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); btn_commit.Visible = !tj_flag; btn_printpreview.Visible = tj_flag; if (tj_flag) { Response.Write("<script>location.href = '../PrintPreview_zhuanjia_psyjb.aspx?sfzh=" + lbl_cpry_sfzh.Text + "',target='_blank';</script>"); } try { rbtnlist_tuijian.SelectedValue = dr["fs_sftj"].ToString(); } catch {} ftb_content.Text = dr["jypj"].ToString(); }
protected void GetInfo() { string str_sql = "select name,content from t_dict where flm = " + Session["type"].ToString() + " and bm = " + DwPath.SelectedValue; DataRow dr = DBFun.GetDataRow(str_sql); ftb_content.Text = dr["content"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { //Session["sfzh"] = "230103197803220939"; if (Session["sfzh"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');</script>"); Response.Redirect("admin/admin_login.aspx?type=zgcpry"); return; } if (!IsPostBack) { hdn_flag.Value = Request.QueryString["flag"]; if (hdn_flag.Value != "admin") { string str_sql = "select count(*) from cpry where edit_flag = true and sfzh = '" + Session["sfzh"].ToString() + "'"; if (DBFun.ExecuteScalar(str_sql).ToString() == "0") { Response.Write("<script>alert('已经提交,不能再修改!');window.history.go(-1);</script>"); return; } } bindData(); this.lbtn_commit.Attributes.Add("onclick", "return confirm (\"一旦提交就不可以在修改了,确定要提交吗?\");"); } }
protected void bindData() { str_sql = " select b.LoginName,b.UserName,c.ktmc,sqr,c.cGroup1 " + " from t_zjry1 a,t_Expert b,t_teacher_list c " + " where a.zjNo=b.LoginName and a.appNo = c.appNo and left(a.appNo,4)=year(date()) "; if (ddlist_Group.SelectedValue != "全部") { str_sql = str_sql + " and cGroup1 = '" + ddlist_Group.SelectedValue + "'"; } if (ddlist_type.SelectedValue != "all") { str_sql = str_sql + " and " + ddlist_type.SelectedValue + " like '%" + tbx_search.Text.Trim() + "%'"; } str_sql = str_sql + " order by sqbm,sqr"; dv = DBFun.GetDataView(str_sql); PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.PageSize = AspNetPager1.PageSize; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.DataSource = dv; GridView1.DataSource = pds; GridView1.DataBind(); AspNetPager1.RecordCount = dv.Table.Rows.Count; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void PopulateImage(string ID) { try { dt = (DataTable)DBFun.FetchData("SELECT * FROM TempImage WHERE Type = '" + Type + "' AND EmpID='" + ID + "'"); if (DBFun.IsNullOrEmpty(dt)) { if (imgPhoto.ImageUrl != EmptyImage()) { string ImagePath = FindTempImagePath() + ID + ".jpeg"; imgPhoto.ImageUrl = ImagePath; if (!File.Exists(ImagePath)) { setImage(ID); } return; } else { imgPhoto.ImageUrl = EmptyImage(); return; } } imgPhoto.ImageUrl = "~/Images/Pages/ReadImage.aspx?Type=" + Type + "Tmp&ID=" + ID + ""; } catch (Exception e1) { DBFun.InsertError("Image", "PopulateImage()"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public string FindMaxID() { string MaxID = "20000001"; DataTable MaxDT = DBFun.FetchData("SELECT E.MaxID FROM (SELECT MAX(CONVERT(INT,EmpID) + 1) MaxID FROM EmployeeMaster WHERE EmpType IN ('Emp','Con')) AS E"); if (DBFun.IsNullOrEmpty(MaxDT)) { } else { if (MaxDT.Rows[0]["MaxID"] != DBNull.Value) { MaxID = (Convert.ToInt64(MaxDT.Rows[0]["MaxID"].ToString())).ToString(); } else { } } bool isFound = true; while (isFound) { isFound = CheckFoundID(MaxID); if (isFound) { MaxID = (Convert.ToInt64(MaxID) + 1).ToString(); } } return(MaxID); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void IDSearch_ServerValidate(Object source, ServerValidateEventArgs e) { try { if (source.Equals(cvIDSearch)) { if (string.IsNullOrEmpty(txtIDSearch.Text)) { General.ValidMsg(this, ref cvIDSearch, false, "Employee identity is required", "رقم الموظف مطلوب"); e.IsValid = false; return; } else { if ((btnSave.Text == "Save") || (btnSave.Text == "حفظ")) { dt = DBFun.FetchData("SELECT * FROM EmployeeMaster WHERE EmpID = '" + txtIDSearch.Text.Trim() + "' "); if (!DBFun.IsNullOrEmpty(dt)) { General.ValidMsg(this, ref cvIDSearch, true, "Employee ID is already exists,Please enter different ID", "رقم الموظف مضاف مسبقاً ,من فضلك اختر رقما آخر"); e.IsValid = false; return; } } } } } catch { e.IsValid = false; } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void PopulateUI(string pID) { try { if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) { DataTable myTableDT = DBFun.FetchData("SELECT * FROM EmployeeMaster WHERE EmpID = '" + pID + "' AND EmpType = '" + ddlEmpType.SelectedValue + "' "); if (DBFun.IsNullOrEmpty(myTableDT)) { ButtonAction("00", true); MessageFun.ShowMsg(this, vsSearch, cvShowMsg, MessageFun.TypeMsg.Warning, "vgSearch", General.Msg("This employee No part of " + GetNameType(Request.QueryString["ac"].ToString()), "الموظف غير موجود ضمن " + GetNameType(Request.QueryString["ac"].ToString()))); return; } FillFromDT(myTableDT); } txtEmpIdentity.Text = txtIDSearch.Text; ButtonAction("11", false); DataItemEnabled(true); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "PopulateUI"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ClearUI() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = 'Employee' AND EmpID='" + txtEmpNationalID.Text + "'"); txtEmpIdentity.Text = ""; txtEmpNameAr.Text = ""; txtEmpNameEn.Text = ""; txtJobTitleAr.Text = ""; txtJobTitleEn.Text = ""; txtEmpNationalID.Text = ""; txtMobile.Text = ""; txtEmail.Text = ""; CalBirthDate.ClearDate(); CalHireDate.ClearDate(); ddlNatID.SelectedIndex = -1; ddlBloodGroup.SelectedIndex = -1; ddlCompID.SelectedIndex = -1; ddlSecID.SelectedIndex = -1; rdlGender.SelectedIndex = 0; EmpImage.ClearImage(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Fillddl() { DataTable NatDT = DBFun.FetchData("SELECT * FROM Nationality "); if (!DBFun.IsNullOrEmpty(NatDT)) { FormCtrl.PopulateDDL(ddlNatID, NatDT, "NatName" + FormSession.Language, "NatID", General.Msg("-Select Nationality-", "-اختر الجنسية-")); rfvddlNatID.InitialValue = ddlNatID.Items[0].Text; } DataTable CompDT = DBFun.FetchData("SELECT * FROM Companies"); if (!DBFun.IsNullOrEmpty(CompDT)) { FormCtrl.PopulateDDL(ddlCompID, CompDT, "CompName" + FormSession.Language, "CompID", General.Msg("-Select Company-", "-اختر الشركة-")); rfvCompID.InitialValue = ddlCompID.Items[0].Text; } DataTable SecDT = DBFun.FetchData("SELECT * FROM SectionsExternal"); if (!DBFun.IsNullOrEmpty(SecDT)) { FormCtrl.PopulateDDL(ddlSecID, SecDT, "SecName" + FormSession.Language, "SecID", General.Msg("-Select Sections-", "-اختر الجهة الخارجية-")); rfvSecID.InitialValue = ddlSecID.Items[0].Text; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_id"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx';</script>"); return; } string str_sql = "SELECT tjdw_mc, " + " yourname, " + " ejxk_mc, " + " lw_ctitle, " + " zdjs_xm, " + " cplb , " + " '' as ry_group , score " + " FROM yxxwlw_cpry , " + " ( select round(avg(fs_pjys_sum),0) as score ,cpry_sfzh from zjry group by cpry_sfzh ) as a " + " where a.cpry_sfzh=sfzh and edit_flag = false and tj_flag = '推荐' and sh_flag = '通过' order by id asc "; if (Request.QueryString["type"] == "export") { DataTable dt = DBFun.dataTable(str_sql); CreateExcel(dt, "1", "1.xls"); return; } DataView dv = DBFun.GetDataView(str_sql); GridView1.DataSource = dv; GridView1.DataBind(); }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { DataView dv = (DataView)Session["dv_detail"]; string str_sfzh = dv.Table.Rows[e.NewEditIndex + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); Session["sfzh"] = dv.Table.Rows[e.NewEditIndex + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); if (dv.Table.Rows[e.NewEditIndex + GridView1.PageIndex * GridView1.PageSize]["sbzw"].ToString() == "研究员") { Response.Redirect("../cpry_score.aspx"); } else { Response.Redirect("../cpry_score_gg.aspx"); } CheckBox ckb = (CheckBox)GridView1.Rows[e.NewEditIndex].FindControl("ckb_Sle"); string str_editflag = ckb.Checked.ToString().ToLower(); string str_sql = string.Format("update cpry set edit_flag = {0} where sfzh = '{1}'", str_editflag, str_sfzh); if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); } else { Response.Write("<script>alert('保存失败!');</script>"); } bindData(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public string FindCount(string pID) { try { string count = "0"; DataTable CountDT = DBFun.FetchData("SELECT COUNT(VisCardID) count FROM VisitorsCard WHERE isPrinted = 'True' AND VisIdentityNo = '" + pID + "'"); if (DBFun.IsNullOrEmpty(CountDT)) { } else { if (Convert.ToInt32(CountDT.Rows[0]["count"]) > 0) { count = CountDT.Rows[0]["count"].ToString(); } } return(count); } catch (Exception e1) { DBFun.InsertError(FormSession.PageName, "FindCount"); return("0"); } }
public static bool IsAdmin(string str_AdminName) { string str_sql = "select count(*) from master where admin_name = '" + str_AdminName + "'"; bool b_flag = Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) == 1; return(b_flag); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public bool FindActiveCard(string pID) { try { bool isActive = false; DataTable DT = DBFun.FetchData("SELECT COUNT(VisCardID) count FROM VisitorsCard WHERE CardStatus = 2 AND ExpiryDate > GETDATE() AND VisIdentityNo = '" + pID + "'"); if (DBFun.IsNullOrEmpty(DT)) { } else { if (Convert.ToInt32(DT.Rows[0]["count"]) > 0) { isActive = true; } } return(isActive); } catch (Exception e1) { DBFun.InsertError(FormSession.PageName, "FindActiveCard"); return(false); } }
public static void ViewVar() { if (System.Web.HttpContext.Current.Application["AppSet"] == null) { DataRow drw = DBFun.GetDataRow("Select * From T_Setup"); //以下设置全局变量 Hashtable AppSet = new Hashtable(); AppSet.Add("WebSiteName", drw["sitename"].ToString()); AppSet.Add("PointCheat", drw["PointCheat"].ToString()); // System.Web.HttpContext.Current.Session.Timeout = Convert.ToInt32(syssetting[7]); System.Web.HttpContext.Current.Application["AppSet"] = AppSet; } if (System.Web.HttpContext.Current.Application["arUclass"] == null) { // 用户类型 DataView dvclass = DBFun.GetDataView("select * From T_Uclass"); string[,] arUclass = new string[dvclass.Table.Rows.Count, 3]; for (int j = 0; j < dvclass.Table.Rows.Count; j++) { arUclass[j, 0] = dvclass.Table.Rows[j]["Uidx"].ToString(); arUclass[j, 1] = dvclass.Table.Rows[j]["Utype"].ToString(); arUclass[j, 2] = dvclass.Table.Rows[j]["UcantBoard"].ToString(); } System.Web.HttpContext.Current.Application["arUclass"] = arUclass; } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void PopulateUI(string pID) { try { dt = DBFun.FetchData(MainQuery + " WHERE RoleID = " + pID + ""); if (DBFun.IsNullOrEmpty(dt)) { return; } txtRoleNameAr.Text = dt.Rows[0]["RoleNameAr"].ToString(); txtRoleNameEn.Text = dt.Rows[0]["RoleNameEn"].ToString(); if (dt.Rows[0]["RoleNameEn"].ToString() == "admin" || dt.Rows[0]["RoleNameAr"].ToString() == "مدير النظام") { txtRoleNameEn.Enabled = false; txtRoleNameAr.Enabled = false; PermissionsCtl.EnablePermissions(false, true); } else { txtRoleNameEn.Enabled = true; txtRoleNameAr.Enabled = true; PermissionsCtl.EnablePermissions(true, true); } PermissionsCtl.PopulatePermissions(dt.Rows[0]["RolePermissions"].ToString(), dt.Rows[0]["RoleNameEn"].ToString()); } catch (Exception e1) { } }
/// <summary> /// 判断人事管理部门是否有权登陆页面,根据是否提交 /// </summary> /// <param name="str_type">人事部门登陆页面类型 zgj 正高级 ej 专业技术二级</param> /// <param name="str_adminid">人事部门ID</param> /// <returns>bool true 不允许登陆 FALSE 允许登陆</returns> public static bool IsTimeOut(string str_type, string str_adminid) { string str_sql = ""; bool b_flag = false; if (str_type == "zgj") { str_sql = "select tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "ej") { str_sql = "select ej_tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "ts") { str_sql = "select ts_tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "lw") { str_sql = "select tj_flag from t_dict where flm = 11 and url = '" + str_adminid + "'"; } else if (str_type == "h") { str_sql = "select h_tj_flag from t_dict where flm = 11 and url = '" + str_adminid + "'"; } else if (str_type == "jy") { str_sql = "select tj_flag from t_dict where flm = 13 and url = '" + str_adminid + "'"; } b_flag = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); return(b_flag); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx';</script>"); return; } if (!IsPostBack) { string str_id = Request.QueryString["id"]; Session["type"] = str_id; string str_sql = "select bm,name from t_dict where flm = " + str_id + " order by bm;"; DataTable dt = DBFun.dataTable(str_sql); DwPath.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { ListItem litem = new ListItem(); litem.Value = dt.Rows[i]["bm"].ToString(); litem.Text = dt.Rows[i]["name"].ToString(); DwPath.Items.Add(litem); } GetInfo(); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); SqlClass.InsertUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("institution Setting saved successfully", "تم حفظ إعدادات المنشأة")); ClearUI(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
protected void btn_confirm_Click(object sender, EventArgs e) { string str_sql = ""; if (lbl_editflag.Text == "insert") { str_sql = "SELECT iif(isnull(max(bm)),1,max(bm)+1) AS maxbm FROM t_dict WHERE flm=3"; int i_maxbm = Convert.ToInt16(DBFun.ExecuteScalar(str_sql)); str_sql = string.Format("Insert Into t_dict (flm,bm,name) Values ({0},{1},'{2}')", 3, i_maxbm, tbx_name.Text); } else { str_sql = string.Format("update t_dict set name = '{0}' where flm = 3 and bm = {1}", tbx_name.Text, lbl_id.Text); } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); bindData(); TD_Add.Visible = false; } else { Response.Write("<script>alert('保存失败!');</script>"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Page_Load(object sender, EventArgs e) { try { // --------------------Common Code ----------------------------------------------------------------- // FormSession.FillSession("Employees", pageDiv); // --------------------Common Code ----------------------------------------------------------------- // if (!IsPostBack) { if (!FormSession.getPerm("FPVerify")) { Response.Redirect(@"~/Login.aspx"); } MainMasterPage.ShowTitel(General.Msg("Fingerprint verification", "التحقق بالبصمة")); hfdConnStr.Value = ConfigurationManager.ConnectionStrings["constring"].ConnectionString.Replace("\\", "...."); hfdLoginUser.Value = FormSession.LoginUsr.Replace("\\", "...."); hfdLang.Value = FormSession.Language; string ID = hfdConnStr.Value + "," + hfdLoginUser.Value + "," + hfdLang.Value; ClientScript.RegisterStartupScript(this.GetType(), "key", "javascript:Connect('" + ID + "');", true); } } catch (Exception e1) { DBFun.InsertError(FormSession.PageName, "PageLoad"); } }
protected void btn_upload_Click(object sender, EventArgs e) { string str_qry; string str_pra = UploadFile(FileUpload_photo, "photo", Session["sfzh"].ToString()); if (str_pra == "") { return; } if (str_pra == ",") { str_pra = img_photo.ImageUrl.Substring(img_photo.ImageUrl.LastIndexOf("/") + 1); } else { str_pra = str_pra.Substring(str_pra.LastIndexOf(",") + 1); } str_qry = string.Format("update cpry set photo = '{0}' where sfzh = '{1}'", str_pra, Session["sfzh"].ToString()); DBFun.ExecuteUpdate(str_qry); str_qry = "SELECT * from cpry where sfzh = '" + Session["sfzh"].ToString() + "' ;"; DataRow dr = DBFun.GetDataRow(str_qry); img_photo.ImageUrl = "./photo/" + dr["photo"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Redirect("../SessionTimeOut.aspx?type=top"); } if (!CommFun.IsAdmin(Session["admin_name"].ToString())) { Response.Redirect("../SessionTimeOut.aspx?type=isnotadmin"); } if (!IsPostBack) { str_sql = "exec Q_dict_flm3"; DBFun.FillDwList(ddlist_Group, str_sql); ddlist_Group.Items.Insert(0, "全部"); str_sql = "SELECT url,name from t_dict where flm=11 ;"; DBFun.FillDwList(ddlist_xmzt, str_sql); ddlist_xmzt.Items.Insert(0, "全部"); AspNetPager1.PageSize = Convert.ToInt16(ConfigurationManager.AppSettings.Get("PageSize")); try { ddl_PageSize.SelectedValue = ConfigurationManager.AppSettings.Get("PageSize"); } catch { ddl_PageSize.SelectedIndex = 0; } bindData(); this.GridView1.SelectedIndex = -1; } }
protected void bindData() { DataView dv; string str_sql = "SELECT yourname,xingbie,cplb ,ejxk_dm,ejxk_mc, lw_ctitle, zdjs_xm,cplb,name " + " FROM yxxwlw_cpry,t_dict" + " WHERE flm = 11 and tjdw = url and url = '" + Session["admin_id"].ToString() + "' and yxxwlw_cpry.tj_flag='推荐' and edit_flag = false order by ID asc"; dv = DBFun.GetDataView(str_sql); if (dv.Table.Rows.Count == 0) { return; } lbl_tjdw.Text = dv.Table.Rows[0]["name"].ToString(); for (int i = 0; i < dv.Table.Rows.Count; i++) { SetValue("lbl" + Convert.ToString(i + 1) + "_1", dv.Table.Rows[i]["yourname"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_2", dv.Table.Rows[i]["xingbie"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_3", dv.Table.Rows[i]["cplb"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_4", dv.Table.Rows[i]["ejxk_dm"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_5", dv.Table.Rows[i]["ejxk_mc"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_6", dv.Table.Rows[i]["lw_ctitle"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_7", dv.Table.Rows[i]["zdjs_xm"].ToString()); SetValue("lbl" + Convert.ToString(i + 1) + "_8", dv.Table.Rows[i]["cplb"].ToString()); //SetValue("lbl" + Convert.ToString(i + 1) + "_9", Convert.ToString( i+1)); } }
protected void btn_upload_Click(object sender, EventArgs e) { string str_pra = UploadFile(fu_1, "结题申请", Session["appNo"].ToString()); if (str_pra == "" || str_pra == ",") { return; } str_sql = string.Format("update t_teacher_list set jtsq = '{0}',jtsq_dName = '{1}' where appNo = '{2}'", str_pra.Substring(str_pra.IndexOf(",") + 1), str_pra.Substring(0, str_pra.IndexOf(",")), Session["appNo"].ToString()); try { if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); bingData(); } else { Response.Write("<script>alert('保存失败!');</script>"); } } catch (Exception ee) { Response.Write("<script>alert('" + ee.Message.Replace("'", "|") + "');</script>"); } }
protected void bindData() { str_sql = " SELECT appNo, a.ktmc, a.sqbm, a.sqr,c.name AS tj," + " cGroup0, a.id, pm, a.xmbh, zzlb " + " FROM t_teacher_list AS a, t_teacher AS b ,t_dict c " + " WHERE mid(a.appNo,5) = b.jsh and flm=11 and status = bm " + " and left(a.appNo,4) =year(date()) " + //" and a.sqbm in (select name from t_dict where flm=13 and tj_flag) " + " and Status >=(select url from t_dict where flm= 11 and bm = 2)"; if (ddlist_Group.SelectedIndex != 0) { str_sql += " and cGroup0 = '" + ddlist_Group.SelectedValue + "' "; } if (ddlist_type.SelectedIndex != 0) { str_sql += " and " + ddlist_type.SelectedValue + " like '%" + tbx_search.Text.Trim() + "%' "; } str_sql += " order by sqbm,sqr"; dv = DBFun.GetDataView(str_sql); PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.PageSize = AspNetPager1.PageSize; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.DataSource = dv; GridView1.DataSource = pds; GridView1.DataBind(); AspNetPager1.RecordCount = dv.Table.Rows.Count; }
private void bindData() { string strqry = "select iif(isnull(fs_pjys_sum),'0',fs_pjys_sum) as fs_sum,zj_sfzh,cpry_sfzh,jypj,UserName,zjdm,iif(isnull(fs_pjys_sum),'否','是') as sfpj from zjry,pszj where sfzh = zj_sfzh and zjry.flag = 1 "; strqry = strqry + " and cpry_sfzh = '" + Session["sfzh"].ToString() + "'"; Session["dv_zj_pingfen"] = DBFun.GetDataView(strqry); DataView dv = (DataView)Session["dv_zj_pingfen"]; GridView1.DataSource = dv; GridView1.DataBind(); lbl_sum.Text = "得分:" + PrivateFun.Get_Score_zj(dv); GridView1.ShowFooter = true; GridView1.Columns[2].FooterText = lbl_sum.Text; //strqry = " select gz,count(gz) as num from " + // " (SELECT iif(isnull(csgz),'未填写',csgz) as gz" + // " FROM cpry ,t_dict" + // " WHERE url = gzdw and t_dict.tj_flag = true and edit_flag = false and cpry.tj_flag = '推荐'"; //if (RadioButtonList1.SelectedValue != "all") // strqry = strqry + " and sh_flag = '" + RadioButtonList1.SelectedValue + "'"; //strqry = strqry + ") group by gz"; //OleDbDataReader reader = DBFun.dataReader(strqry); //lbl_tongji.Text = ""; //while (reader.Read()) //{ // lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>"; //} //DBFun.closeDataReader(ref reader); }