public void FillCheckBoxForAnnouncementBySchoolBMSID(CheckBoxList clstDivision, int SchoolID, int BMSID) { DataTable DtSelect = new DataTable(); Announcement_BLogic BAL_Announcement = new Announcement_BLogic(); //DtSelect = BAL_Announcement.FillCheckBox(SchoolID, BMSID); DataAccess DAL_Announcement = new DataAccess(); arrParameter = new ArrayList(); arrParameter.Add(new parameter("SchoolID", SchoolID)); arrParameter.Add(new parameter("BMSID", BMSID)); DtSelect = DAL_Announcement.DAL_Select("Proc_fillDivisionBySchoolID", arrParameter).Tables[0]; if (DtSelect.Rows.Count > 0) { clstDivision.Items.Clear(); clstDivision.DataSource = DtSelect; clstDivision.DataTextField = "Division"; clstDivision.DataValueField = "DivisionID"; clstDivision.DataBind(); } else { clstDivision.Items.Clear(); clstDivision.DataBind(); } }
/// <summary> /// Called when the page loads, prepares to handle any operations by setting up /// page objects. If not postback and a UserRid is supplied, gets the data /// from the web service to fill the page. /// </summary> protected void Page_Load(object sender, System.EventArgs e) { Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString())); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); ////Security Defect - CH1 -START Added the below code to verify if the IP address of the login page and current page is same //string ipaddr1 = Request.UserHostAddress; //if (Request.Cookies["AuthToken"] == null) //{ // Response.Redirect("/PaymentToolmscr/Forms/login.aspx"); //} //else if (!ipaddr1.Equals( // Request.Cookies["AuthToken"].Value)) //{ // // redirect to the login page in real application // Response.Redirect("/PaymentToolmscr/Forms/login.aspx"); //} ////Security Defect - CH1 -End Added the below code to verify if the IP address of the login page and current page is same //else //{ string CurrentUser = Page.User.Identity.Name; //STAR Retrofit II.Ch1 - START :The boolean variable "Initialized" has been commented as it is no longer being used. //if (!Initialized) Initialize(); //STAR Retrofit II.Ch1 - END //STAR Retrofit II.Ch3 - START :The condition to check if the Cache "AUTH_REPDO" is null has been included in the Page_Load event.If it is //null,then the Initialize() function is called to populate the cache if (Cache["AUTH_REPDO"] == null) { Initialize(); } //STAR Retrofit II.Ch3 - END if (!IsPostBack) { _DO.DataSource = (DataTable)Cache["AUTH_REPDO"]; _DO.DataBind(); _AppName.DataSource = GetApps(); //(DataTable)Context.Items["Apps"]; _AppName.DataBind(); AppName = (string)Context.Items["AppName"]; OrderService.AppId = AppName; _Roles.DataSource = OrderService.LookupDataSet("Authentication", "GetRoles", new object[] { AppName }); _Roles.DataBind(); UserRid = (int)Context.Items["UserRid"]; if (UserRid != 0) { GetUserInfo(); } else if (Context.Items.Contains("DO")) { CSAAWeb.WebControls.ListC.SetListIndex(_DO, (string)Context.Items["DO"]); } } //} }
/// <summary> /// Preenche GridView /// </summary> /// <typeparam name="T">Tipo de dados da listagem</typeparam> /// <param name="chkList">Cridview a ser preenchido</param> /// <param name="ListaDados">Lista com dados para preencher gridview</param> public static void Preencher <T>(this CheckBoxList chkList, List <T> ListaDados, string dataTextField, string dataValueFiled) { // Descarrega dropdown list chkList.DataSource = null; chkList.DataBind(); // Carrega dropdown list chkList.DataSource = ListaDados; chkList.DataTextField = dataTextField; chkList.DataValueField = dataValueFiled; chkList.DataBind(); }
protected void bindInfo(DataTable dt, string st_id, string DEP_NAME, int i) { if (dt.Rows.Count != 0) { TableRow tr = new TableRow(); TableCell td1 = new TableCell();//ē¬¬äøåäøŗéØéØåē§° td1.Width = 85; Label lab = new Label(); lab.Text = DEP_NAME + ":"; Label lab1 = new Label(); lab1.ID = "dep" + i.ToString(); lab1.Text = st_id; lab1.Visible = false; td1.Controls.Add(lab); td1.Controls.Add(lab1); tr.Cells.Add(td1); CheckBoxList cki = new CheckBoxList();//ē¬¬äŗåäøŗé¢åƼēå§å cki.ID = "cki" + i.ToString(); cki.DataSource = dt; cki.DataTextField = "ST_NAME"; //é¢åƼēå§å cki.DataValueField = "ST_ID"; //éØéØēē¼å· cki.DataBind(); for (int k = 0; k < cki.Items.Count; k++) { cki.Items[k].Attributes.Add("Onclick", "CheckBoxList_Click(this)"); //ä½æēØäŗjavascriptä½æå ¶åŖč½å¾éäøäøŖ } cki.RepeatColumns = 5; //č·åę¾ē¤ŗēåę° TableCell td2 = new TableCell(); td2.Controls.Add(cki); tr.Cells.Add(td2); t.Controls.Add(tr); } }
// public static int bindDropDownWithRowsCountEn(string ProcName, DropDownList ddl, string parm1, string parm2, string parm3) // { // DataSet ds = new DataSet(); // if (parm1.Length > 0 && parm1 != "") // { // List<SqlParameter> parameters = new List<SqlParameter>(); // parameters.Add(new SqlParameter("@Parm1", parm1)); // if (parm2.Length > 0 && parm2 != "") // parameters.Add(new SqlParameter("@Parm2", parm2)); // if (parm3.Length > 0 && parm3 != "") // parameters.Add(new SqlParameter("@Parm3", parm3)); // ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName, parameters.ToArray()); // } // else // { // ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName); // } // ddl.Items.Clear(); // if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) // { // ddl.DataSource = ds; // ddl.DataTextField = "ValueText"; // ddl.DataValueField = "ValueId"; // ddl.DataBind(); // } // ddl.Items.Insert(0, new ListItem("Select One", "0", true)); // return ds.Tables[0].Rows.Count; // } public static void bindCheckbox(string ProcName, CheckBoxList ddl, string parm1, string parm2, string parm3) { DataSet ds = new DataSet(); if (parm1.Length > 0 && parm1 != "") { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@Parm1", parm1)); if (parm2.Length > 0 && parm2 != "") { parameters.Add(new SqlParameter("@Parm2", parm2)); } if (parm3.Length > 0 && parm3 != "") { parameters.Add(new SqlParameter("@Parm3", parm3)); } ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName, parameters.ToArray()); } else { ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName); } ddl.Items.Clear(); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { ddl.DataSource = ds; ddl.DataTextField = "ValueText"; ddl.DataValueField = "ValueId"; ddl.DataBind(); } }
public void BindCheckedList(CheckBoxList theListBox, DataTable theDT, string theTextField, string theValueField) { theListBox.DataSource = theDT; theListBox.DataTextField = theTextField; theListBox.DataValueField = theValueField; theListBox.DataBind(); }
/// <summary> /// ē»å®CheckBoxList /// </summary> /// <param name="cbl"></param> /// <param name="id"></param> /// <param name="text"></param> /// <param name="dt"></param> public static void CheckBoxListBind(CheckBoxList cbl, string id, string text, DataTable dt) { cbl.DataSource = dt; cbl.DataTextField = text; cbl.DataValueField = id; cbl.DataBind(); }
public MultipleSelectControl(MultipleSelect item, RepeatDirection direction) { this.item = item; l = new Label(); l.Text = item.Title; l.CssClass = "label"; l.AssociatedControlID = item.Name; this.Controls.Add(l); list = new CheckBoxList(); list.RepeatDirection = direction; list.ID = item.Name; list.CssClass = "alternatives"; list.DataSource = item.GetChildren(); list.DataTextField = "Title"; list.DataValueField = "ID"; list.DataBind(); this.Controls.Add(list); if (item.Required) { cv = new CustomValidator { Display = ValidatorDisplay.Dynamic, Text = "*" }; cv.ErrorMessage = item.Title + " is required"; cv.ServerValidate += (s, a) => a.IsValid = !string.IsNullOrEmpty(AnswerText); cv.ValidationGroup = "Form"; this.Controls.Add(cv); } }
private Table ShrTable(string i) { string sql = "select st_ID,st_name from TBDS_STAFFINFO where st_depid='07' and ST_PD='0'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); Table tctrl = new Table(); if (dt.Rows.Count != 0) { TableRow tr = new TableRow(); TableCell td = new TableCell(); CheckBoxList cki = new CheckBoxList(); cki.ID = "cki" + i; cki.DataSource = dt; cki.DataTextField = "ST_NAME"; //é¢åƼēå§å cki.DataValueField = "ST_ID"; //é¢åƼēē¼å· cki.DataBind(); for (int k = 0; k < cki.Items.Count; k++) { cki.Items[k].Attributes.Add("Onclick", "CheckBoxList_Click(this)"); //ä½æēØäŗjavascriptä½æå ¶åŖč½å¾éäøäøŖ } cki.RepeatColumns = 5; //č·åę¾ē¤ŗēåę° td.Controls.Add(cki); tr.Cells.Add(td); tctrl.Controls.Add(tr); } return(tctrl); }
public static void LlenaControl(CheckBoxList control, DataSet dataset, string datatext, string datavalue, string valuecompare, bool blanco, bool bloqueo) { control.DataSource = dataset.Tables[0].DefaultView; control.DataTextField = datatext; control.DataValueField = datavalue; control.DataBind(); if (blanco) { control.Items.Add(new ListItem("", "0")); control.Items[control.Items.Count - 1].Selected = true; } for (int i = 0; i < dataset.Tables[1].Rows.Count; i++) { for (int pos = 0; pos < control.Items.Count; pos++) { if (control.Items[pos].Value == dataset.Tables[1].Rows[i][valuecompare].ToString()) { control.Items[pos].Selected = true; } if (bloqueo) { control.Items[pos].Enabled = false; } } } }
public static void BindCBL(CheckBoxList cblControl, DataTable dt, string DataTextField, string DataValueField) { cblControl.DataValueField = DataValueField; cblControl.DataTextField = DataTextField; cblControl.DataSource = dt; cblControl.DataBind(); }
/// <summary> /// Initialize the form /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (_macroList.Items.Count < 1) { _macroList.DataValueField = "Alias"; _macroList.DataTextField = "Name"; _macroList.DataSource = Macro.GetAll(); _macroList.DataBound += new EventHandler(MacroList_DataBound); } if (!Page.IsPostBack) { if (MaxNumber != 0) { _txtMaxNumber.Text = MaxNumber.ToString(); } if (PreferedWidth != 0) { _txtPreferedWidth.Text = PreferedWidth.ToString(); } if (PreferedHeight != 0) { _txtPreferedHeight.Text = PreferedHeight.ToString(); } } _macroList.DataBind(); }
/// <summary> /// ēØsqlåØęē»å®CheckBoxList /// </summary> /// <param name="cbl">CheckBoxListę§ä»¶</param> /// <param name="sql">ę„čÆ¢čÆå„</param> /// <param name="text">ęę¬</param> /// <param name="value">å¼</param> public void bindCheckBoxList(CheckBoxList ckl, string sql, string text, string value) { ckl.DataSource = DBCallCommon.GetDTUsingSqlText(sql); ckl.DataTextField = text; ckl.DataValueField = value; ckl.DataBind(); }
protected void gvProcess_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //é¼ ę ē§»åØå°ęÆ锹ę¶é¢č²äŗ¤ęæęę e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //č®¾ē½®ę¬ęµ®é¼ ę ęéå½¢ē¶äøŗ"å°ę" e.Row.Attributes["style"] = "Cursor:hand"; CheckBoxList ckblOpration = e.Row.FindControl("ckblOperation") as CheckBoxList; if (ckblOpration != null) { DataTable dt = RoleInfo.getOperationList(); ckblOpration.DataSource = dt; ckblOpration.DataTextField = "OperationName"; ckblOpration.DataValueField = "OperationId"; ckblOpration.DataBind(); } int roleid = Convert.ToInt32(gvProcess.DataKeys[e.Row.RowIndex]["RoleId"].ToString()); int processid = Convert.ToInt32(gvProcess.DataKeys[e.Row.RowIndex]["ProcessId"].ToString()); InitOperation(processid, roleid, ckblOpration); } }
/// <summary> /// Asigna una colecciĆ³n de objeto a un CheckList. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="elem"></param> /// <param name="lst"></param> /// <param name="key"></param> /// <param name="val"></param> public static void DataBind <T>(CheckBoxList elem, IEnumerable <T> lst, Expression <Func <T, int> > key, Expression <Func <T, string> > val) { elem.DataSource = lst; elem.DataTextField = HelperLinq.GetExpresionName(val); elem.DataValueField = HelperLinq.GetExpresionName(key); elem.DataBind( ); }
public static void CargarChekBoxList <T>(ref CheckBoxList ChekBox, List <T> Lista, string Valor, string Texto) { ChekBox.DataSource = Lista; ChekBox.DataTextField = Texto; ChekBox.DataValueField = Valor; ChekBox.DataBind(); }
public void LlenaCheckBoxList(string SP, ref CheckBoxList CBL, string[] parametros, string[] valores, ref List <Comun> Etiquetas) { try { List <Comun> Lista = new List <Comun>(); CD_Comun CDComun = new CD_Comun(); CDComun.LlenaCombo(SP, ref Lista, parametros, valores); CBL.Items.Clear(); if (Lista.Count > 0) { Etiquetas = Lista; CBL.DataSource = Lista; CBL.DataValueField = "IdStr"; CBL.DataTextField = "Descripcion"; CBL.DataBind(); } else { CBL.Items.Add("La opciĆ³n no contiene datos"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static void fillServicios(CheckBoxList lbox) { lbox.DataSource = CatalogCtrl.ServicioLst(); lbox.DataTextField = "nombre"; lbox.DataValueField = "id"; lbox.DataBind(); }
public static void fillClienteCopias(CheckBoxList lbox) { lbox.DataSource = CatalogCtrl.ClienteCopiaLst(); lbox.DataTextField = "nombre"; lbox.DataValueField = "id"; lbox.DataBind(); }
/// <summary> /// /// </summary> /// <param name="channelID"></param> /// <param name="cblStation"></param> /// <param name="isSelected"></param> static public void StationOfChannelBind(int channelID, CheckBoxList cblStation, bool isSelected) { //ListItem item = this.ddlChannel.SelectedItem; //if (item != null) //{ //int id = int.Parse(item.Value); //WaterUserClass wu = GetWaterUser(); //if (wu != null) //{ //ChannelClass ch = wu.ChannelCollection.GetChannelByID(id); ChannelClass ch = ChannelFactory.CreateChannel(channelID); if (ch != null) { ListItemCollection stationList = GetStationListItemCollection(ch.StationCollection); cblStation.DataTextField = "Text"; cblStation.DataValueField = "Value"; cblStation.DataSource = stationList; cblStation.DataBind(); foreach (ListItem stitem in cblStation.Items) { stitem.Selected = isSelected; } } //} //} }
protected void gvDoctores_RowEditing(object sender, GridViewEditEventArgs e) { try { gvDoctores.EditIndex = e.NewEditIndex; // cambiar a modo editar LlenargvDoctores(); //recargar el gv DropDownList ddlSexo = (DropDownList)gvDoctores.Rows[e.NewEditIndex].FindControl("ddlSexoEIT"); ddlSexo.DataSource = new BusSexo().Obtener(); ddlSexo.DataTextField = "Nombre_Sexo"; ddlSexo.DataValueField = "Id_Sexo"; ddlSexo.DataBind(); ddlSexo.SelectedValue = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Sexo_Doctor"].ToString(); RadioButtonList rbinter = (RadioButtonList)gvDoctores.Rows[e.NewEditIndex].FindControl("rbInterEIT"); rbinter.DataSource = new BusIntervencion().Obtener(); rbinter.DataTextField = "Nombre_Intervencion"; rbinter.DataValueField = "Id_Intervencion"; rbinter.DataBind(); rbinter.DataSource = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Intervencion_Doctor"].ToString(); CheckBoxList chkTurno = (CheckBoxList)gvDoctores.Rows[e.NewEditIndex].FindControl("chkTurnoEIT"); chkTurno.DataSource = new BusTurno().Obtener(); chkTurno.DataTextField = "Nombre_Turno"; chkTurno.DataValueField = "Id_Turno"; chkTurno.DataBind(); chkTurno.DataSource = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Turno_Doctor"].ToString(); } catch (Exception ex) { MostrarMensaje(ex.Message); } }
public CheckBoxList BindCheckBoxList(string TableName, string FieldName, string ValueID, string condition, CheckBoxList chk) { try { SqlCommand cmd = new SqlCommand("select " + FieldName + "," + ValueID + " from " + TableName + " where " + condition + "", conn); if (conn.State != ConnectionState.Open) { conn.Open(); } SqlDataReader dr = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); conn.Close(); if (dt.Rows.Count > 0) { chk.Items.Clear(); chk.DataTextField = FieldName; chk.DataValueField = ValueID; chk.DataSource = dt; chk.DataBind(); return(chk); } else { chk.Items.Clear(); return(null); } } catch { return(null); } }
/// <summary> /// ē»å®DataTable:CheckBoxListå¤éę” /// </summary> /// <param name="dt">DataTable</param> /// <param name="rbllist">ę§ä»¶åē§°</param> /// <param name="_Name">ē»å®åꮵåē§°</param> /// <param name="_ID">ē»å®åꮵäø»é®</param> public static void BindCheckBoxList(DataTable dt, CheckBoxList checkList, string _Name, string _ID) { checkList.DataSource = dt; checkList.DataTextField = _Name; checkList.DataValueField = _ID; checkList.DataBind(); }
protected void rptSME_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = e.Item.DataItem as DataRowView; CheckBox chkSubLevel = (CheckBox)e.Item.FindControl("chkSubLevel"); CheckBoxList chkSubjects = (CheckBoxList)e.Item.FindControl("chkSubjects"); HiddenField hdnSublevelId = (HiddenField)e.Item.FindControl("hdnSublevelId"); Button btnUpdateAssign = e.Item.NamingContainer.NamingContainer.FindControl("btnUpdateAssign") as Button; DataTable dtResults = (DataTable)ViewState["Results"]; var subjects = from DataRow myRow in dtResults.Rows where (int)myRow["SubLevelId"] == int.Parse(hdnSublevelId.Value) select myRow; if (subjects.Any()) { DataTable dt = subjects.CopyToDataTable(); chkSubjects.DataTextField = "SubjectName"; chkSubjects.DataValueField = "SubjectId"; chkSubjects.DataSource = dt; chkSubjects.DataBind(); btnUpdateAssign.Visible = true; } else { btnUpdateAssign.Visible = false; } } }
public static void chkListLlenaValoresConDT(DataTable pDT, ref CheckBoxList pchkl, string pValue, string pTextField) { pchkl.DataSource = pDT; pchkl.DataTextField = pTextField; pchkl.DataValueField = pValue; pchkl.DataBind(); }
//ē»å®checkboxlist public static void BindCheckBoxList(CheckBoxList cb, DataSet ds, string DataText, string DataValue) { cb.DataSource = ds; cb.DataTextField = DataText; cb.DataValueField = DataValue; cb.DataBind(); }
/// <summary> /// /// </summary> /// <param name="cbl"></param> /// <param name="id"></param> public void cbldata(CheckBoxList cbl, int id) { cbl.DataSource = ModuleService.GetChild(id); cbl.DataTextField = "modulename"; cbl.DataValueField = "id"; cbl.DataBind(); }
public static void BindCheckBoxList(CheckBoxList checkboxlist, IEnumerable enumerable, string dataTextField, string dataValueField) { checkboxlist.DataSource = enumerable; checkboxlist.DataTextField = dataTextField; checkboxlist.DataValueField = dataValueField; checkboxlist.DataBind(); }
private void Get_Receiver() { //ę¶ęå string sql = "select ST_ID,ST_NAME from TBDS_STAFFINFO where ST_DEPID='10' and ST_PD='0'"; DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql); if (dt1.Rows.Count != 0) { Table t = new Table(); TableRow tr = new TableRow(); TableCell td = new TableCell(); CheckBoxList cki = new CheckBoxList(); cki.ID = "cki1"; cki.DataSource = dt1; cki.DataTextField = "ST_NAME"; //é¢åƼēå§å cki.DataValueField = "ST_ID"; //é¢åƼēē¼å· cki.DataBind(); for (int k = 0; k < cki.Items.Count; k++) { cki.Items[k].Attributes.Add("Onclick", "CheckBoxList_Click(this)"); //ä½æēØäŗjavascriptä½æå ¶åŖč½å¾éäøäøŖ } cki.RepeatColumns = 5; //č·åę¾ē¤ŗēåę° td.Controls.Add(cki); tr.Cells.Add(td); t.Controls.Add(tr); pal_select1_inner.Controls.Add(t); } }
protected void rptModule_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Module module = (Module)e.Item.DataItem; CheckBoxList chkList_Item = (CheckBoxList)e.Item.FindControl("chkList_Item"); if (chkList_Item != null && lstAllOperation != null) { chkList_Item.DataSource = lstAllOperation.Where(p => p.ModuleID == module.ID).OrderBy(p => p.OrderNum).ToList(); chkList_Item.DataTextField = "Name"; chkList_Item.DataValueField = "ID"; chkList_Item.DataBind(); SetCheckListBoxSelected(chkList_Item); } } } catch { throw new Exception("ē»å®moduleåŗé"); } }
} //Nįŗ”p danh sĆ”ch nhĆ¢n viĆŖn lĆŖn Gridview public void NapDSQuyen() { QuyenCollection quyenColl = new QuyenCollection(); quyenColl = quyenBUS.TimDSQuyen(); for (int i = 0; i < 6; i++) { CheckBoxList cblist = new CheckBoxList(); cblist = QuyenTab.Tabs[i].FindControl("CheckBoxList"+(i+1).ToString()) as CheckBoxList; if (quyenColl.Index(i).ChiTietQuyen == null) break; cblist.DataSource = quyenColl.Index(i).ChiTietQuyen; cblist.DataTextField = "TenCTQuyen"; cblist.DataValueField = "MaCTQuyen"; cblist.DataBind(); } }// nįŗ”p danh sĆ”ch quyį»n cho TabControl
public static void BindModalitiesDDL(string addText, CheckBoxList ddl) { RISDatabaseAccessLayer dataAccess = new RISDatabaseAccessLayer(); SqlConnection connection = (SqlConnection)dataAccess.GetConnection(); connection.Open(); SqlCommand command = new SqlCommand("sp_get_modalities", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@addText", addText); SqlDataReader reader = command.ExecuteReader(); ddl.DataSource = reader; ddl.DataMember = "Name"; ddl.DataTextField = "Name"; ddl.DataValueField = "ModalityId"; ddl.DataBind(); reader.Close(); connection.Close(); }
//č¾åŗäøäøŖåꮵ //li_tdnums_onerowļ¼å½åč”å·²č¾åŗäŗå å //li_colnums_showļ¼ęÆč”ę¾ē¤ŗå åļ¼ę åę åµäøļ¼ //pi_isnewdoc 0:ę°ęę”£ 1ļ¼ę§ęę”£ //ifhavaroleļ¼č”ØåäøęÆå¦ęęé 0ļ¼lableč¾åŗ 1ļ¼inputč¾åŗ //ifflowdocļ¼ęÆå¦ęµēØč”Øå 0ļ¼éęµēØ 1ļ¼ęµēØ //curtacheid:å½åēÆčID,ēØäŗå¤ęåꮵęÆå¦åØå½åēÆčęęé public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid) { int li_return = li_tdnums_onerow; string ls_laborinput = "0"; //č¾åŗLABLEčæęÆINPUT 0ļ¼LABLE 1ļ¼INPUT HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text); int li_left = 30; int li_right = 70; if (dtfield.Rows.Count > 0) { string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //åꮵē±»å if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5") //å¦ęč®¾ē½®äŗäøę¾ē¤ŗ左侧čÆ“ęęåļ¼åäøå č½½å·¦ä¾§å { li_return += 1; //ęå „åå ę ¼ļ¼å·¦ä¾§ļ¼ TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); tCell.Width = Unit.Percentage((li_left / li_colnums_show)); tCell.Height = Unit.Pixel(30); tCell.CssClass = "Tdcellleft"; tCell.HorizontalAlign = HorizontalAlign.Center; tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString())); } else { li_left = 50; li_right = 50; } //ęå „åå ę ¼ļ¼å³ä¾§ļ¼ TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); tCell2.Width = Unit.Percentage((li_right / li_colnums_show)); tCell2.Height = Unit.Pixel(30); tCell2.CssClass = "Tdcellright"; if (dtfield.Rows[0]["hy_align"].ToString() == "left") { tCell2.HorizontalAlign = HorizontalAlign.Left; } if (dtfield.Rows[0]["hy_align"].ToString() == "center") { tCell2.HorizontalAlign = HorizontalAlign.Center; } if (dtfield.Rows[0]["hy_align"].ToString() == "right") { tCell2.HorizontalAlign = HorizontalAlign.Right; } tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); //čµå¼ļ¼ę°ęę”£åé ē½®ēé»č®¤å¼ļ¼ę§ęę”£åę°ę®åŗč”Øäøēå¼ļ¼ string field_docvalue = ""; if (pi_isnewdoc == "0") //ę°ęę”£ { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0") { field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString(); //ęå·„é ē½® } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1") { DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString()); field_docvalue = dt_getfieldvalue.Rows[0][0].ToString(); //SQLčÆå„ } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2") { field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); //SESSION } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3") { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd"); //å½åę¶é“ else field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss"); //å½åę¶é“ } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4") { //čŖåØēę if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "ę°å¼") { //å¾å°ē®åę大ēę°å¼ļ¼ē¶å+1ļ¼ęŖę¾å°åčµå¼äøŗ1 DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text); if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "") field_docvalue += "1"; else field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString(); } else { field_docvalue += System.Guid.NewGuid().ToString(); } } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "5") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } } else { if (field_type == "ęę¬" || field_type == "å¤č”ęę¬" || field_type == "å¤č”ęę¬_TEXT" || field_type == "ęę¬å ęé®" || field_type == "å¤č”ęę¬å ęé®" || field_type == "ę„ę" || field_type == "ę°å¼" || field_type == "åƹčÆę”åč”Ø" || field_type == "å¤éę”" || field_type == "åéę”" || field_type == "å£ä»¤" || field_type == "ē¼č¾åØ") { string ls_sql = "select hyc_" + hy_fieldid + " from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getdocvalue = Hyoa_global.GetDataTable(ls_sql); if (dt_getdocvalue.Rows.Count > 0) { field_docvalue = dt_getdocvalue.Rows[0][0].ToString(); if (field_type == "ę„ę") { if (field_docvalue.Length > 8) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = " "; } else { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { field_docvalue = System.DateTime.Parse(field_docvalue).ToString("yyyy-MM-dd"); } } } } } } if (field_type == "čÆ“ęęå") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } //å¤ęęÆč¾åŗLABLčæęÆINPUT if (pi_isnewdoc == "0") //ę°ęę”£ { if (ifflowdoc == "0") //éęµēØ { if (ifhavarole == "1") //ęęé { ls_laborinput = "1"; } } else { if (ifhavarole == "1") //ęęé { //ęęµēØ(å¤ęå½åēÆččæäøŖåꮵęÆå¦ęęé) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); if (ls_laborinput == "0") { field_docvalue = ""; } } else { field_docvalue = ""; } } } else //ę§ęę”£ { if (ifflowdoc == "0") //éęµēØ { if (ifhavarole == "1") //ęęé { ls_laborinput = "1"; //å¦ęęę”£å·²ē»ē”®č®¤ļ¼åč¾åŗlable string ls_sql = "select hy_ifconfirm from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getifconfirm = Hyoa_global.GetDataTable(ls_sql); if (dt_getifconfirm.Rows.Count > 0) { if (dt_getifconfirm.Rows[0]["hy_ifconfirm"].ToString() == "1") ls_laborinput = "0"; } } } else { if (ifhavarole == "1") //ęęé { //ęęµēØ(å¤ęå½åēÆččæäøŖåꮵęÆå¦ęęé) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); //å¦ęęµēØē»ęäŗļ¼åč¾åŗlable if (hy_curtacheid.Text == "**") { ls_laborinput = "0"; } } } } //å¦ęęÆč¾åŗLABLEļ¼å¼äøŗē©ŗåčµäøŗ äøäøŗē©ŗę¶éč¦č½¬ę¢åč½¦åē©ŗę ¼ if (ls_laborinput == "0") { if (field_docvalue == "") { field_docvalue = " "; } else { if (field_type != "ē¼č¾åØ") { field_docvalue = RtfToText(field_docvalue); } } } //åč”ęę¬ if (field_type == "ęę¬") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //å¤č”ęę¬ if (field_type == "å¤č”ęę¬") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //å¤č”ęę¬_TEXT if (field_type == "å¤č”ęę¬_TEXT") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //ęé® if (field_type == "ęé®") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //äøē“ę¾ē¤ŗēęé® if (field_type == "äøē“ę¾ē¤ŗēęé®") { //-----å¼å§č¾åŗåꮵ------ Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } //ę„ę if (field_type == "ę„ę") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //ęę¬å ęé® if (field_type == "ęę¬å ęé®") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("60%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' é ę© ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //å¤č”ęę¬å ęé® if (field_type == "å¤č”ęę¬å ęé®") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' é ę© ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //ęč§å ęé® if (field_type == "ęč§å ęé®") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } //txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' é ę© ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" /><input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_cz' value=' é ē½® ' class=btn3 onclick=\"document.getElementById('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "').value='';\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //ę°å¼ if (field_type == "ę°å¼") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //åƹčÆę”åč”Øļ¼äøęę” if (field_type == "åƹčÆę”åč”Ø") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { DropDownList ddlDropDownList = new DropDownList(); ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //ęå·„é ē½® if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { ddlDropDownList.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQLčÆå„ if (dtfield.Rows[0]["hy_options"].ToString() != "") { //å¦ęSQLčÆå„äøå«ęē¹ę®ę ē¤ŗļ¼åéč¦ęæę¢ string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("ēØę·ID")) { ls_sql = ls_sql.Replace("ēØę·ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("ēØę·å")) { ls_sql = ls_sql.Replace("ēØę·å", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("éØéØID")) { ls_sql = ls_sql.Replace("éØéØID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("éØéØå")) { ls_sql = ls_sql.Replace("éØéØå", "'" + Session["hydeptname"].ToString() + "'"); } DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); ddlDropDownList.DataSource = dt_options; ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataBind(); } } ddlDropDownList.Items.Insert(0, new ListItem("--čÆ·éę©--", "")); ddlDropDownList.SelectedValue = field_docvalue; tCell2.Controls.Add(ddlDropDownList); } } //å¤éę”(ę„čÆ¢ę¶ē“ę„ę¾ē¤ŗęę¬ę”) if (field_type == "å¤éę”") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { CheckBoxList txtTextBox = new CheckBoxList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //ęå·„é ē½® if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQLčÆå„ //å¦ęSQLčÆå„äøå«ęē¹ę®ę ē¤ŗļ¼åéč¦ęæę¢ string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("ēØę·ID")) { ls_sql = ls_sql.Replace("ēØę·ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("ēØę·å")) { ls_sql = ls_sql.Replace("ēØę·å", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("éØéØID")) { ls_sql = ls_sql.Replace("éØéØID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("éØéØå")) { ls_sql = ls_sql.Replace("éØéØå", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } if (field_docvalue != "") { field_docvalue = "," + field_docvalue + ","; foreach (ListItem li in txtTextBox.Items) { if (field_docvalue.Contains(li.Value)) li.Selected = true; } } tCell2.Controls.Add(txtTextBox); } } //åéę”(ę„čÆ¢ę¶ē“ę„ę¾ē¤ŗęę¬ę”) if (field_type == "åéę”") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { RadioButtonList txtTextBox = new RadioButtonList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //ęå·„é ē½® if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQLčÆå„ //å¦ęSQLčÆå„äøå«ęē¹ę®ę ē¤ŗļ¼åéč¦ęæę¢ string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("ēØę·ID")) { ls_sql = ls_sql.Replace("ēØę·ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("ēØę·å")) { ls_sql = ls_sql.Replace("ēØę·å", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("éØéØID")) { ls_sql = ls_sql.Replace("éØéØID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("éØéØå")) { ls_sql = ls_sql.Replace("éØéØå", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //å£ä»¤ if (field_type == "å£ä»¤") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.Password; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "ęÆ") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //é件ē»ä»¶ if (field_type == "é件ē»ä»¶") { //čÆ»åé件å 容 HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatheridandFatherfield(this.txtdocid.Value, hy_fieldid); field_docvalue = ""; if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { field_docvalue += (ii + 1).ToString() + "ć<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a><br />"; } } //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (field_docvalue == "") { field_docvalue = " "; } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue += "<input type=button id='uploadfile1' value='é件ē®”ē' class=btn3 onclick=\"window.open('ggdy/main_fileatt.aspx?fatherid=" + this.txtdocid.Value + "&fatherfield=" + hy_fieldid + "','filewindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //čÆ“ęęå if (field_type == "čÆ“ęęå") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //ē¼č¾åØ if (field_type == "ē¼č¾åØ") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { //éčęę¬ę” TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; txtTextBox.Style.Value = "display:none"; tCell2.Controls.Add(txtTextBox); //ē¼č¾åØ Label txtTextBox2 = new Label(); txtTextBox2.ID = "eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<iframe ID=\"eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_fieldid"].ToString() + "&style=Portal\" frameborder=0 scrolling=no width=" + dtfield.Rows[0]["hy_width"].ToString() + " height=" + dtfield.Rows[0]["hy_height"].ToString() + "></iframe>"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //ēčæ¹äæē if (field_type == "ēčæ¹äæē") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='ę£ ę' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='ę£ ę' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; //å¦ęęÆęµēØęØ”åļ¼åę ¹ę®ēÆčå¤ęäøäø if (ifflowdoc == "1") { //å¤ęęÆå¦äøŗē¬¬äøēÆč HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*"); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text) { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='ę£ ę' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { //å¤ęęÆå¦äøŗęåäøäøŖēÆč dtflowwork.Clear(); dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**") { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='ę£ ę' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='ę£ ę' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } } } } } Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //IFRAMEåč”Ø if (field_type == "IFRAMEåč”Ø") { //-----å¼å§č¾åŗåꮵ------ if (ls_laborinput == "0") //č¾åŗLABLE { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //åč”Øäæ”ęÆåø¦é¾ę„ //åč”Øäæ”ęÆäøåø¦é¾ę„ } return li_return; }
public void llenaCheckList(CheckBoxList dw, String sentencia, String nombre, String valor, String id) { conectar(); DataSet Ds = new DataSet(); SqlDataAdapter Adapter = new SqlDataAdapter(sentencia, con); Adapter.Fill(Ds, nombre); dw.DataSource = Ds.Tables[0].DefaultView; dw.DataTextField = valor; dw.DataValueField = id; dw.DataBind(); desconectar(); }
/// <summary> /// This method will be called whenever the selected faculty will be changed in the dropdown. /// This method will show the gridview where the Admin can map the faculties and subjects. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DDLFaculty_SelectedIndexChanged(object sender, EventArgs e) { //If the selected semester is EVEN if (RBLSemesterType.SelectedItem.Text.Equals("Even")) { //Select the list of Subject taught in even semester. sql = "SELECT * from Subject where DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + " and Semester in (2,4,6,8)"; } //If the selected semester is ODD. else { //Select the list of Subject taught in Odd semester. sql = "SELECT * from Subject where DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + " and Semester in (1,3,5,7)"; } c = new Connect(sql); GridView1.DataSource = c.ds; GridView1.DataBind(); //Logic to add the checkbox list for each department. foreach (GridViewRow row in GridView1.Rows) { //Adds the checkboxes for each section if subject type is theory. if (row.Cells[3].Text.Equals("Theory")) { sql = "SELECT SectionName,SectionID from Section where DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + ""; c = new Connect(sql); CheckBoxList cl = new CheckBoxList(); cl.DataSource = c.ds; cl.DataTextField = "SectionName"; cl.DataValueField = "SectionID"; cl.DataBind(); cl.ID = "CBLSection"; cl.RepeatDirection = RepeatDirection.Horizontal; row.Cells[5].Controls.Add(cl); } //Adds the checkboxes for each group if subject type is practical. else { sql = "SELECT GroupName,GroupID FROM Groups WHERE SectionID in (SELECT SectionID FROM Section WHERE DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + ")"; c = new Connect(sql); CheckBoxList cl = new CheckBoxList(); cl.DataSource = c.ds; cl.DataTextField = "GroupName"; cl.DataValueField = "GroupID"; cl.DataBind(); cl.ID = "CBLGroup"; cl.RepeatDirection = RepeatDirection.Horizontal; row.Cells[5].Controls.Add(cl); } } //Logic to check the Subject which are already mapped. sql = "SELECT * from Teaches WHERE FacultyID=" + DDLFaculty.SelectedValue + ""; c = new Connect(sql); foreach (GridViewRow row in GridView1.Rows) { for (int i = 0; i < c.ds.Tables[0].Rows.Count; i++) { sql = "SELECT SubjectID from Subject WHERE SubjectName='" + row.Cells[1].Text + "' AND DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + ""; c_subID = new Connect(sql); if (c.ds.Tables[0].Rows[i]["SubjectID"].ToString() == c_subID.ds.Tables[0].Rows[0]["SubjectID"].ToString()) { ((CheckBox)row.FindControl("CheckBox1")).Checked = true; if (row.Cells[3].Text.Equals("Theory")) { CheckBoxList cbl = (CheckBoxList)row.FindControl("CBLSection"); foreach (ListItem li in cbl.Items) { if (li.Value.ToString() == c.ds.Tables[0].Rows[i]["SectionID"].ToString()) li.Selected = true; } } else { CheckBoxList cbl = (CheckBoxList)row.FindControl("CBLGroup"); foreach (ListItem li in cbl.Items) { if (li.Value.ToString() == c.ds.Tables[0].Rows[i]["GroupID"].ToString()) li.Selected = true; } } } } } BtnSubmit.Visible = true; }
/// <summary> /// This method will be called whenever this page is loaded. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { //Checks if the user is logged in or not. If not then he will be redirected to Default page. if (Session["Role"] == null) { Response.Redirect("~/Default.aspx"); } //Checks if the user is Admin or not . If not then he will be redirected to Default page. if (!Session["Role"].ToString().Equals("Admin")) { Response.Redirect("~/Default.aspx"); } //If the user is Admin then this code executes. else { //Logic to add the checkbox list for each department. foreach (GridViewRow row in GridView1.Rows) { //Adds the checkboxes for each section if subject type is theory. if (row.Cells[3].Text.Equals("Theory")) { sql = "SELECT SectionName,SectionID from Section where DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + ""; c = new Connect(sql); CheckBoxList cl = new CheckBoxList(); cl.DataSource = c.ds; cl.DataTextField = "SectionName"; cl.DataValueField = "SectionID"; cl.DataBind(); cl.ID = "CBLSection"; cl.RepeatDirection = RepeatDirection.Horizontal; row.Cells[5].Controls.Add(cl); } //Adds the checkboxes for each group if subject type is practical. else { sql = "SELECT GroupName,GroupID FROM Groups WHERE SectionID in (SELECT SectionID FROM Section WHERE DepartmentID=" + int.Parse(Session["DepartmentID"].ToString()) + ")"; c = new Connect(sql); CheckBoxList cl = new CheckBoxList(); cl.DataSource = c.ds; cl.DataTextField = "GroupName"; cl.DataValueField = "GroupID"; cl.DataBind(); cl.ID = "CBLGroup"; cl.RepeatDirection = RepeatDirection.Horizontal; row.Cells[5].Controls.Add(cl); } } } }
protected void Page_Init(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; string USER_ID = ""; try { //Ajax.Utility.RegisterTypeForAjax(typeof(User)); //if (!IsPostBack) //{ // FriendsButton.Attributes.Add("onmouseover", "this.src='image/MyFriendsHover.png'"); // FriendsButton.Attributes.Add("onmouseout", "this.src='image/MyFriends.png'"); //} //else //{ // FriendsButton.Attributes.Remove("onmouseover"); // FriendsButton.Attributes.Remove("onmouseout"); // MessagesButton.Attributes.Remove("onmouseover"); // MessagesButton.Attributes.Remove("onmouseout"); //} //FOR USER PREFERENCES Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); MessageRadWindowManager.VisibleOnPageLoad = false; if (!IsPostBack) { try { if (Session["User"] != null) { } else { Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink"); calendarLink.Visible = false; Response.Redirect("~/UserLogin.aspx"); } } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); Response.Redirect("~/UserLogin.aspx"); } USER_ID = Session["User"].ToString(); //DataSet dsCat = dat.GetData("SELECT * FROM Categories"); //CategoriesCheckBoxes.DataSource = dsCat; //CategoriesCheckBoxes.DataTextField = "CategoryName"; //CategoriesCheckBoxes.DataValueField = "ID"; //CategoriesCheckBoxes.DataBind(); DataSet dsProvider = dat.GetData("SELECT * FROM PhoneProviders"); ProviderDropDown.DataSource = dsProvider; ProviderDropDown.DataTextField = "Provider"; ProviderDropDown.DataValueField = "ID"; ProviderDropDown.DataBind(); Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = d.GetData("SELECT * FROM Events E, Venues V, Event_Occurance EO, User_Calendar UC WHERE UC.EventID=E.ID AND E.ID=EO.EventID AND E.Venue=V.ID AND UC.UserID=" + USER_ID); DataSet dsUser = d.GetData("SELECT * FROM Users WHERE User_ID=" + USER_ID); DataSet dsUserPrefs = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" + USER_ID); if (dsUser.Tables[0].Rows[0]["FirstName"] != null) FirstNameTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["FirstName"].ToString(); if (dsUser.Tables[0].Rows[0]["LastName"] != null) LastNameTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["LastName"].ToString(); if (dsUserPrefs.Tables.Count > 0) if (dsUserPrefs.Tables[0].Rows.Count > 0) { //AgeTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Age"].ToString(); SexTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Sex"].ToString(); LocationTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Location"].ToString(); string eventsPosted = "0"; DataSet dsEvents = dat.GetData("SELECT COUNT(*) AS COUNT1 FROM Events WHERE UserName='******'"); if (dsEvents.Tables.Count > 0) if (dsEvents.Tables[0].Rows.Count > 0) eventsPosted = dsEvents.Tables[0].Rows[0]["COUNT1"].ToString(); EventsLabel.Text = eventsPosted; AttendedLabel.Text = dsUserPrefs.Tables[0].Rows[0]["EventsAttended"].ToString(); if (dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString() != null) { PublicPrivateCheckList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString(); } //if (dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString() != null) //{ // PollRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString(); //} if (dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString() != null) { CommentsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString(); } RadioButtonList CategoriesOnOffRadioList = (RadioButtonList)AdCategoryRadPanel.Items[0].Items[0].FindControl("CategoriesOnOffRadioList"); if (dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString() != null) { if (bool.Parse(dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString())) CategoriesOnOffRadioList.SelectedValue = "1"; else CategoriesOnOffRadioList.SelectedValue = "2"; } if(dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString() != null){ string recom = dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString(); if (recom.Contains("1")) RecommendationsCheckList.Items[0].Selected = true; if (recom.Contains("2")) RecommendationsCheckList.Items[1].Selected = true; if (recom.Contains("3")) RecommendationsCheckList.Items[2].Selected = true; } if (dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString() != null) { CommunicationPrefsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString().Trim() != "") { if (dsUserPrefs.Tables[0].Rows[0]["Address"].ToString() != null) { AddressTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["Address"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["City"].ToString() != null) { BillCityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["City"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString() != null) { ZipTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString(); } BillCountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Country"].ToString(); DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["Country"].ToString()); bool isText = false; if (dsStates.Tables.Count > 0) if (dsStates.Tables[0].Rows.Count > 0) { BillStateDropDown.DataSource = dsStates; BillStateDropDown.DataTextField = "state_2_code"; BillStateDropDown.DataValueField = "state_id"; BillStateDropDown.DataBind(); BillStateDropDown.Items.Insert(0, new ListItem("Select State..", "-1")); if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) { ListItem a = BillStateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["State"].ToString()); if (a != null) BillStateDropDown.SelectedValue = a.Value; } BillStateDropPanel.Visible = true; BillStateTextPanel.Visible = false; } else { isText = true; } else isText = true; if (isText) { if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) { BillStateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["State"].ToString(); } BillStateTextPanel.Visible = true; BillStateDropPanel.Visible = false; } } } if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString().Trim() != "") { if (dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString() != null) { CityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString().Trim() != "") { char[] delim = { ';' }; string[] tokens = dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString().Split(delim); if(tokens.Length > 1) CatZipTextBox.THE_TEXT = tokens[1].Trim(); } } if (dsUserPrefs.Tables[0].Rows[0]["Radius"].ToString() != null) { RadiusDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Radius"].ToString(); } CountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString(); DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString()); bool isText = false; if (dsStates.Tables.Count > 0) if (dsStates.Tables[0].Rows.Count > 0) { StateDropDown.DataSource = dsStates; StateDropDown.DataTextField = "state_2_code"; StateDropDown.DataValueField = "state_id"; StateDropDown.DataBind(); if (dsUserPrefs.Tables[0].Rows[0]["CatState"] != null) { StateDropDown.SelectedValue = StateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString()).Value; } StateDropDownPanel.Visible = true; StateTextBoxPanel.Visible = false; } else { isText = true; } else isText = true; if (isText) { if (dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString() != null) { StateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString(); } StateTextBoxPanel.Visible = true; StateDropDownPanel.Visible = false; } } } if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("1")) TextingCheckBoxList.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("2")) TextingCheckBoxList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("3")) TextingCheckBoxList.Items[2].Selected = true; } if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("1")) EmailCheckList.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("2")) EmailCheckList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("3")) EmailCheckList.Items[2].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[0].Value)) EmailUserCheckList1.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[1].Value)) EmailUserCheckList1.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[2].Value)) EmailUserCheckList1.Items[2].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[0].Value)) EmailUserCheckList2.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[1].Value)) EmailUserCheckList2.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[2].Value)) EmailUserCheckList2.Items[2].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("C")) EmailCheckList3.Items[0].Selected = true; } } DataSet dsComments = d.GetData("SELECT * FROM User_Comments CU, Users U WHERE CU.CommenterID=U.User_ID AND CU.UserID=" + USER_ID.ToString()); //Label UserNameLabel = (Label)Tab3.FindControl("UserNameLabel"); //UserNameLabel.Text = dsUser.Tables[0].Rows[0]["UserName"].ToString(); if (dsUser.Tables[0].Rows[0]["Email"].ToString() != null) { EmailTextBox.Text = dsUser.Tables[0].Rows[0]["Email"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString() != null) { PhoneTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString() != null) { ProviderDropDown.SelectedValue = dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString(); } Image FriendImage = (Image)Tab3.FindControl("FriendImage"); if (dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString() != null) { if (System.IO.File.Exists(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString())) { System.Drawing.Image theimg = System.Drawing.Image.FromFile(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString()); double width = double.Parse(theimg.Width.ToString()); double height = double.Parse(theimg.Height.ToString()); if (width > height) { if (width <= 150) { } else { double dividor = double.Parse("150.00") / double.Parse(width.ToString()); width = double.Parse("150.00"); height = height * dividor; } } else { if (width == height) { width = double.Parse("150.00"); height = double.Parse("150.00"); } else { double dividor = double.Parse("150.00") / double.Parse(height.ToString()); height = double.Parse("150.00"); width = width * dividor; } } FriendImage.Width = int.Parse((Math.Round(decimal.Parse(width.ToString()))).ToString()); FriendImage.Height = int.Parse((Math.Round(decimal.Parse(height.ToString()))).ToString()); FriendImage.ImageUrl = "~/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); Session["ProfilePicture"] = dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); } else { FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg"; } } else FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg"; } else { if (Session["User"] == null) { ErrorLabel.Text = "something happen"; //Session.Abandon(); Response.Redirect("~/UserLogin.aspx"); } } DataSet dsVenues = dat.GetData("SELECT * FROM UserVenues UV, Venues V WHERE V.ID=UV.VenueID AND UV.UserID=" + Session["User"].ToString()); VenuesRadPanel.Items[0].Text = "<div style=\" background-color: #1b1b1b; cursor: pointer;" + "\"><label class=\"PreferencesTitle\" style=\"cursor: pointer !important;\">Favorite Venues</label><span " + "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">" + " (Click to drop down the list. Un-check to remove a venue from the favorites list.)</span></div>"; //"<div style=\"border-bottom: dotted 1px black; " + // "padding-top: 10px;\"><label class=\"PreferencesTitle\">Favorite Venues</label><span " + // "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">" + // "(You can add these from the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>. " + // "Un-check to remove a venue from the favorites list.)</span></div>"; CheckBoxList VenueCheckBoxes = new CheckBoxList(); VenueCheckBoxes.Width = 560; VenueCheckBoxes.CssClass = "VenueCheckBoxes"; VenueCheckBoxes.ID = "VenueCheckBoxes"; VenueCheckBoxes.RepeatColumns = 4; VenueCheckBoxes.RepeatDirection = RepeatDirection.Horizontal; VenueCheckBoxes.DataSource = dsVenues; VenueCheckBoxes.DataTextField = "NAME"; VenueCheckBoxes.DataValueField = "ID"; VenueCheckBoxes.DataBind(); for (int i = 0; i < VenueCheckBoxes.Items.Count; i++) { VenueCheckBoxes.Items[i].Selected = true; } if (VenueCheckBoxes.Items.Count == 0) { Label label = new Label(); label.CssClass = "VenueCheckBoxes"; label.Text = "You have no venues specified as your favorite. To add venues as your favorites search for them on the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>"; VenuesRadPanel.Items[0].Items[0].Controls.Add(label); } else { VenuesRadPanel.Items[0].Items[0].Controls.Add(VenueCheckBoxes); } VenuesRadPanel.CollapseAllItems(); } catch (Exception ex) { UserErrorLabel.Text = ex.ToString(); } if (Request.QueryString["p"] != null) { RadTabStrip2.Tabs[2].Selected = true; RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferencesSelected"; RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages"; RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends"; TheMultipage.PageViews[2].Selected = true; } if (Request.QueryString["G"] != null) { RadTabStrip2.Tabs[3].Selected = true; RadTabStrip2.Tabs[3].CssClass = "MyTabsGroupsSelected"; RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages"; RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends"; RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferences"; TheMultipage.PageViews[3].Selected = true; } }
protected void Page_Init(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; string USER_ID = ""; try { //Ajax.Utility.RegisterTypeForAjax(typeof(User)); //if (!IsPostBack) //{ // FriendsButton.Attributes.Add("onmouseover", "this.src='image/MyFriendsHover.png'"); // FriendsButton.Attributes.Add("onmouseout", "this.src='image/MyFriends.png'"); //} //else //{ // FriendsButton.Attributes.Remove("onmouseover"); // FriendsButton.Attributes.Remove("onmouseout"); // MessagesButton.Attributes.Remove("onmouseover"); // MessagesButton.Attributes.Remove("onmouseout"); //} //FOR USER PREFERENCES Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); MessageRadWindowManager.VisibleOnPageLoad = false; if (!IsPostBack) { try { if (Session["User"] != null) { } else { Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink"); calendarLink.Visible = false; Response.Redirect("~/login"); } } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); Response.Redirect("~/login"); } USER_ID = Session["User"].ToString(); //DataSet dsCat = dat.GetData("SELECT * FROM Categories"); //CategoriesCheckBoxes.DataSource = dsCat; //CategoriesCheckBoxes.DataTextField = "CategoryName"; //CategoriesCheckBoxes.DataValueField = "ID"; //CategoriesCheckBoxes.DataBind(); DataSet dsProvider = dat.GetData("SELECT * FROM PhoneProviders"); ProviderDropDown.DataSource = dsProvider; ProviderDropDown.DataTextField = "Provider"; ProviderDropDown.DataValueField = "ID"; ProviderDropDown.DataBind(); Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = d.GetData("SELECT * FROM Events E, Venues V, Event_Occurance EO, User_Calendar UC WHERE UC.EventID=E.ID AND E.ID=EO.EventID AND E.Venue=V.ID AND UC.UserID=" + USER_ID); DataSet dsUser = d.GetData("SELECT * FROM Users WHERE User_ID=" + USER_ID); DataSet dsUserPrefs = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" + USER_ID); WeeklyCheckBox.Checked = bool.Parse(dsUser.Tables[0].Rows[0]["Weekly"].ToString()); if (dsUser.Tables[0].Rows[0]["FirstName"] != null) FirstNameTextBox.Text = dsUser.Tables[0].Rows[0]["FirstName"].ToString(); if (dsUser.Tables[0].Rows[0]["LastName"] != null) LastNameTextBox.Text = dsUser.Tables[0].Rows[0]["LastName"].ToString(); if (dsUserPrefs.Tables.Count > 0) if (dsUserPrefs.Tables[0].Rows.Count > 0) { //AgeTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Age"].ToString(); SexTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Sex"].ToString(); LocationTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Location"].ToString(); if (dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString() != null) { PublicPrivateCheckList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString(); } //if (dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString() != null) //{ // PollRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString(); //} if (dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString() != null) { CommentsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString(); } //if (dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString() != null) //{ // if (bool.Parse(dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString())) // CategoriesOnOffRadioList.SelectedValue = "1"; // else // CategoriesOnOffRadioList.SelectedValue = "2"; //} if (dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString() != null) { string recom = dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString(); if (recom.Contains("1")) RecommendationsCheckList.Items[0].Selected = true; if (recom.Contains("2")) RecommendationsCheckList.Items[1].Selected = true; if (recom.Contains("3")) RecommendationsCheckList.Items[2].Selected = true; } if (dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString() != null) { CommunicationPrefsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString(); } //if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString() != null) //{ // if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString().Trim() != "") // { // if (dsUserPrefs.Tables[0].Rows[0]["Address"].ToString() != null) // { // AddressTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Address"].ToString(); // } // if (dsUserPrefs.Tables[0].Rows[0]["City"].ToString() != null) // { // BillCityTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["City"].ToString(); // } // if (dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString() != null) // { // ZipTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString(); // } // BillCountryDropDown.DataBind(); // BillCountryDropDown.ClearSelection(); // BillCountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Country"].ToString(); // DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["Country"].ToString()); // bool isText = false; // if (dsStates.Tables.Count > 0) // if (dsStates.Tables[0].Rows.Count > 0) // { // BillStateDropDown.DataSource = dsStates; // BillStateDropDown.DataTextField = "state_2_code"; // BillStateDropDown.DataValueField = "state_id"; // BillStateDropDown.DataBind(); // BillStateDropDown.Items.Insert(0, new ListItem("Select State..", "-1")); // if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) // { // ListItem a = BillStateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["State"].ToString()); // if (a != null) // BillStateDropDown.SelectedValue = a.Value; // } // BillStateDropPanel.Visible = true; // BillStateTextPanel.Visible = false; // } // else // { // isText = true; // } // else // isText = true; // if (isText) // { // if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) // { // BillStateTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["State"].ToString(); // } // BillStateTextPanel.Visible = true; // BillStateDropPanel.Visible = false; // } // } // else // { // BillCountryDropDown.DataBind(); // BillCountryDropDown.SelectedValue = "223"; // } //} //else //{ // BillCountryDropDown.DataBind(); // BillCountryDropDown.SelectedValue = "223"; //} if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString().Trim() != "") { if (dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString() != null) { CityTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString(); } CatZipTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString(); CountryDropDown.DataBind(); CountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString(); ChangeState(CountryDropDown, new EventArgs()); DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString()); bool isText = false; if (dsStates.Tables.Count > 0) if (dsStates.Tables[0].Rows.Count > 0) { StateDropDown.DataSource = dsStates; StateDropDown.DataTextField = "state_2_code"; StateDropDown.DataValueField = "state_id"; StateDropDown.DataBind(); if (dsUserPrefs.Tables[0].Rows[0]["CatState"] != null) { StateDropDown.SelectedValue = StateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString()).Value; } StateDropDownPanel.Visible = true; StateTextBoxPanel.Visible = false; RequiredFieldValidator2.Visible = false; } else { isText = true; } else isText = true; if (isText) { RequiredFieldValidator2.Visible = true; if (dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString() != null) { StateTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString(); } StateTextBoxPanel.Visible = true; StateDropDownPanel.Visible = false; } ChangeCity(new object(), new EventArgs()); if (CountryDropDown.SelectedValue == "223") MajorCityDrop.Items.FindByValue(dsUserPrefs.Tables[0].Rows[0]["MajorCity"].ToString()).Selected = true; } } if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("1")) TextingCheckBoxList.Items[0].Selected = true; //if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("2")) // TextingCheckBoxList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("3")) TextingCheckBoxList.Items[2].Selected = true; } if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("1")) EmailCheckList.Items[0].Selected = true; //if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("2")) // EmailCheckList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[0].Value)) EmailUserCheckList1.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[1].Value)) EmailUserCheckList1.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[2].Value)) EmailUserCheckList1.Items[2].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[3].Value)) EmailUserCheckList1.Items[3].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[0].Value)) EmailUserCheckList2.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[1].Value)) EmailUserCheckList2.Items[1].Selected = true; //if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[2].Value)) // EmailUserCheckList2.Items[2].Selected = true; } } DataSet dsComments = d.GetData("SELECT * FROM User_Comments CU, Users U WHERE CU.CommenterID=U.User_ID AND CU.UserID=" + USER_ID.ToString()); //Label UserNameLabel = (Label)Tab3.FindControl("UserNameLabel"); //UserNameLabel.Text = dsUser.Tables[0].Rows[0]["UserName"].ToString(); if (dsUser.Tables[0].Rows[0]["Email"].ToString() != null) { EmailTextBox.Text = dsUser.Tables[0].Rows[0]["Email"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString() != null) { PhoneTextBox.Text = dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString() != null) { ProviderDropDown.SelectedValue = dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString(); } Image FriendImage = (Image)Tab3.FindControl("FriendImage"); if (dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString() != null) { if (System.IO.File.Exists(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString())) { System.Drawing.Image theimg = System.Drawing.Image.FromFile(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString()); double width = double.Parse(theimg.Width.ToString()); double height = double.Parse(theimg.Height.ToString()); if (width > height) { if (width <= 150) { } else { double dividor = double.Parse("150.00") / double.Parse(width.ToString()); width = double.Parse("150.00"); height = height * dividor; } } else { if (width == height) { width = double.Parse("150.00"); height = double.Parse("150.00"); } else { double dividor = double.Parse("150.00") / double.Parse(height.ToString()); height = double.Parse("150.00"); width = width * dividor; } } FriendImage.Width = int.Parse((Math.Round(decimal.Parse(width.ToString()))).ToString()); FriendImage.Height = int.Parse((Math.Round(decimal.Parse(height.ToString()))).ToString()); FriendImage.ImageUrl = "~/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); Session["ProfilePicture"] = dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); } else { FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg"; } } else FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg"; } else { if (Session["User"] == null) { ErrorLabel.Text = "something happen"; //Session.Abandon(); Response.Redirect("~/login"); } } DataSet dsVenues = dat.GetData("SELECT * FROM UserVenues UV, Venues V WHERE V.ID=UV.VenueID AND UV.UserID=" + Session["User"].ToString()); CheckBoxList VenueCheckBoxes = new CheckBoxList(); VenueCheckBoxes.Width = 530; VenueCheckBoxes.CssClass = "VenueCheckBoxes"; VenueCheckBoxes.ID = "VenueCheckBoxes"; VenueCheckBoxes.RepeatColumns = 4; VenueCheckBoxes.RepeatDirection = RepeatDirection.Horizontal; VenueCheckBoxes.DataSource = dsVenues; VenueCheckBoxes.DataTextField = "NAME"; VenueCheckBoxes.DataValueField = "ID"; VenueCheckBoxes.DataBind(); Literal lit = new Literal(); lit.Text = "<div class=\"Pad2\">"; VenuesChecksPanel.Controls.Add(lit); for (int i = 0; i < VenueCheckBoxes.Items.Count; i++) { VenueCheckBoxes.Items[i].Selected = true; } if (VenueCheckBoxes.Items.Count == 0) { Label label = new Label(); label.CssClass = "VenueCheckBoxes"; label.Text = "You have no venues specified as your favorite. To add venues as your favorites search for them on the <a href=\"venue-search\" class=\"NavyLink12\">Venues Page</a>"; VenuesChecksPanel.Controls.Add(label); } else { VenuesChecksPanel.Controls.Add(VenueCheckBoxes); } lit = new Literal(); lit.Text = "</div>"; VenuesChecksPanel.Controls.Add(lit); } catch (Exception ex) { UserErrorLabel.Text = ex.ToString(); } if (Request.QueryString["p"] != null) { RadTabStrip2.Tabs[2].Selected = true; RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferencesSelected"; RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages"; RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends"; TheMultipage.PageViews[2].Selected = true; } if (Request.QueryString["G"] != null) { RadTabStrip2.Tabs[3].Selected = true; RadTabStrip2.Tabs[3].CssClass = "MyTabsGroupsSelected"; RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages"; RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends"; RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferences"; TheMultipage.PageViews[3].Selected = true; } }
protected void Cargar(CheckBoxList checkBoxList, String idPeriodoPago) { condicionNomina _condicionNomina = new condicionNomina(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); checkBoxList.DataSource = _condicionNomina.obtenerPeriodosDescuentoSubTranportePorPeriodoPago(idPeriodoPago); checkBoxList.DataTextField = "descripcion"; checkBoxList.DataValueField = "codigo"; checkBoxList.DataBind(); }
protected void ddlCoScholasticArea_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsIndicators = new DataSet(); dsIndicators = objCCE.GetCoScholasticIndicators(Convert.ToInt32(ddlCoScholasticArea.SelectedValue)); foreach (GridViewRow gvr in gdvCoScholastic.Rows) { CheckBoxList chkIndicators = new CheckBoxList(); chkIndicators = (CheckBoxList)gvr.Cells[3].FindControl("chkIndicators"); for (int i = 0; i < dsIndicators.Tables[0].Rows.Count; i++) { chkIndicators.DataSource = dsIndicators.Tables[0]; chkIndicators.DataValueField = "IndicatorId"; chkIndicators.DataTextField = "Indicator"; chkIndicators.DataBind(); } } }
/*Sub Header*********************************************************** Function Name: BindCompanyStatusDropdown Functionality: This function is used to bind the company statuses with the predefined array Input: dropdownlist and the strInitialText Output: Note: *********************************************************************/ public static void BindCompanyCheckBoxList(CheckBoxList ddList, string strInitialText) { BLL.CompanyManager oCompanyManager = new BLL.CompanyManager(); ddList.DataSource = oCompanyManager.GetCompanyAllCompanies(); ddList.DataTextField = "strCompanyName"; ddList.DataValueField = "intCompanyId"; ddList.DataBind(); ListItem lstInitialItem; if (strInitialText.Trim() != "") { lstInitialItem = new ListItem(strInitialText, "0"); ddList.Items.Insert(0, lstInitialItem); } lstInitialItem = null; oCompanyManager = null; }
protected void Page_Load(object sender, EventArgs e) { HtmlMeta hm = new HtmlMeta(); HtmlHead head = (HtmlHead)Page.Header; hm.Name = "ROBOTS"; hm.Content = "NOINDEX, FOLLOW"; head.Controls.AddAt(0, hm); HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); MessageRadWindowManager.VisibleOnPageLoad = false; if (!IsPostBack) { string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[cookieName]; FormsAuthenticationTicket authTicket = null; try { string group = ""; if (authCookie != null) { authTicket = FormsAuthentication.Decrypt(authCookie.Value); group = authTicket.UserData.ToString(); } if (group.Contains("User")) { Session["User"] = authTicket.Name; Session["UserName"] = dat.GetData("SELECT UserName FROM USERS WHERE User_ID=" + Session["User"].ToString()).Tables[0].Rows[0]["UserName"].ToString(); } else { Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink"); calendarLink.Visible = false; Response.Redirect("~/UserLogin.aspx"); } } catch (Exception ex) { Response.Redirect("~/UserLogin.aspx"); } string USER_ID = Session["User"].ToString(); //DataSet dsCat = dat.GetData("SELECT * FROM Categories"); //CategoriesCheckBoxes.DataSource = dsCat; //CategoriesCheckBoxes.DataTextField = "CategoryName"; //CategoriesCheckBoxes.DataValueField = "ID"; //CategoriesCheckBoxes.DataBind(); CategoryTree.DataBind(); RadTreeView1.DataBind(); RadTreeView2.DataBind(); RadTreeView3.DataBind(); DataSet dsCategories = dat.GetData("SELECT * FROM UserCategories WHERE UserID=" + USER_ID); if (dsCategories.Tables.Count > 0) for (int i = 0; i < dsCategories.Tables[0].Rows.Count; i++) { Telerik.Web.UI.RadTreeNode node = (Telerik.Web.UI.RadTreeNode)CategoryTree.Nodes.FindNodeByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()); if (node != null) { node.Checked = true; //node.Enabled = false; } else { node = (Telerik.Web.UI.RadTreeNode)RadTreeView1.Nodes.FindNodeByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()); if (node != null) { node.Checked = true; //node.Enabled = false; } else { node = (Telerik.Web.UI.RadTreeNode)RadTreeView2.Nodes.FindNodeByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()); if (node != null) { node.Checked = true; //node.Enabled = false; } else { node = (Telerik.Web.UI.RadTreeNode)RadTreeView3.Nodes.FindNodeByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()); if (node != null) { node.Checked = true; //node.Enabled = false; } } } } //CategoriesCheckBoxes.Items.FindByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()).Selected = true; //CategoriesCheckBoxes.Items.FindByValue(dsCategories.Tables[0].Rows[i]["CategoryID"].ToString()).Enabled = false; } DataSet dsProvider = dat.GetData("SELECT * FROM PhoneProviders"); ProviderDropDown.DataSource = dsProvider; ProviderDropDown.DataTextField = "Provider"; ProviderDropDown.DataValueField = "ID"; ProviderDropDown.DataBind(); Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet ds = d.GetData("SELECT * FROM Events E, Venues V, Event_Occurance EO, User_Calendar UC WHERE UC.EventID=E.ID AND E.ID=EO.EventID AND E.Venue=V.ID AND UC.UserID=" + USER_ID); DataSet dsUser = d.GetData("SELECT * FROM Users WHERE User_ID=" + USER_ID); DataSet dsUserPrefs = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" + USER_ID); if (dsUserPrefs.Tables.Count > 0) if (dsUserPrefs.Tables[0].Rows.Count > 0) { AgeTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Age"].ToString(); SexTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Sex"].ToString(); LocationTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Location"].ToString(); string eventsPosted = "0"; DataSet dsEvents = dat.GetData("SELECT COUNT(*) AS COUNT1 FROM Events WHERE UserName='******'"); if (dsEvents.Tables.Count > 0) if (dsEvents.Tables[0].Rows.Count > 0) eventsPosted = dsEvents.Tables[0].Rows[0]["COUNT1"].ToString(); EventsLabel.Text = eventsPosted; AttendedLabel.Text = dsUserPrefs.Tables[0].Rows[0]["EventsAttended"].ToString(); if (dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString() != null) { PublicPrivateCheckList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString() != null) { PollRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString() != null) { CommentsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString() != null) { if(bool.Parse(dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString())) CategoriesOnOffRadioList.SelectedValue = "1"; else CategoriesOnOffRadioList.SelectedValue = "2"; } if (dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString() != null) { CommunicationPrefsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString().Trim() != "") { if (dsUserPrefs.Tables[0].Rows[0]["Address"].ToString() != null) { AddressTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["Address"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["City"].ToString() != null) { BillCityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["City"].ToString(); } if (dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString() != null) { ZipTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString(); } BillCountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Country"].ToString(); DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["Country"].ToString()); bool isText = false; if (dsStates.Tables.Count > 0) if (dsStates.Tables[0].Rows.Count > 0) { BillStateDropDown.DataSource = dsStates; BillStateDropDown.DataTextField = "state_2_code"; BillStateDropDown.DataValueField = "state_id"; BillStateDropDown.DataBind(); BillStateDropDown.Items.Insert(0, new ListItem("Select State..", "-1")); if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) { ListItem a = BillStateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["State"].ToString()); if (a != null) BillStateDropDown.SelectedValue = a.Value; } BillStateDropPanel.Visible = true; BillStateTextPanel.Visible = false; } else { isText = true; } else isText = true; if (isText) { if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null) { BillStateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["State"].ToString(); } BillStateTextPanel.Visible = true; BillStateDropPanel.Visible = false; } } } if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString().Trim() != "") { if (dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString() != null) { CityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString(); } CountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString(); DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString()); bool isText = false; if (dsStates.Tables.Count > 0) if (dsStates.Tables[0].Rows.Count > 0) { StateDropDown.DataSource = dsStates; StateDropDown.DataTextField = "state_2_code"; StateDropDown.DataValueField = "state_id"; StateDropDown.DataBind(); if (dsUserPrefs.Tables[0].Rows[0]["CatState"] != null) { StateDropDown.SelectedValue = StateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString()).Value; } StateDropDownPanel.Visible = true; StateTextBoxPanel.Visible = false; } else { isText = true; } else isText = true; if (isText) { if (dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString() != null) { StateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString(); } StateTextBoxPanel.Visible = true; StateDropDownPanel.Visible = false; } } } if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("1")) TextingCheckBoxList.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("2")) TextingCheckBoxList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("3")) TextingCheckBoxList.Items[2].Selected = true; } if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString() != null) { if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("1")) EmailCheckList.Items[0].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("2")) EmailCheckList.Items[1].Selected = true; if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("3")) EmailCheckList.Items[2].Selected = true; } } DataSet dsComments = d.GetData("SELECT * FROM User_Comments CU, Users U WHERE CU.CommenterID=U.User_ID AND CU.UserID=" + USER_ID.ToString()); UserNameLabel.Text = dsUser.Tables[0].Rows[0]["UserName"].ToString(); if (dsUser.Tables[0].Rows[0]["Email"].ToString() != null) { EmailTextBox.Text = dsUser.Tables[0].Rows[0]["Email"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString() != null) { PhoneTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString(); } if (dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString() != null) { ProviderDropDown.SelectedValue = dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString(); } if (dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString() != null) { if (System.IO.File.Exists(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString())) { FriendImage.ImageUrl = Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); Session["ProfilePicture"] = dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString(); } else { FriendImage.ImageUrl = "NewImages/NoAvatar150.jpg"; } } else FriendImage.ImageUrl = "NewImages/NoAvatar150.jpg"; } else { if (Session["User"] == null) { Session.Abandon(); Response.Redirect("~/UserLogin.aspx"); } } DataSet dsVenues = dat.GetData("SELECT * FROM UserVenues UV, Venues V WHERE V.ID=UV.VenueID AND UV.UserID=" + Session["User"].ToString()); VenuesRadPanel.Items[0].Text = "<div style=\"border-bottom: dotted 1px black; background-color: #1b1b1b; "+ "\"><label class=\"PreferencesTitle\">Favorite Venues</label><span " + "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">"+ " (Click to drop down the list. Un-check to remove a venue from the favorites list.)</span></div>"; //"<div style=\"border-bottom: dotted 1px black; " + // "padding-top: 10px;\"><label class=\"PreferencesTitle\">Favorite Venues</label><span " + // "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">" + // "(You can add these from the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>. " + // "Un-check to remove a venue from the favorites list.)</span></div>"; CheckBoxList VenueCheckBoxes = new CheckBoxList(); VenueCheckBoxes.Width = 600; VenueCheckBoxes.CssClass = "VenueCheckBoxes"; VenueCheckBoxes.ID = "VenueCheckBoxes"; VenueCheckBoxes.RepeatColumns = 4; VenueCheckBoxes.RepeatDirection = RepeatDirection.Horizontal; VenueCheckBoxes.DataSource = dsVenues; VenueCheckBoxes.DataTextField = "NAME"; VenueCheckBoxes.DataValueField = "ID"; VenueCheckBoxes.DataBind(); for (int i = 0; i < VenueCheckBoxes.Items.Count; i++) { VenueCheckBoxes.Items[i].Selected = true; } if (VenueCheckBoxes.Items.Count == 0) { Label label = new Label(); label.CssClass = "Paddings20 VenueCheckBoxes"; label.Text = "You have no venues specifieds as your favorite. To add venues as your favorites search for them on the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>"; VenuesRadPanel.Items[0].Items[0].Controls.Add(label); } else { VenuesRadPanel.Items[0].Items[0].Controls.Add(VenueCheckBoxes); } VenuesRadPanel.CollapseAllItems(); }
private void BindAllFTList() { MessageContent.InnerHtml = ""; _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage(); _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount; _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName; _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP; _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>(); HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity(); _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity); DataSet dsResult = HotelFacilitiesBP.ServiceAllFTSelect(_hotelfacilitiesEntity).QueryResult; string strTypeSeq = ""; DataSet dsDDP = GetDataItem(); Panel pl = new Panel(); CheckBoxList chk1 = new CheckBoxList(); for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++) { if (!strTypeSeq.Equals(dsResult.Tables[0].Rows[i]["TYPESEQ"].ToString())) { if (!String.IsNullOrEmpty(strTypeSeq)) { chk1.DataTextField = "FACILITIESNM"; chk1.DataValueField = "FACILITIESCODE"; chk1.DataSource = dsDDP; chk1.DataBind(); pl.Controls.Add(chk1); dvChkList.Controls.Add(pl); } pl = new Panel(); pl.GroupingText = dsResult.Tables[0].Rows[i]["TYPENAME"].ToString(); pl.CssClass = ""; pl.Style.Add("width", "100%"); chk1 = new CheckBoxList(); chk1.RepeatDirection = RepeatDirection.Vertical; chk1.RepeatColumns = 8; chk1.RepeatLayout = RepeatLayout.Table; chk1.CellSpacing = 10; dsDDP.Tables[0].Rows.Clear(); strTypeSeq = dsResult.Tables[0].Rows[i]["TYPESEQ"].ToString(); } DataRow dr = dsDDP.Tables[0].NewRow(); dr["FACILITIESNM"] = dsResult.Tables[0].Rows[i]["FACILITIESNM"].ToString(); dr["FACILITIESCODE"] = dsResult.Tables[0].Rows[i]["FACILITIESCODE"].ToString(); dsDDP.Tables[0].Rows.Add(dr); } chk1.DataTextField = "FACILITIESNM"; chk1.DataValueField = "FACILITIESCODE"; chk1.DataSource = dsDDP; chk1.DataBind(); pl.Controls.Add(chk1); dvChkList.Controls.Add(pl); }