protected void btnAdd_Click(object sender, EventArgs e) { if (btnAdd.Text == "Add") { int TypeID = Rent.ScalarFunctions("select max(RentTypeID) from RentTypeDetails"); string RentStmt = "Insert into RentTypeDetails values(" + TypeID.ToString() + ",'" + dd_Rtype.Text + "')"; if (Rent.InsertRec(RentStmt) == 1) { Response.Write("<script>alert('Rent Type Added Successfully...!');</script>"); dd_Rtype.SelectedIndex = 0; } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); dd_Rtype.SelectedIndex = 0; } } else { string StmtMod = "update RentTypeDetails set RentType='" + dd_Rtype.Text + "' where RentTypeID=" + hdn_rentID.Value; if (Rent.UpdateRec(StmtMod) == 1) { dd_Rtype.SelectedIndex = 0; Response.Redirect("ViewRentType.aspx?msg=0"); } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (btnAdd.Text == "Add") { int OnrID = Rent.ScalarFunctions("select max(OwnerID) from Owner_Details"); string OwnStmt = "Insert into Owner_Details values(" + OnrID.ToString() + ",'" + txtfname.Text + "', '"; OwnStmt += txtmname.Text + "','" + txtlname.Text + "','" + txtaddrs.Text + "'," + txtmobile.Text + ", "; OwnStmt += txtlndline.Text + ",'" + txtcity.Text + "','" + txtstate.Text + "','" + txtmail.Text + "')"; if (Rent.InsertRec(OwnStmt) == 1) { Response.Write("<script>alert('Owner Added Successfully...!');</script>"); txtfname.Text = ""; txtmname.Text = ""; txtlname.Text = ""; txtaddrs.Text = ""; txtmobile.Text = ""; txtlndline.Text = ""; txtcity.Text = ""; txtstate.Text = ""; txtmail.Text = ""; } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); txtfname.Text = ""; txtmname.Text = ""; txtlname.Text = ""; txtaddrs.Text = ""; txtmobile.Text = ""; txtlndline.Text = ""; txtcity.Text = ""; txtstate.Text = ""; txtmail.Text = ""; } } else { string StmtMod = "update Owner_Details set FName='" + txtfname.Text + "',MName='" + txtmname.Text + "', LName='"; StmtMod += txtlname.Text + "',Addrs='" + txtaddrs.Text + "',Mobile=" + txtmobile.Text + ",Landline="; StmtMod += txtlndline.Text + ",City='" + txtcity.Text + "',State='" + txtstate.Text + "',Email='" + txtmail.Text + "' where OwnerID=" + hdn_ownrID.Value; if (Rent.UpdateRec(StmtMod) == 1) { txtfname.Text = ""; txtmname.Text = ""; txtlname.Text = ""; txtaddrs.Text = ""; txtmobile.Text = ""; txtlndline.Text = ""; txtcity.Text = ""; txtstate.Text = ""; txtmail.Text = ""; Response.Redirect("ViewOwners.aspx?msg=0"); } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { int UID = Rent.ScalarFunctions("select max(UserID) from Tbl_UserDetails"); string UStmt = "Insert into Tbl_UserDetails values(" + UID.ToString() + ",'" + txtname.Text + "', '"; UStmt += txtmail.Text + "'," + txtmobile.Text + ",'" + txtmsg.Text + "')"; if (Rent.InsertRec(UStmt) == 1) { Response.Write("<script>alert('Your Message Has Been Sent...!');</script>"); txtname.Text = ""; txtmail.Text = ""; txtmobile.Text = ""; txtmsg.Text = ""; Response.Redirect("UserHome.aspx"); } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); txtname.Text = ""; txtmail.Text = ""; txtmobile.Text = ""; txtmsg.Text = ""; } }
protected void btnAdd_Click(object sender, EventArgs e) { if (dd_renttype.Text == "3") { int RentID = Rent.ScalarFunctions("select max(RentID) from Tbl_RentDetails"); string str = "Insert into PG values(" + RentID.ToString() + "," + dd_renttype.SelectedValue + "," + dd_owner.SelectedValue + ",'"; str += photo() + "','" + dd_avail.SelectedItem.Text + "','" + dd_capacity.Text + "','" + dd_bathrooms.Text + "','"; str += dd_gender.Text + "','" + dd_wifi.Text + "','" + dd_security.Text + "','" + dd_mess.Text + "'," + TextBox1.Text + "," + TextBox2.Text + ")"; if (Rent.InsertRec(str) == 1) { Response.Write("<script>alert('Rent Details Added Successfully...!');</script>"); } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); } } else { if (btnAdd.Text == "Add") { int RntID = Rent.ScalarFunctions("select max(RentID) from Tbl_RentDetails"); string RentStmt = "Insert into Tbl_RentDetails values(" + RntID.ToString() + "," + dd_renttype.SelectedValue + "," + dd_owner.SelectedValue + ",'"; RentStmt += photo() + "','" + dd_avail.SelectedItem.Text + "','" + dd_Furnish.SelectedItem.Text + "','" + dd_Bedrooms.SelectedItem.Text + "','"; RentStmt += dd_bath.SelectedItem.Text + "','" + dd_floar.Text + "','" + drop_for.Text + "','" + dd_park.Text + "','" + txtsqft.Text + "'," + txtAmt.Text + ",'" + dd_Nego.SelectedItem.Text + "')"; if (Rent.InsertRec(RentStmt) == 1) { Response.Write("<script>alert('Rent Details Added Successfully...!');</script>"); dd_renttype.SelectedIndex = 0; dd_owner.SelectedIndex = 0; dd_avail.SelectedIndex = 0; dd_Furnish.SelectedIndex = 0; dd_Bedrooms.SelectedIndex = 0; dd_bath.SelectedIndex = 0; txtsqft.Text = ""; txtAmt.Text = ""; dd_Nego.SelectedIndex = 0; } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); dd_renttype.SelectedIndex = 0; dd_owner.SelectedIndex = 0; dd_avail.SelectedIndex = 0; dd_Furnish.SelectedIndex = 0; dd_Bedrooms.SelectedIndex = 0; dd_bath.SelectedIndex = 0; txtsqft.Text = ""; txtAmt.Text = ""; dd_Nego.SelectedIndex = 0; } } else { string StmtMod = "update Tbl_RentDetails set RentTypeID='" + dd_renttype.SelectedValue + "',OwnerID='" + dd_owner.SelectedValue + "',Image='"; StmtMod += photo() + "',Availability='" + dd_avail.Text + "',Furnished='" + dd_Furnish.Text + "',BedRooms='" + dd_Bedrooms.Text + "',BathRooms='"; StmtMod += dd_bath.Text + "',floar='" + dd_floar.Text + "',fors='" + drop_for.Text + "',parking='" + dd_park.Text + "',Sqft='" + txtsqft.Text + "',Amount=" + txtAmt.Text + ",Negotiable='" + dd_Nego.Text + "' where RentID=" + hdn_rentID.Value; if (Rent.UpdateRec(StmtMod) == 1) { dd_renttype.SelectedIndex = 0; dd_owner.SelectedIndex = 0; dd_avail.SelectedIndex = 0; dd_Furnish.SelectedIndex = 0; dd_Bedrooms.SelectedIndex = 0; dd_bath.SelectedIndex = 0; txtsqft.Text = ""; txtAmt.Text = ""; dd_Nego.SelectedIndex = 0; Response.Redirect("ViewRentDetails.aspx?msg=0"); } else { Response.Write("<script>alert('Operation Is Aborted...!');</script>"); } } } }