Dear All,
I have a problem during upload image file in FTP the error are as below
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[UnauthorizedAccessException: Access to the path
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7724035
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +61
System.IO.FileStream..ctor(String path, FileMode mode) +55
System.Web.HttpPostedFile.SaveAs(String filename) +99
Master_Add_Agent.ComprImage(FileUpload Fileupload1) +496
Master_Add_Agent.Page_Load(Object sender, EventArgs e) +301
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
and the code is:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Drawing;
using System.Web.Security;
public partial class Master_AddMember : System.Web.UI.Page
{
ClsCS cls = new ClsCS();
public void bindState()
{
string str = "select id,Name from state where countryid='" + ddlcountry.SelectedValue + "' order by name";
ddlState.DataSource = cls.getDataTable(str);
ddlState.DataTextField = "Name";
ddlState.DataValueField = "id";
ddlState.DataBind();
ddlState.Items.Insert(0, "--- Select State ---");
ddlState.Items[0].Value = "0";
}
public void bind_country()
{
string str = "select id,name from country order by id";
ddlcountry.DataSource = cls.getDataTable(str);
ddlcountry.DataTextField = "name";
ddlcountry.DataValueField = "id";
ddlcountry.DataBind();
}
public void binddistrict()
{
string str = "select id,name from district where stateId='" + ddlState.SelectedValue + "' order by name ";
ddlDistrict.DataSource = cls.getDataTable(str);
ddlDistrict.DataTextField = "Name";
ddlDistrict.DataValueField = "id";
ddlDistrict.DataBind();
ddlDistrict.Items.Insert(0, "--- Select District ---");
ddlDistrict.Items[0].Value = "0";
}
public void bindIDProof()
{
string str = "select id,name from ID_proof_master order by name";
ddlIDProof.DataSource = cls.getDataTable(str);
ddlIDProof.DataTextField = "name";
ddlIDProof.DataValueField = "id";
ddlIDProof.DataBind();
ddlIDProof.Items.Insert(0, "--- Select ID Proof ---");
ddlIDProof.Items[0].Value = "0";
}
public void bind_company_Firmtype()
{
string str = "select id,firm_name from company_firmmaster order by firm_name ";
ddlcomptype.DataSource = cls.getDataTable(str);
ddlcomptype.DataTextField = "firm_name";
ddlcomptype.DataValueField = "id";
ddlcomptype.DataBind();
ddlcomptype.Items.Insert(0, "--- Select Company Type ---");
ddlcomptype.Items[0].Value = "0";
}
public void bind_Bus_Firmproof()
{
string str = "select id,business_proof from business_firmtypemaster order by business_proof";
ddlBusProof.DataSource = cls.getDataTable(str);
ddlBusProof.DataTextField = "business_proof";
ddlBusProof.DataValueField = "id";
ddlBusProof.DataBind();
ddlBusProof.Items.Insert(0, "--- Select BusinessProof ---");
ddlBusProof.Items[0].Value = "0";
}
public void bind_address_proofmaster()
{
string str = "select id,name from address_proofmaster order by name";
ddlAddressProof.DataSource = cls.getDataTable(str);
ddlAddressProof.DataTextField = "name";
ddlAddressProof.DataValueField = "id";
ddlAddressProof.DataBind();
ddlAddressProof.Items.Insert(0, "--- Select AddressProof ---");
ddlAddressProof.Items[0].Value = "0";
}
public void ComprImage(System.Web.UI.WebControls.FileUpload Fileupload1)
{
string filePath = String.Empty;
if (FileUpload_img.HasFile)
{
if (Fileupload1.PostedFile != null && Fileupload1.PostedFile.FileName != "")
{
string strExtension = System.IO.Path.GetExtension(Fileupload1.FileName);
if ((strExtension.ToUpper() == ".JPG") | (strExtension.ToUpper() == ".GIF") | (strExtension == ".png"))
{
System.Drawing.Image imageToBeResized = System.Drawing.Image.FromStream(Fileupload1.PostedFile.InputStream);
string upName = Fileupload1.FileName.ToString();
string[] strspl = upName.Split('.');
Fileupload1.PostedFile.SaveAs(HttpContext.Current.Request.PhysicalApplicationPath + "temp\\" + System.Web.HttpContext.Current.Session.SessionID + "_" + Fileupload1.PostedFile.FileName);
int imageHeight = imageToBeResized.Height;
int imageWidth = imageToBeResized.Width;
int maxHeight = 70;
int maxWidth = 60;
imageHeight = (imageHeight * maxWidth) / imageWidth;
imageWidth = maxWidth;
if (imageHeight > maxHeight)
{
imageWidth = (imageWidth * maxHeight) / imageHeight;
imageHeight = maxHeight;
}
Bitmap bitmap = new Bitmap(imageToBeResized, imageWidth, imageHeight);
System.IO.MemoryStream stream = new MemoryStream();
Graphics newGraphic = Graphics.FromImage(bitmap);
try
{
newGraphic.Clear(Color.White);
newGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
newGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
newGraphic.DrawImage(imageToBeResized, 0, 0, imageWidth, imageHeight);
bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
}
catch (Exception ex)
{
}
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind_country();
bindState();
binddistrict();
bind_Bus_Firmproof();
bind_company_Firmtype();
bindIDProof();
bind_address_proofmaster();
Session["userid"] = "";
Session["agentid"] = "1";
}
if (FileUpload_img.PostedFile != null && FileUpload_img.PostedFile.FileName != "")
{
Session["ImgFileName"] = System.Web.HttpContext.Current.Session.SessionID + "_" + FileUpload_img.PostedFile.FileName;
ComprImage(FileUpload_img);
ImgPhoto.ImageUrl = "~/temp/" + System.Web.HttpContext.Current.Session.SessionID + "_" + FileUpload_img.PostedFile.FileName;
}
}
protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e)
{
bindState();
}
protected void ddlstate_SelectedIndexChanged(object sender, EventArgs e)
{
binddistrict();
}
string sql;
Boolean isMany;
string leag;
protected void btnSave_Click(object sender, EventArgs e)
{
int flag = 0;
if (radPanStatus.SelectedValue == "Yes")
{
if (txtPanno.Text.Trim() == "")
{
lblpan.Visible = true;
flag = 1;
}
else
flag = 0;
}
if (flag == 0)
{
checkEmail_Click(sender, e);
checkmob_Click(sender, e);
if (lblmail.Text.Trim() == "" && lblmob.Text.Trim() == "")
{
string str = "select * from userinfo_master where emailid='" + txtEmail.Text.Trim() + "' or mobile='" + txtmobno.Text.Trim() + "'";
if (cls.getDataTable(str).Rows.Count == 0)
{
if (FileUploadID.HasFile)
{
FileUploadID.PostedFile.SaveAs(HttpContext.Current.Request.PhysicalApplicationPath + "IDProof\\" + Convert.ToString(txtEmail.Text) + FileUploadID.FileName);
ViewState["IDURL"] = "~/IDProof/" + Convert.ToString(txtEmail.Text) + FileUploadID.FileName;
}
else
{
ViewState["IDURL"] = null;
}
if (FileUploadBusProof.HasFile)
{
FileUploadBusProof.PostedFile.SaveAs(HttpContext.Current.Request.PhysicalApplicationPath + "IDProof\\" + Convert.ToString(txtEmail.Text) + FileUploadBusProof.FileName);
ViewState["BUSIDURL"] = "~/IDProof/" + Convert.ToString(txtEmail.Text) + FileUploadBusProof.FileName;
}
else
{
ViewState["BUSIDURL"] = null;
}
if (FileUploadAdd.HasFile)
{
FileUploadAdd.PostedFile.SaveAs(HttpContext.Current.Request.PhysicalApplicationPath + "IDProof\\" + Convert.ToString(txtEmail.Text) + FileUploadAdd.FileName);
ViewState["AddIDURL"] = "~/IDProof/" + Convert.ToString(txtEmail.Text) + FileUploadAdd.FileName;
}
else
{
ViewState["AddIDURL"] = null;
}
ViewState["Blevel"] = "N";
if (ImgPhoto.ImageUrl != "~/images/images (2).jpg")
{
fill_data(Session["agentid"].ToString(), txtFirst_name.Text.Trim(), txtlastt_name.Text.Trim(), txtdob.Text.Trim(), radgender.SelectedValue.ToString(), ddlcomptype.SelectedValue.ToString(), txtmobno.Text.Trim(), txtcompname.Text.Trim(), txtEmail.Text.Trim(), txtadd.Text.Trim(), ddlcountry.SelectedValue.ToString(), ddlState.SelectedValue.ToString(), ddlDistrict.SelectedValue.ToString(), txtcity.Text.Trim(), txtpincode.Text.Trim(), radPanStatus.SelectedValue.ToString(), txtPanno.Text.Trim(), ddlIDProof.SelectedValue.ToString(), ddlAddressProof.SelectedValue.ToString(), ddlBusProof.SelectedValue.ToString(), ViewState["IDURL"].ToString(), ViewState["BUSIDURL"].ToString(), ViewState["AddIDURL"].ToString());
lblpan.Visible = false;
}
else
{
if (ImgPhoto.ImageUrl == "~/images/images (2).jpg")
lblimage.Visible = true;
}
}
}
}
}
public void fill_data(string typeid, string fname, string lname, string dob, string gender, string comp_firmid, string mobile, string shopname, string emailid, string address, string country_id, string state_id, string district_id, string city, string pincode, string pan_card_status, string pan_number, string idproof, string addproof, string busproof, string idproofpath, string addproofpath, string busproofpath)
{
Session["userid"] = "1";
Session["orgId"] = "2";
Session["Yrid"] = "3";
string ch = "Y";
sql = "select CONVERT(char(50), getdate(), 112) as ddtt ";
DataTable dt = cls.getDataTable(sql);
sql = "select MAX(id) from userinfo_master ";
DataTable dt1 = cls.getDataTable(sql);
double id;
if (dt1.Rows[0].ItemArray[0].ToString().Trim() == "")
id = 1;
else
id = Convert.ToInt64(dt1.Rows[0].ItemArray[0].ToString()) + 1;
string agent_id = dt.Rows[0].ItemArray[0].ToString().Trim() + id.ToString().Trim().PadLeft(3, '0');
ViewState["agent_id"] = agent_id;
cls.OpenConnection();
SqlTransaction Tran;
int flag2 = 0;
Tran = cls.Sqlconn.BeginTransaction(IsolationLevel.Serializable);
cls.SqlCmd.Transaction = Tran;
string Spon_id = txtSponID.Text;
try
{
cls.SqlCmd.CommandText = @"insert into userinfo_master(type_id,first_name,last_name,dob,gender,comp_firmid,shopname,mobile,emailid,address,
country_id,state_id,district_id,city,pincode,pan_card_status,pan_number,idproof_id,addressproof_id,busproof_id,
status,created_date,idproof_path,addproof_path,busproof_path,sponser_id,agent_id,agent_image)values('" + typeid.Trim() + "','" + fname.Trim() + "','" + lname.Trim() + "','" + dob.Trim() + "','" + gender.Trim() + "','" +
comp_firmid.Trim() + "','" + shopname.Trim() + "','" + mobile.Trim() + "','" + emailid.Trim() + "','" + address.Trim() + "','" + country_id.Trim() + "','" +
state_id.Trim() + "','" + district_id.Trim() + "','" + city.Trim() + "','" + pincode.Trim() + "','" + pan_card_status.Trim() + "','" + pan_number.Trim() + "','" +
idproof.Trim() + "','" + addproof.Trim() + "','" + busproof.Trim() + "','A',getdate(),'" + idproofpath.ToString().Trim() + "','" + addproofpath.ToString().Trim() + "','" + busproofpath.Trim() + "','" + txtSponID.Text.Trim() + "','" + ViewState["agent_id"].ToString() + "','" + Session["ImgFileName"].ToString() + "')";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
System.IO.File.Copy(Server.MapPath("~/temp/" + Session["ImgFileName"].ToString()), Server.MapPath("~/images/" + Session["ImgFileName"].ToString()), true);
DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/temp"));
foreach (string img in Directory.GetFiles(Server.MapPath("~/temp")))
{
if (img.Contains(System.Web.HttpContext.Current.Session.SessionID) == true)
File.Delete(img);
}
flag2 = 1;
flag2 = 1;
string pos = "";
if (Spon_id.ToString() != "0")
{
if (rbleft.Checked == true && rbleft.Enabled == true)
{
pos = "Left";
}
else if (rbright.Checked == true && rbright.Enabled == true)
{
pos = "Right";
}
cls.SqlCmd.CommandText = "insert into agent_pair_inform(agent_id,joining_plan,no_left,no_right,entryby,entrydate,orgid,yrid,status,joinside)values('" + agent_id + "','',0,0,'" + Session["userid"].ToString() + "',getdate(),'" + Session["orgId"].ToString() + "','" + Session["Yrid"].ToString() + "','A','" + pos.Trim() + "')";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
string str = "";
if (pos.Trim() == "Left")
str = "update agent_pair_inform set left_id='" + agent_id + "' where agent_id='" + Spon_id + "'";
else
str = "update agent_pair_inform set right_id='" + agent_id + "' where agent_id='" + Spon_id + "'";
cls.SqlCmd.CommandText = str;
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
flag2 = 1;
if (Spon_id != "0")
{
DataTable dt2 = new DataTable();
while (true)
{
if (pos.Trim() == "Left")
cls.SqlCmd.CommandText = "update agent_pair_inform set no_left+=1, total_left+=1 where agent_id='" + Spon_id + "'";
else
cls.SqlCmd.CommandText = "update agent_pair_inform set no_right+=1, total_right+=1 where agent_id='" + Spon_id + "'";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
string lid = "", rid = "", blevel = "";
int lpair = -1, rpair = -1, parpair = -1, tpair = 0;
cls.SqlCmd.CommandText = "select left_id,right_id, pair_id from agent_pair_inform where agent_id='" + Spon_id + "'";
dt = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
if (dt.Rows.Count > 0)
{
lid = dt.Rows[0].ItemArray[0].ToString();
rid = dt.Rows[0].ItemArray[1].ToString();
parpair = Convert.ToInt32(dt.Rows[0].ItemArray[2].ToString());
if (lid != "")
{
cls.SqlCmd.CommandText = "select pair_id from agent_pair_inform where agent_id='" + lid + "'";
lpair = Convert.ToInt32(cls.getDataTable_Trans(cls.SqlCmd.CommandText).Rows[0].ItemArray[0].ToString());
}
if (rid != "")
{
cls.SqlCmd.CommandText = "select pair_id from agent_pair_inform where agent_id='" + rid + "'";
rpair = Convert.ToInt32(cls.getDataTable_Trans(cls.SqlCmd.CommandText).Rows[0].ItemArray[0].ToString());
}
cls.SqlCmd.CommandText = "select pair_id,total_pair from agent_pair_inform where agent_id='" + Spon_id.Trim() + "' and pair_id>4";
{
DataTable dt4 = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
if (dt4.Rows.Count > 0)
{
blevel = "Y";
tpair = Convert.ToInt32(dt4.Rows[0].ItemArray[1]);
}
}
if ((lpair == rpair) || (ch == "Y" && pos.Trim() == "Left" && lpair <= rpair) || (ch == "Y" && pos.Trim() == "Right" && rpair <= lpair) || blevel == ViewState["Blevel"].ToString())
{
cls.SqlCmd.CommandText = "select no_left,no_right, pair_id from agent_pair_inform where agent_id='" + Spon_id + "'";
dt1 = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
int left = 0, right = 0, pair = 0, flag = 0;
if (dt1.Rows.Count > 0)
{
left = Convert.ToInt32(dt1.Rows[0].ItemArray[0].ToString());
pair = Convert.ToInt32(dt1.Rows[0].ItemArray[2].ToString());
right = Convert.ToInt32(dt1.Rows[0].ItemArray[1].ToString());
}
if (left >= 1 && right >= 1)
{
if (left == 1 && right >= 2)
{
left = 0;
right = right - 2;
flag = 1;
}
else if (right >= 2 && left > 1)
{
left = left - 2;
flag = 1;
}
if (right == 1 && left >= 2)
{
left = left - 2;
right = 0;
flag = 1;
}
else if (left >= 2 && right > 1)
{
right = right - 2;
left = left - 2;
flag = 1;
}
}
if (flag == 1)
{
if (pair > 4)
{
cls.SqlCmd.CommandText = "select pair_no,pair_rate from plan_master where id=" + pair;
dt = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
if (tpair >= Convert.ToDouble(dt.Rows[0].ItemArray[0]))
{
double amt = Convert.ToDouble(dt.Rows[0].ItemArray[1].ToString());
cls.SqlCmd.CommandText = "insert into Agent_comp_level(agent_id,pair_id,amount,status)values('" + Spon_id + "','" + dt.Rows[0].ItemArray[0].ToString() + "','" + amt + "','A')";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
cls.SqlCmd.CommandText = "select id from plan_master where id >" + pair + " order by id";
dt1 = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
cls.SqlCmd.CommandText = "update agent_pair_inform set no_left=" + left + ", no_right=" + right + ", pair_id='" + dt1.Rows[0].ItemArray[0].ToString() + "',total_pair =0 where agent_id='" + Spon_id + "'";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
flag2 = 1;
ch = "Y";
ViewState["Blevel"] = "Y";
}
}
else
flag2 = 0;
}
else
{
cls.SqlCmd.CommandText = "update agent_pair_inform set no_left=" + left + ", no_right=" + right + ", pair_id='" + pair + "',total_pair +=1 where agent_id='" + Spon_id + "'";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
flag2 = 1;
ch = "Y";
ViewState["Blevel"] = "Y";
cls.SqlCmd.CommandText = "select id,pair_rate from plan_master where id ='" + pair + "' order by id";
dt = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
double amt = Convert.ToDouble(dt.Rows[0].ItemArray[1].ToString());
cls.SqlCmd.CommandText = "insert into Agent_comp_level(agent_id,pair_id,amount,status)values('" + Spon_id + "','" + pair + "','" + amt + "','A')";
flag2 = cls.ExecuteSql_Trans(cls.SqlCmd.CommandText);
}
}
cls.SqlCmd.CommandText = "select SUM(pair_no) from dbo.Plan_Master where id <'" + pair + "'";
dt = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
if (dt.Rows.Count > 0)
{
tpair = tpair + Convert.ToInt16(dt.Rows[0].ItemArray[0].ToString());
cls.SqlCmd.CommandText = "select id from Awards_RewardsMaster where pair_no='" + tpair + "'";
dt = cls.getDataTable_Trans(cls.SqlCmd.CommandText);
if (dt.Rows.Count > 0)
{
cls.SqlCmd.CommandText = "insert into Agent_comp_awards(award_id,agent_id,status)values('" + dt.Rows[0].ItemArray[0].ToString() + "','" + Spon_id + "','A')";
flag2 = cls.ExecuteSql_Trans(cls.SqlCmd.CommandText);
}
}
}
else
{
str = "select id,amount,p_level,bonus_amt from plan_master where id >" + pair + " order by id";
dt = cls.getDataTable(str);
if (dt.Rows.Count > 0)
{
cls.SqlCmd.CommandText = "update agent_pair_inform set no_left=" + left + ", no_right=" + right + ", pair_id='" + dt.Rows[0].ItemArray[0].ToString() + "' where agent_id='" + Spon_id + "'";
if (cls.ExecuteSql_Trans(cls.SqlCmd.CommandText) > 0)
{
flag2 = 1;
ch = "Y";
ViewState["Blevel"] = "Y";
if (Convert.ToInt32(dt.Rows[dt.Rows.Count - 1].ItemArray[1]) != pair)
{
double amt = Convert.ToDouble(dt.Rows[0].ItemArray[1].ToString()) + Convert.ToDouble(dt.Rows[0].ItemArray[3].ToString());
cls.SqlCmd.CommandText = "insert into Agent_comp_level(agent_id,pair_id,amount,status)values('" + Spon_id + "','" + dt.Rows[0].ItemArray[0].ToString() + "','" + amt + "','A')";
flag2 = cls.ExecuteSql_Trans(cls.SqlCmd.CommandText);
}
}
else
{
flag2 = 0;
ch = "N";
}
}
else
{
ch = "N";
}
}
}
else
{
ch = "N";
}
}
else
{
flag2 = 1;
ch = "N";
}
str = "select joinside from agent_pair_inform where agent_id='" + Spon_id + "'";
pos = cls.getDataTable_Trans(str).Rows[0].ItemArray[0].ToString();
str = "select sponser_id from userinfo_master where agent_id='" + Spon_id + "'";
dt2 = cls.getDataTable_Trans(str);
if (dt2.Rows.Count > 0)
{
Spon_id = dt2.Rows[0].ItemArray[0].ToString();
if (Spon_id == "0")
break;
}
else
{
agent_id = "0";
break;
}
}
}
}
}
}
else
flag2 = 0;
}
else
flag2 = 0;
}
else
{
cls.SqlCmd.CommandText = "insert into agent_pair_inform(agent_id,joining_plan,no_left,no_right,entryby,entrydate,orgid,yrid,status,joinside)values('" + agent_id + "','',0,0,'" + Session["userid"] + "',getdate(),'" + Session["orgId"] + "','" + Session["Yrid"] + "','A','" + pos.Trim() + "')";
cls.ExecuteSql_Trans(cls.SqlCmd.CommandText);
flag2 = 1;
}
}
if (flag2 == 1)
{
Tran.Commit();
lblmsg.Text = "Record inserted successfully";
cls.CloseConnection();
lblAgent.Text = ViewState["agent_id"].ToString();
PopPanel.Show();
lblimage.Visible = false;
ViewState["Blevel"] = "N";
}
else
{
Tran.Rollback();
cls.CloseConnection();
}
}
catch
{
lblmsg.Text = "Problem in saving";
Tran.Rollback();
}
finally
{
cls.CloseConnection();
}
}
protected void btnNew_Click(object sender, EventArgs e)
{
}
protected void checkmob_Click(object sender, EventArgs e)
{
string str = "select * from userinfo_master where mobile='" + txtmobno.Text.Trim() + "'";
if (cls.getDataTable(str).Rows.Count > 0)
{
lblmob.Text = "Mobile No already exists..";
}
else
lblmob.Text = "";
}
protected void checkEmail_Click(object sender, EventArgs e)
{
string str = "select * from userinfo_master where emailid='" + txtEmail.Text.Trim() + "'";
if (cls.getDataTable(str).Rows.Count > 0)
{
lblmail.Text = "Email-ID already exists..";
}
else
lblmail.Text = "";
}
protected void radPanStatus_SelectedIndexChanged(object sender, EventArgs e)
{
if (radPanStatus.SelectedValue == "Yes")
txtPanno.Visible = true;
else
txtPanno.Visible = false;
}
protected void btn_Search_Click(object sender, EventArgs e)
{
btnSave.Enabled = true;
if (txtSponID.Text.Trim() == "0")
{
rbleft.Checked = false;
rbleft.Enabled = false;
rbright.Checked = false;
rbright.Enabled = false;
}
else if (txtSponID.Text.Trim() != "")
{
string str = "select left_id,right_id from agent_pair_inform where agent_id='" + txtSponID.Text.Trim() + "'";
DataTable dt = cls.getDataTable(str);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0].ItemArray[0].ToString() == "" && dt.Rows[0].ItemArray[1].ToString() != "")
{
rbleft.Enabled = true;
rbleft.Checked = true;
rbright.Enabled = false;
rbright.Checked = true;
}
else if (dt.Rows[0].ItemArray[1].ToString() == "" && dt.Rows[0].ItemArray[0].ToString() != "")
{
rbleft.Enabled = false;
rbleft.Checked = true;
rbright.Enabled = true;
rbright.Checked = true;
}
else if (dt.Rows[0].ItemArray[1].ToString() != "" && dt.Rows[0].ItemArray[0].ToString() != "")
{
rbleft.Enabled = false;
rbright.Enabled = false;
rbleft.Checked = true;
rbright.Checked = true;
btnSave.Enabled = false;
}
else
{
rbleft.Enabled = true;
rbright.Enabled = true;
rbleft.Checked = true;
}
}
}
}
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
binddistrict();
}
protected void rbleft_CheckedChanged(object sender, EventArgs e)
{
if (rbleft.Checked == true)
{
rbright.Checked = false;
}
}
protected void rbright_CheckedChanged(object sender, EventArgs e)
{
if (rbright.Checked == true)
{
rbleft.Checked = false;
}
}
}
Kindly solve my problem.
Thanks