private void initializeDDLs(DropDownList ddl) { try { string CCon = CConnection.GetConnStringForAccount(); SqlDataReader dr = SqlHelper.ExecuteReader(CCon, CommandType.Text, "Select A.contacccode +'-'+ A.SubCode +'-'+ A.subsubcode +'-'+ A.loccode +'-'+ A.DetailCode as AccountCode , A.contacccode +'-'+ A.SubCode +'-'+ A.subsubcode +'-'+ A.loccode +'-'+ A.DetailCode + ' | ' + rtrim(A.DetailDesc) as DetailDesc from GDetail A where CompCode = '" + Session["DealerCode"].ToString() + "'"); if (dr.HasRows) { ListItem item = new ListItem(); item.Text = "Select"; item.Value = "0"; //AddInAllDDL(item); ddl.Items.Add(item); while (dr.Read()) { StringWriter myWriter = new StringWriter(); HttpUtility.HtmlDecode(dr["DetailDesc"].ToString().Replace(" ", " "), myWriter);//ddlEmp.Items.Add(myWriter.ToString()); item = new ListItem(); item.Text = myWriter.ToString(); item.Value = dr["AccountCode"].ToString(); ddl.Items.Add(item); } dr.Close(); } } catch (Exception ex) { lblMessage.Visible = true; // lblMessage.Text = ex.Message; } }
private string GetAccounttitle(string code) { try { string CCon = CConnection.GetConnStringForAccount(); string value = ""; SqlDataAdapter dta = new SqlDataAdapter("Select rtrim(A.DetailDesc) as AccountTitle from GDetail A where A.CompCode = '" + Session["DealerCode"].ToString() + "' and A.contacccode +'-'+ A.SubCode +'-'+ A.subsubcode +'-'+ A.loccode +'-'+ A.DetailCode = '" + code + "'", CCon); DataTable dt = new DataTable(); dta.Fill(dt); if (dt.Rows.Count > 0 && dt != null) { value = dt.Rows[0]["AccountTitle"].ToString(); } return(value); } catch (Exception ex) { sysFunc.UserMsg(lblMessage, Color.Red, ex.Message); return(""); } }
public void childthreadcall() { try { string CCon = CConnection.GetConnStringForAccount(); //string sQuery = "Select A.contacccode + A.SubCode + A.subsubcode + A.loccode + A.DetailCode as AccountCode , A.DetailDesc from GDetail A"; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "Select A.contacccode +'-'+ A.SubCode +'-'+ A.subsubcode +'-'+ A.loccode +'-'+ A.DetailCode as AccountCode , A.DetailDesc from GDetail A"); if (ds.Tables[0].Rows.Count > 0) { Session["Parts"] = ds; } } catch (ThreadAbortException e) { //lblmessage.Text += "<br /> child thread - exception"; } finally { //lblmessage.Text += "<br /> child thread - unable to catch the exception"; } }
protected void getData() { ColumnsName = Session["ColumnsName"].ToString(); AppendWhere = Session["AppendInWhere"].ToString(); if (Session["AppendOrderby"] != null) { AppendOrderby = Session["AppendOrderby"].ToString(); } if (Request.QueryString["Grp"] != null) { AppendInGroupBy = Request.QueryString["Grp"].ToString(); } string sQuery; if (LookUpPageId.ToString() != string.Empty) { clsLookUp clp = new clsLookUp(); if (AppendInGroupBy != string.Empty) { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " " + AppendInGroupBy; } else { sQuery = ColumnsName + " " + AppendInGroupBy; } } } else { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere; } else { sQuery = ColumnsName; } } } if (AppendOrderby != string.Empty) { sQuery = sQuery + " " + AppendOrderby; } if (LookUpPageId == 75) { string CCon = CConnection.GetConnStringForAccount(); ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, sQuery); GDV.AllowPaging = false; GDV.PageSize = ds.Tables[0].Rows.Count; //Session["Parts"] = ds; //Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); } else { if (objMBL.ExecuteQuery(sQuery, ref ds)) { GDV.AllowPaging = true; GDV.PageSize = 15; //Session["Parts"] = ds; Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); //GDV.HeaderRow.TableSection = TableRowSection.TableHeader; } } } }