protected void btnTenants_Click(object sender, EventArgs e) { try { if (ddlRoomNo.SelectedIndex != 0) { if ((checkDublicateRoomNO() == false) && (checkRoomOccupency() == true)) { string mobile = Session["s_MobileNo"].ToString(); DropDownList ddlPropertyName = (DropDownList)Master.FindControl("ddlProperty"); string PropertyName = ddlPropertyName.SelectedItem.Text; string PropertyVale = ddlPropertyName.SelectedItem.Value; string bedValue = Session["r_BedsValue"].ToString(); uc.AddTenants(mobile, PropertyName, PropertyVale, txtName.Text, txtMobileNo.Text, ddlRoomNo.SelectedItem.Text, txtRoomType.Text, bedValue, txtSecurityMoney.Text, txtRentMoney.Text, txtDateOfJoining.Text, txtRentDate.Text, ddlLockinPeriod.SelectedItem.Value, ddlLockinPeriod.SelectedItem.Text, txtDetails.Text); string textmsg = "Tenants " + txtName.Text + " Room " + ddlRoomNo.SelectedItem.Text + " Aloted Successfully !"; ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false); SendMsgToTenants(); SendMsgToPGManager(); AddDues(); AddSecurityAsDue(); txtName.Text = string.Empty; txtMobileNo.Text = string.Empty; txtSecurityMoney.Text = string.Empty; txtRentMoney.Text = string.Empty; txtDateOfJoining.Text = string.Empty; txtRentDate.Text = string.Empty; txtDetails.Text = string.Empty; } } else { string text = "Room Not selected Or not Found"; ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false); } } catch (Exception ex) { string text = ex.Message.ToString(); ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false); } }