How to use ContactReader

4 views
Skip to first unread message

Bishnu

unread,
Dec 26, 2008, 5:28:33 AM12/26/08
to ContactsReader
Hi all,
I just want to use your DLL and retrive all contract in a
Datatable or Collection . But the TestDrive.aspx page you provide
there is a Button Button1 , that button have a OnClick event but i
unable to find that event bcz there is no .cs for the TestDrive.aspx
and there is no javascript for that so the compilation error occure.
I need your help to fix this problem, Or if you have a code to
import contact list gmail,hotmail,rediffmail.....please send it to
me..

Thanks.
Bishnu

Loopy

unread,
Jan 20, 2009, 6:12:46 AM1/20/09
to ContactsReader
If you go to http://reflector.red-gate.com/Download.aspx you can
download a program and use it to extract App_Web_mqg4or2q.dll.

The code you need is in _Default

This is it:

public class _Default : Page, IRequiresSessionState
{
// Fields
protected Button Button1;
protected HtmlForm form1;
protected GridView GridView1;
protected HyperLink HyperLink2;
protected Label Label2;
protected Label Label3;
protected RadioButton rbAOLmail;
protected RadioButton rbGmail;
protected RadioButton rbHotmail;
protected RadioButton rbRediffmail;
protected RadioButton rbYahoomail;
protected TextBox TextBox1;
protected TextBox TextBox2;
protected TextBox TextBox3;
protected TextBox TextBox4;

// Methods
protected void Button1_Click(object sender, EventArgs e)
{
string strUserIdTemp = this.TextBox1.Text.Trim();
string strPassword = this.TextBox2.Text.Trim();
if ((strUserIdTemp.Length == 0) || (strPassword.Length == 0))
{
this.Label2.Text = Utility.UseridPassMiss;
this.GridView1.Visible = false;
}
else
{
bool boolIsOK = false;
DataTable dtContatct = new DataTable();
string strError = string.Empty;
MailType mt = this.FindTheMailType();
try
{
strUserIdTemp = this.CheckUserID(mt, strUserIdTemp);
this.Label3.Text = "User ID :" + strUserIdTemp;
MailClient.GetContacts(mt, strUserIdTemp, strPassword,
out boolIsOK, out dtContatct, out strError);
dtContatct = MailClient.GetFormat(mt, dtContatct);
}
catch (Exception exception)
{
this.Label2.Text = exception.ToString();
return;
}
if (!boolIsOK)
{
this.Label2.Text = strError;
this.GridView1.Visible = false;
}
else
{
this.Label2.Text = " Total contacts : " +
dtContatct.Rows.Count.ToString();
if (dtContatct.Rows.Count > 0)
{
this.GridView1.DataSource = dtContatct;
this.GridView1.DataBind();
this.GridView1.Visible = true;
}
}
}
}

private string CheckUserID(MailType mt, string strUserIdTemp)
{
string str = strUserIdTemp;
switch (mt)
{
case MailType.Yahoomail:
return strUserIdTemp;

case MailType.Hotmail:
if (strUserIdTemp.IndexOf("@") != -1)
{
return strUserIdTemp;
}
return (strUserIdTemp + "@hotmail.com");

case MailType.Gmail:
return strUserIdTemp;

case MailType.AOLmail:
{
int index = strUserIdTemp.IndexOf("@");
if (index < 0)
{
return strUserIdTemp;
}
return strUserIdTemp.Remove(index);
}
case MailType.Rediffmail:
{
int startIndex = strUserIdTemp.IndexOf("@");
if (startIndex < 0)
{
return strUserIdTemp;
}
return strUserIdTemp.Remove(startIndex);
}
}
return str;
}

private MailType FindTheMailType()
{
MailType rediffmail = (MailType) 0;
if (this.rbYahoomail.Checked)
{
return MailType.Yahoomail;
}
if (this.rbHotmail.Checked)
{
return MailType.Hotmail;
}
if (this.rbGmail.Checked)
{
return MailType.Gmail;
}
if (this.rbAOLmail.Checked)
{
return MailType.AOLmail;
}
if (this.rbRediffmail.Checked)
{
rediffmail = MailType.Rediffmail;
}
return rediffmail;
}

protected void Page_Load(object sender, EventArgs e)
{
}

// Properties
protected HttpApplication ApplicationInstance
{
get
{
return this.Context.ApplicationInstance;
}
}

protected DefaultProfile Profile
{
get
{
return (DefaultProfile) this.Context.Profile;
}
}
}

udaya kiran

unread,
Jan 21, 2009, 6:14:57 AM1/21/09
to ContactsReader
hgjhadfjhgsafghafh
Reply all
Reply to author
Forward
0 new messages