/// <summary> /// 设置页面状态 /// </summary> /// <param name="otype">add,mod,view,cancel,import,export</param> private void InitField(ControlHelper.CEnum etype) { this.lblExportMsg.Text = ""; try { switch (etype) { case ControlHelper.CEnum.VIEW: //查看 this.divDtls.Visible = true; this.divContent.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.CANCEL: //取消操作 this.divDtls.Visible = false; this.divContent.Visible = true; this.divExport.Visible = false; break; case ControlHelper.CEnum.Export: //导出操作 this.divDtls.Visible = false; this.divContent.Visible = false; this.divExport.Visible = true; break; } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, string spkid) { try { this.PKID.Value = spkid.ToString();//this.gvList.SelectedDataKey.Value.ToString(); string sql = "select {0}.*,bs_user.name as username,bs_user.usablescore,bs_gift.Name as gifName" + " from {0} " + " inner join bs_user on bs_user.id={0}.bs_userid " + " inner join bs_gift on bs_gift.code={0}.bs_giftcode " + " where {0}.{1}='{2}'"; sql = string.Format(sql, TblName, PKField, PKID.Value); using (DataTable dt = DBAccess.getRS(sql)) //dao.getRowItemByPKID(TblName, this.PKID.Value)) { if (dt.Rows.Count > 0) { ControlHelper.bindControlByDataRow(this.divDtls, dt.Rows[0], null); } } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, string spkid) { try { using (DataTable dt = DBAccess.getRS(Util.buildItemSQL(TblName, PKField + "='" + spkid + "'"))) //dao.getRowItemByPKID(TblName, this.PKID.Value)) { showDtls(etype, dt); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, DataTable dt) { try { if (dt.Rows.Count > 0) { this.PKID.Value = dt.Rows[0][PKField].ToString(); ControlHelper.bindControlByDataRow(this.divDtls, dt.Rows[0], null); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, string spkid) { try { this.PKID.Value = spkid.ToString(); //this.gvList.SelectedDataKey.Value.ToString(); using (DataTable dt = DBAccess.getRS(Util.buildItemSQL(TblName, PKField + "='" + PKID.Value + "'"))) //dao.getRowItemByPKID(TblName, this.PKID.Value)) { if (dt.Rows.Count > 0) { ControlHelper.bindControlByDataRow(this.divDtls, dt.Rows[0], null); } } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, string spkid) { try { this.PKID.Value = spkid.ToString(); //this.gvList.SelectedDataKey.Value.ToString(); using (DataTable dt = DBAccess.getRS(Util.buildItemSQL(TblName, PKField + "='" + PKID.Value + "'"))) //dao.getRowItemByPKID(TblName, this.PKID.Value)) { if (dt.Rows.Count > 0) { ControlHelper.bindControlByDataRow(this.divDtls, dt.Rows[0], null); } //绑定控件权限 DataTable ctrl = DBAccess.getRS("select a.pkid from sy_control a,sy_RoleCtrl b where a.pkid=b.sy_controlpkid and b.Sy_RolePKID='" + PKID.Value + "' and a.status=0"); foreach (ListItem li in chkControlList.Items) { li.Selected = false; } foreach (ListItem li in chkControlList.Items) { foreach (DataRow dr in ctrl.Rows) { if (dr["pkid"].ToString() == li.Value) { li.Selected = true; break; } } } } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 绑定明细记录 /// </summary> /// <param name="etype"></param> /// <param name="spkid"></param> private void showDtls(ControlHelper.CEnum etype, string spkid) { try { this.PKID.Value = spkid.ToString(); //this.gvList.SelectedDataKey.Value.ToString(); using (DataTable dt = DBAccess.getRS(Util.buildItemSQL(TblName, PKField + "='" + PKID.Value + "'"))) //dao.getRowItemByPKID(TblName, this.PKID.Value)) { if (dt.Rows.Count > 0) { ControlHelper.bindControlByDataRow(this.divDtls, dt.Rows[0], null); } //绑定角色 DataTable role = DBAccess.getRS("select * from sy_userrole where Sy_UserFK='" + PKID.Value + "'"); foreach (ListItem li in chkRoleList.Items) { li.Selected = false; } foreach (ListItem li in chkRoleList.Items) { foreach (DataRow dr in role.Rows) { if (dr["Sy_RoleFK"].ToString() == li.Value) { li.Selected = true; break; } } } } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 设置页面状态 /// </summary> /// <param name="otype">add,mod,view,cancel,import,export</param> private void InitField(ControlHelper.CEnum etype) { this.lblExportMsg.Text = ""; this.lblImportMsg.Text = ""; try { switch (etype) { case ControlHelper.CEnum.ADD: //新增 this.btnSvAdd.Visible = true; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsEmpty(divDtls); string pc = getViewState("pcode"); this.KK_SortNo.Value = Util.getNextSortNo(TblName, "SortNo", pc != "" ? string.Format(FKField + "='{0}'", pc) : pc).ToString(); break; case ControlHelper.CEnum.MOD: //修改 this.btnSvEdit.Visible = true; this.divDtls.Visible = true; this.btnSvAdd.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.VIEW: //查看 this.btnSvAdd.Visible = false; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsLocked(divDtls, true); break; case ControlHelper.CEnum.CANCEL: //取消操作 this.divContent.Visible = true; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.Import: //导入操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = true; this.divExport.Visible = false; break; case ControlHelper.CEnum.Export: //导出操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = true; break; } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 设置页面状态 /// </summary> /// <param name="otype">add,mod,view,cancel,import,export</param> private void InitField(ControlHelper.CEnum etype) { this.lblExportMsg.Text = ""; this.lblImportMsg.Text = ""; try { switch (etype) { case ControlHelper.CEnum.ADD: //新增 this.btnSvAdd.Visible = true; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsEmpty(divDtls); break; case ControlHelper.CEnum.MOD: //修改 this.btnSvEdit.Visible = true; this.divDtls.Visible = true; this.btnSvAdd.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.VIEW: //查看 this.btnSvAdd.Visible = false; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsLocked(divDtls, true); break; case ControlHelper.CEnum.CANCEL: //取消操作 this.divContent.Visible = true; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.Import: //导入操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = true; this.divExport.Visible = false; break; case ControlHelper.CEnum.Export: //导出操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = true; break; } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 设置页面状态 /// </summary> /// <param name="otype">add,mod,view,cancel,import,export</param> private void InitField(ControlHelper.CEnum etype) { this.lblExportMsg.Text = ""; this.lblImportMsg.Text = ""; try { switch (etype) { case ControlHelper.CEnum.ADD: //新增 this.btnSvAdd.Visible = true; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsEmpty(divDtls); this.KK_Code.Value = DateTime.Now.ToString("yyMMddss") + CSA.Text.Util.getRnd(1000, 9999); ControlHelper.setControlsLocked(divDtls, false); break; case ControlHelper.CEnum.MOD: //修改 this.btnSvEdit.Visible = true; this.divDtls.Visible = true; this.btnSvAdd.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; ControlHelper.setControlsLocked(divDtls, true); break; case ControlHelper.CEnum.VIEW: //查看 this.btnSvAdd.Visible = false; this.divDtls.Visible = true; this.btnSvEdit.Visible = false; this.divContent.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.CANCEL: //取消操作 this.divContent.Visible = true; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = false; break; case ControlHelper.CEnum.Import: //导入操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = true; this.divExport.Visible = false; break; case ControlHelper.CEnum.Export: //导出操作 this.divContent.Visible = false; this.divDtls.Visible = false; this.divImport.Visible = false; this.divExport.Visible = true; break; } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }