public static int UpdateTenant(mTenant pTenant)
        {
            int isSucess = 0;

            using (SqlConnection con = new SqlConnection(Global.connString))
            {
                con.Open();

                using (SqlCommand command = new SqlCommand("UPDATE tblTenantDetails SET  [TenantNationalID] = @TenantNationalID, [LandLordID] = @LandLordID, [TenantName] = @TenantName, [TenantEmail] = @TenantEmail, " +
                                                           " [TenantOccupation] = @TenantOccupation, [TenantCompany] = @TenantCompany, [TenantHomeAddress] = @TenantHomeAddress, [TenantPicture] = @TenantPicture," +
                                                           " [Status] = @Status WHERE TenantID = @TenantID ", con))

                {
                    command.Parameters.AddWithValue("@TenantID", pTenant.TenantID);
                    command.Parameters.AddWithValue("@TenantNationalID", pTenant.TenantNationalID);
                    command.Parameters.AddWithValue("@LandLordID", pTenant.LandLordID);
                    command.Parameters.AddWithValue("@TenantName", pTenant.TenantName);
                    command.Parameters.AddWithValue("@TenantEmail", pTenant.TenantEmail);
                    command.Parameters.AddWithValue("@TenantPhone", pTenant.TenantPhone);
                    command.Parameters.AddWithValue("@TenantOccupation", pTenant.TenantOccupation);
                    command.Parameters.AddWithValue("@TenantCompany", pTenant.TenantCompany);
                    command.Parameters.AddWithValue("@TenantHomeAddress", pTenant.TenantHomeAddress);
                    command.Parameters.AddWithValue("@TenantPicture", pTenant.TenantPicture);
                    command.Parameters.AddWithValue("@Status", pTenant.Status);


                    isSucess = command.ExecuteNonQuery();
                }
            }

            return(isSucess);
        }
        public static int AddNewTenant(mTenant pTenant)
        {
            int isSucess = 0;

            using (SqlConnection con = new SqlConnection(Global.connString))
            {
                con.Open();

                using (SqlCommand command = new SqlCommand("INSERT INTO tblTenantDetails (TenantNationalID , LandLordID , TenantName , TenantEmail , TenantPassword , TenantPhone, TenantOccupation, TenantCompany, TenantHomeAddress, TenantPicture, TenantAddedOn, Status) " +
                                                           " VALUES (@TenantNationalID, @LandLordID, @TenantName , @TenantEmail, @TenantPassword, @TenantPhone, @TenantOccupation, @TenantCompany,  @TenantHomeAddress, @TenantPicture, @TenantAddedOn ,@Status) select CAST(scope_identity() AS int) ", con))
                {
                    command.Parameters.AddWithValue("@TenantNationalID", pTenant.TenantNationalID);
                    command.Parameters.AddWithValue("@LandLordID", pTenant.LandLordID);
                    command.Parameters.AddWithValue("@TenantName", pTenant.TenantName);
                    command.Parameters.AddWithValue("@TenantEmail", pTenant.TenantEmail);
                    command.Parameters.AddWithValue("@TenantPassword", pTenant.TenantPassword);
                    command.Parameters.AddWithValue("@TenantPhone", pTenant.TenantPhone);
                    command.Parameters.AddWithValue("@TenantOccupation", pTenant.TenantOccupation);
                    command.Parameters.AddWithValue("@TenantCompany", pTenant.TenantCompany);
                    command.Parameters.AddWithValue("@TenantHomeAddress", pTenant.TenantHomeAddress);
                    command.Parameters.AddWithValue("@TenantPicture", pTenant.TenantPicture);
                    command.Parameters.AddWithValue("@TenantAddedOn", DateTime.Now);
                    command.Parameters.AddWithValue("@Status", pTenant.Status);


                    isSucess = Convert.ToInt32(command.ExecuteScalar());
                }
            }



            return(isSucess);
        }